LN

2023-10-24 09:23:03  Updated

Syntax

LN(X)

Purpose

You can call this function to return 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 of 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 (0.00 sec)

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 (0.00 sec)

Contact Us