Log
Returns the logarithm of a number.
Syntax
Log(Val [, Base])
Parameters
Val
Type: Double
A numeric value.
Base
Type: Double
Optional. The base for the logarithm. If omitted or <= 0.0, e is used.
(return)
Type: Double
Logarithm of Val.
Remarks
The logarithm is the power to which Base must be raised to get Val. If Base is not specified, base e is used to return the natural logarithm of Val. Base e is approximately 2.718282.
An error occurs if Val is negative or if Base is 1.0 (as 1.0 raised to any power is always 1.0). If Val is 0.0, the return value is 0.0. If the current data value is NULL, Val is 0.0 and the return value is 0.0.
This function is similar to the Log function in VBScript.
Example
The following mrScriptBasic example uses the Log function to return the natural logarithm of 15, and the logarithm of 15 to the base of 10:
Dim MyNaturalLogarithm, MyLog10
MyNaturalLogarithm = Log(15) ' Returns 2.70805020110221
MyLog10 = Log(15, 10) ' Returns 1.17609125905568
See also