Description
Use this routine to calculate a natural logarithm of any positive number. The natural logarithm is the logarithm to the base of e, where e is a constant that approximately equals to 2.718282.
Using this routine you can also calculate the base-n logarithms for any number x by dividing the natural logarithm of x by the natural logarithm of n as follows: Logn(x)=Log(x)/Log(n)
This method is available if the BuiltIn plugin is installed and enabled. The plugin is installed and enabled by default.
Declaration
Applies To
The method is applied to the following object:
Parameters
The method has the following parameter:
Value
The positive number whose natural logarithm you want to get.
Result Value
The natural logarithm of the specified number.
Example
The following function uses the BuiltIn.Log
method to calculate base-2 logarithm of passed argument.
JavaScript, JScript
function log2(x)
{
return BuiltIn.Log(x) / BuiltIn.Log(2);
}
Python
def log2(x):
return BuiltIn.Log(x) / BuiltIn.Log(2)
VBScript
Function log2(x)
log2 = BuiltIn.Log(x) / BuiltIn.Log(2)
End Function
DelphiScript
function log2(x);
begin
Result := BuiltIn.Log(x) / BuiltIn.Log(2);
end;
C++Script, C#Script
function log2(x)
{
return BuiltIn["Log"](x) / BuiltIn["Log"](2);
}