Log Function

Language Items List

Definition:

Returns the natural logarithm of a number. The base of the natural logarithm, which is represented as e, is approximately 2.718282.

Syntax:

Log(number)


Syntax Description


number Any valid (nonzero) numeric expression


Note: An "Illegal function call" exception is thrown if the expression is zero.

Details:

The logarithm of a given number is the power to which the base e must be raised to attain that number.

To calculate base-n logarithms for any number (x) divide the natural logarithm of x by the natural logarithm of n as shown in the following equation:

Logn(x) = Log(x) /Log(n)

The following example illustrates a Function procedure that calculates base-10 logarithms:

Function Log10(x as double) As Double
Log10 = Log(x) / Log(10)
End Function

For example: Log10(100) = 2 , because 10(the base)^2(the exponent) = 100

log10(10) = 1, because 10^1 = 10,

Log10(x) asks: What number when 10 is raised to the power of it, yields x., or what is the exponent that will take the base 10 to x.


Note: The Exp Function, also called the antilogarithm, is used to perform the inverse operation of Log.

See Also:

Exp Function
Derived Math Functions