Link to home
Start Free TrialLog in
Avatar of BIGELOJ
BIGELOJFlag for Canada

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.
Avatar of Brad Howe
Brad Howe
Flag of Canada image

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.
ASKER CERTIFIED SOLUTION
Avatar of techhealth
techhealth
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jason96
jason96

Avatar of BIGELOJ

ASKER

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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BIGELOJ

ASKER

I want the points divided equally between hades666 and techhealth.
Thank you.