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:
This method is available if the BuiltIn plugin is installed and enabled. The plugin is installed and enabled by default.
The method is applied to the following object:
The method has the following parameter:
The positive number whose natural logarithm you want to get.
The natural logarithm of the specified number.
The following function uses the
BuiltIn.Log method to calculate base-2 logarithm of passed argument.
return BuiltIn.Log(x) / BuiltIn.Log(2);
def log2(x): return BuiltIn.Log(x) / BuiltIn.Log(2)
log2 = BuiltIn.Log(x) / BuiltIn.Log(2)
Result := BuiltIn.Log(x) / BuiltIn.Log(2);
return BuiltIn["Log"](x) / BuiltIn["Log"](2);