asked on # How do you use the LN function that is found on a Business Calculator in Visual Basic?

I need to know how call a function in Visual Basic that does the same thing as the LN button on a business calculator. I found the following on this site:

Private Function Ln(ByVal Number As Double) As Double

Ln = Log(Number) / Log(Exp(1))

End Function

I get errors stating that the Log and Exp portions have not been declared. I thought that these were built-in function of VB?

My other part of my code calls this function as follows:

'Now Call the function that performs the LN portion on a calculator

Dim dblLN1, dblLN2 As Double

dblLN1 = Ln(dblNumerator)

dblLN2 = Ln(dblDenominator)

I am using Visual Studio 2008. Any help would be GREATLY appreciated.

Private Function Ln(ByVal Number As Double) As Double

Ln = Log(Number) / Log(Exp(1))

End Function

I get errors stating that the Log and Exp portions have not been declared. I thought that these were built-in function of VB?

My other part of my code calls this function as follows:

'Now Call the function that performs the LN portion on a calculator

Dim dblLN1, dblLN2 As Double

dblLN1 = Ln(dblNumerator)

dblLN2 = Ln(dblDenominator)

I am using Visual Studio 2008. Any help would be GREATLY appreciated.

Visual Basic ClassicAlgorithms

Her you go - http://msdn.microsoft.com/en-us/library/5xkbf3yw(VS.85).aspx

You can use Math.Log like such.

Dim i As Integer

i = Math.Log(5)

Log(Double) Returns the natural (base e) logarithm of a specified number.

Log(Double, Double) Returns the logarithm of a specified number in a specified base.

Dim i As Integer

i = Math.Log(5)

Log(Double) Returns the natural (base e) logarithm of a specified number.

Log(Double, Double) Returns the logarithm of a specified number in a specified base.

Log in or sign up to see answer

Become an EE member today7-DAY FREE TRIAL

Members can start a 7-Day Free trial then enjoy unlimited access to the platform

or

Learn why we charge membership fees

We get it - no one likes a content blocker. Take one extra minute and find out why we block content.

Not exactly the question you had in mind?

Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.

ask a questionThis is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.

rwheeler23

If LOG() in VB is natural logarithm then why is it asking me to declare it as a variable and it is not listed when I try to select it. Please see the Image.

LN.JPG

Get an unlimited membership to EE for less than $4 a week.

Unlimited question asking, solutions, articles and more.

I want the points divided equally between hades666 and techhealth.

Thank you.

Get an unlimited membership to EE for less than $4 a week.

Unlimited question asking, solutions, articles and more.