borderAndreaVB free resources for Visual Basic developersborder
borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2014 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Error #5)Next Topic (Array with counter - help needed!) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Log10
Poster Message
ck2
Level: Graduate

Registered: 27-01-2006
Posts: 11

icon Log10

Hope someone can help me:
I need to use Log10() for some formulas in my program. How do I do Log10() in VB6?

Please write the code out if you could.

Thanks a lot

[Edited by ck2 on 20-04-2006 at 12:31 PM GMT]

20-04-2006 at 12:21 PM
View Profile Send Email to User Show All Posts | Quote Reply
steve_w
Level: Moderator


Registered: 18-04-2003
Posts: 1137
icon Re: Log10

Hi


Try this

Private Sub Command1_Click()

    Dim a As Double
    Dim b As Double
    
    b = 5
    
    a = Log(b) / 2.30258509299405
    
    MsgBox a

End Sub


Steve  

20-04-2006 at 03:48 PM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1652
icon Re: Log10

Just to clarify:

2.30258509299405=ln10


Log function in VB is actually natural logarithm (Ln), which has e as base. e constant is approximately 2.718282.

When I write

loga(b)


a represents logarithm base

Some math formulas:

loga(b)=log(b)/log(a)


Since you are having 10 as base, a will have value 10.

log10(b)=log(b)/log(10)


and as I mentioned earlier

log10=2.30258509299405


then we come to Steve's

a = Log(b) / 2.30258509299405


[Edited by Goran on 20-04-2006 at 11:19 PM GMT]

____________________________
If you find the answer helpful, please mark this topic as solved.

20-04-2006 at 10:19 PM
View Profile Send Email to User Show All Posts | Quote Reply
ck2
Level: Graduate

Registered: 27-01-2006
Posts: 11
icon Re: Log10

thanks. will try it later

21-04-2006 at 07:01 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : Log10
Previous Topic (Error #5)Next Topic (Array with counter - help needed!) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
borderAndreaVB free resources for Visual Basic developersborder
borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2014 Andrea Tincaniborder