LN() 是 MySQL 的数学函数。此函数用于获取给定数字的自然对数。
语法
select LN(number);
参数:
number : 获取log值的数。
返回
此函数返回给定数字的自然对数。如果数字小于或等于 0,此函数将返回 NULL。
示例 1
select LN(5);
输出:
mysql> select LN(5);
+--------------------+
| LN(5) |
+--------------------+
| 1.6094379124341003 |
+--------------------+
1 row in set (0.00 sec)
+--------------------+
| LN(5) |
+--------------------+
| 1.6094379124341003 |
+--------------------+
1 row in set (0.00 sec)
示例 2
select LN(11);
输出:
mysql> select LN(11);
+--------------------+
| LN(11) |
+--------------------+
| 2.3978952727983707 |
+--------------------+
1 row in set (0.00 sec)
+--------------------+
| LN(11) |
+--------------------+
| 2.3978952727983707 |
+--------------------+
1 row in set (0.00 sec)
示例 3
select LN(45.2);
输出:
mysql> select LN(45.2);
+--------------------+
| LN(45.2) |
+--------------------+
| 3.8110970868381857 |
+--------------------+
1 row in set (0.00 sec)
+--------------------+
| LN(45.2) |
+--------------------+
| 3.8110970868381857 |
+--------------------+
1 row in set (0.00 sec)