LN scalar function

The LN function returns the natural logarithm of the argument. The LN and EXP functions are inverse operations.

Read syntax diagramSkip visual syntax diagramLN( numeric-expression)

The schema is SYSIBM.

The argument must be an expression that returns the value of any built-in numeric data type that is not DECFLOAT. If the argument is not a double precision floating-point number, it is converted to one for processing by the function.

The result of the function is a double precision floating-point number.

The result can be null; if the argument is null, the result is the null value.

Notes

Syntax alternatives:
LOG is a synonym for LN. However, it is supported only for compatibility with previous Db2 releases. LN should be used instead of LOG because some database managers and applications implement LOG as the natural logarithm of a number instead of the common logarithm of a number.

Examples

Example: Assume that host variable NATLOG is DECIMAL(4,2) with a value of 31.62. The following statement returns a double precision floating-point number with an approximate value of 3.45:
   SELECT LN(:NATLOG)
     FROM SYSIBM.SYSDUMMY1;