Function Log() Foundation
Calculates the natural logarithm of a numeric value.
Log( <nExpression> ) --> nNaturalLog
Log() returns the natural logarithm of a numeric value. When <nExpression> is less than or equal to zero, a numeric overflow occurs and "*****" is displayed.
Log() is a mathematical function which calculates the natural logarithm of a numeric value. Log() is the reverse of the function Exp(). Because of rounding errors the results of Log() and Exp() can deviate from one another, and the expression Exp(Log(nValue)) can differ from the value nValue.
The number of decimal places in the display of the result depends only on SET DECIMALS and not on the current setting of SET FIXED.
// The example shows various results of the function Log()
PROCEDURE Main
? Log(10) // result: 2.30
? Log(100) // result: 4.61
? Exp(Log(1)) // result: 1.00
? Log(2.718281828) // result: 1.00
RETURN
// The function Log10 calculates the decimal (base 10)
// logarithm of a numeric value.
FUNCTION Log10( nValue )
IF nValue > 0
nValue := Log( nValue ) / Log( 10 )
ELSE
nValue := NIL
ENDIF
RETURN nValue
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.