LN Function

Calculates logarithms to base 'e'.

Syntax

LN(expression)

Syntax Elements

expression is any valid DataBasic expression or any string, substring, or value; expressed as a variable name, a value, or a string enclosed in quotes.

Operation

LN returns the natural logarithm of expression.

If expression evaluates to a number less than or equal to zero, a warning message displays and a value of zero is returned.

If there is no PRECISION statement in the program, the value is returned rounded to the nearest four decimal places. Otherwise, the number of decimal places returned is as specified by the PRECISION statement.

In each case, the significant decimal places returned are the result of rounding. However, only up to five places are significant. If the PRECISION statement specifies a precision greater than five, trailing zeros are appended to the five significant places so as to returned the numbers of places specified.

Examples

Z = LN(X)

Assigns the natural log of variable X to variable Z.

F = "12"
G = "14"
A = LN(F-G)
PRINT A

Prints a warning message and assigns a zero to variable A, because the expression F-G evaluates to a negative number.