Syntax
LN(X)
Purpose
LN() returns the natural logarithm of X, which is the base-e logarithm of X. If X is less than or equal to 0, the function returns NULL and reports the alert Invalid argument for logarithm.
This function is a synonym for the LOG(X) function.
Examples
obclient> SELECT LN(-10), LN(0), LN(10), LN(-3.14), LN(3.14);
+---------+-------+-------------------+-----------+-------------------+
| LN(-10) | LN(0) | LN(10) | LN(-3.14) | LN(3.14) |
+---------+-------+-------------------+-----------+-------------------+
| NULL | NULL | 2.302585092994046 | NULL | 1.144222799920162 |
+---------+-------+-------------------+-----------+-------------------+
1 row in set, 3 warnings
obclient> SHOW WARNINGS;
+---------+------+--------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------+
| Warning | 3020 | Invalid argument for logarithm |
| Warning | 3020 | Invalid argument for logarithm |
| Warning | 3020 | Invalid argument for logarithm |
+---------+------+--------------------------------+
3 rows in set