LOG Function
----------------------------------------------------------------------------
Action
Returns the natural logarithm of a numeric expression.
Syntax
LOG( numeric-expression)
Remarks
The argument numeric-expression must be greater than zero. The natural
logarithm is the logarithm to the base e. The constant e is approximately
equal to 2.718282.
LOG is calculated in single precision if numeric-expression is an integer
or single-precision value. If you use any other numeric type, LOG is
calculated in double precision.
You can calculate base-10 logarithms by dividing the natural logarithm of
the number by the natural logarithm of 10. The following FUNCTION procedure
calculates base-10 logarithms.
FUNCTION Log10(X) STATIC
Log10=LOG(X)-LOG(10#)
END FUNCTION
See Also
EXP
Example
The following example prints the value of e and then prints the natural
logarithms of e taken to the first, second, and third powers.
CLS ' Clear screen.
PRINT EXP(1),
FOR I = 1 TO 3
PRINT LOG(EXP(1) ^ I),
NEXT
PRINT
Output
2.718282 1 2 3