Log, Log2 and Log10 Numeric Functions

Purpose

Returns a natural, base 2 or base10 logarithm of a numeric expression.

Syntax

Log(x)

Log2(x)

Log10(x)

Description

Log(x) calculates the logarithm of x to the base of Euler's number e (= 2.178....), Log2(x) to the base of 2 and Log10(x) to the base of 10.

Example

Debug.Show

Trace Log(Sqr(2)) // Prints 0.34657

Trace Log2(42)    // Prints 5.392...

Trace Log10(100// Prints 2

Remarks

Log(x) is the reverse function of Exp(x), which means:

Log(Exp(PI)) = PI = 3.14....

Similarly, Log2(x) and Log10(x) are the reverse functions of Exp2(x) and Exp10(x) respectively.

The following function is used to calculate the logarithm of any base:

Print LogBasis(8, 2)

 

Function LogBasis(x, LogBase)

Return Log(x) / Log(LogBase)

EndFunc

See Also

Exp(), Exp2, Exp10

{Created by Sjouke Hamstra; Last updated: 12/10/2014 by James Gaite}