[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
LOG()
Calculate the natural logarithm of a numeric value
------------------------------------------------------------------------------
Syntax
LOG(<nExp>) --> nNaturalLog
Arguments
<nExp> is a numeric value greater than zero to be converted to its
natural logarithm.
Returns
LOG() returns the natural logarithm as a numeric value. If <nExp> is
less than or equal to zero, LOG() returns a numeric overflow (displayed
as a row of asterisks).
Description
LOG() is a numeric function that calculates the natural logarithm of a
number and is the inverse of EXP(). The natural logarithm has a base of
e which is approximately 2.7183. The LOG() function returns x in the
following equation,
e**x = y
where y is the numeric expression used as the LOG() argument (i.e.,
LOG(y) = x). Due to mathematical rounding, the values returned by LOG()
and EXP() may not agree exactly (i.e., EXP(LOG(x)) may not always equal
x).
Examples
. These examples demonstrate various results of LOG():
? LOG(10) // Result: 2.30
? LOG(10 * 2) // Result: 3.00
? EXP(LOG(1)) // Result: 1.00
? LOG(2.71) // Result: 1.00
. This example is a user-defined function that returns the base
10 logarithm:
FUNCTION Log10( nNumber )
IF nNumber > 0
RETURN LOG(nNumber)/LOG(10)
ELSE
RETURN NIL
ENDIF
Files Library is CLIPPER.LIB.
See Also:
EXP()
SET DECIMALS
SET FIXED
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson