跳到主要内容
版本: 最新版本-3.5

ln, dlog1, log

Computes the natural (base e) logarithm of a number. (计算一个数的自然对数(底数为e)。)

语法

ln(arg)
log(arg)
dlog1(arg)

参数

  • arg: the value whose logarithm you want to calculate. Only the DOUBLE data type is supported. (arg:要计算对数值。仅支持 DOUBLE 数据类型。)

注意

如果 arg 指定为负数或 0,StarRocks 将返回 NULL。

返回值

返回 DOUBLE 数据类型的值。

示例

Example 1: Calculate the natural logarithm of 3. (示例 1:计算 3 的自然对数。)

mysql> select ln(3);
+--------------------+
| ln(3) |
+--------------------+
| 1.0986122886681098 |
+--------------------+
1 row in set (0.00 sec)

mysql> select dlog1(3);
+--------------------+
| dlog1(3) |
+--------------------+
| 1.0986122886681098 |
+--------------------+
1 row in set (0.00 sec)

mysql> select log(3);
+--------------------+
| log(3) |
+--------------------+
| 1.0986122886681098 |
+--------------------+
1 row in set (0.00 sec)