LN
The LN function returns the natural logarithm of a number. The LN and EXP functions are inverse operations.
- expression
- An expression that returns a value of any built-in numeric, character-string, or graphic-string data type. A string argument is cast to double-precision floating point before evaluating the function. For more information about converting strings to double-precision floating point, see DOUBLE_PRECISION or DOUBLE. The value of the argument must be greater than zero.
If the data type of the argument is DECFLOAT(n), the result is DECFLOAT(n). Otherwise, the data type of the result is double-precision floating point. If the argument can be null, the result can be null; if the argument is null, the result is the null value.
Note
Results involving
DECFLOAT special values: For decimal floating-point values the
special values are treated as follows:
Example
- Assume the host variable NATLOG is a DECIMAL(4,2) host variable
with a value of 31.62.
Returns the approximate value 3.45.SELECT LN(:NATLOG) FROM SYSIBM.SYSDUMMY1
1 If
*YES is specified for the SQL_DECFLOAT_WARNINGS query option, NaN is returned
with a warning.