ln()

返回自然对数的函数

ln() 是一个系统函数,用于返回给定值的自然对数。

ln()PostgreSQL 6.5 中被添加。

用法

ln ( numeric ) → numeric
ln ( double precision ) → double precision

提供的值必须大于 0

变更历史

示例

ln() 的基本用法示例

postgres=# SELECT ln(2);
         ln         
--------------------
 0.6931471805599453
(1 row)

无法计算零或负数的自然对数。

postgres=# SELECT ln(0);
ERROR:  cannot take logarithm of zero

postgres=# SELECT ln(-1);
ERROR:  cannot take logarithm of a negative number

分类

系统函数

另请参阅

log(), log10()

反馈

请在此处提交有关“ln()”的任何评论、建议或更正。