Siebel VB Language Reference > VB Language Reference >

Log Function


This standard VB function returns the natural logarithm of a number.

Syntax

Log(number)

Argument
Description

number

Any valid numeric expression

Returns

The natural logarithm of number.

Usage

The return value is single-precision for an integer, currency, or single-precision numeric expression; double precision for a long, variant, or double-precision numeric expression.

Example

This example uses the Log function to determine which number is larger: 999^1000 (999 to the 1000th power) or 1000^999 (1000 to the 999th power). Note that you cannot use the exponent (^) operator for numbers this large.

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

Related Topics

Exp Function
Fix Function
Int Function
Rnd Function
Sgn Function
Sqr Function

Siebel VB Language Reference Copyright © 2006, Oracle. All rights reserved.