Get Logarithm Method

The Get Logarithm method returns the natural logarithm of a number. For information on how this method handles the data type, see How Some Math Methods Handle the Data Type.

Format

Log(number)

This method uses the same arguments as the Get Absolute Value method. For more information, see Get Absolute Value Method.

Example

The following example uses the Get Logarithm method to determine which of the following numbers is larger:

  • 999^1000 (999 to the 1000th power)

  • 1000^999 (1000 to the 999th power):

Sub Button_Click
   Dim x
   Dim y
   x = 999
   y = 1000
   a = y * (Log(x))
   b = x * (Log(y))
   If a>b then
       "999^1000 is greater than 1000^999"
   Else
       "1000^999 is greater than 999^1000"
      End If
End Sub

You cannot use the exponent (^) operator for very large numbers, such as 999^1000.