Purpose
Returns the natural logarithm of a number. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
Log( num_expr )
num_expr is a numeric expression.
Return Value
Float
Description
The Log() function returns the natural logarithm of the numeric expression specified by the num_expr parameter.
The natural logarithm represents the number to which the mathematical value e must be raised in order to obtain num_expr. e has a value of approximately 2.7182818.
The logarithm is only defined for positive numbers; accordingly, the Log() function will generate an error if num_expr has a negative value.
You can calculate logarithmic values in other bases (for example, base 10) using the natural logarithm. To obtain the base-10 logarithm of the number n, divide the natural log of n ( Log( n ) ) by the natural logarithm of 10 ( Log( 10 ) ).
Example
Dim original_val, log_val As Float
original_val = 2.7182818
log_val = Log(original_val)
' log_val will now have a value of 1 (approximately),
' since E raised to the power of 1 equals
' 2.7182818 (approximately)
See Also:
Exp() function