ln() 是一个系统函数,用于返回给定值的自然对数。
ln() 在 PostgreSQL 6.5 中被添加。
用法
ln (numeric) →numeric
ln (double precision) →double precision
提供的值必须大于 0。
变更历史
- PostgreSQL 6.5
- 添加于 (commit 0e9d75c6)
示例
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
参考资料
- PostgreSQL 文档: 数学函数
分类
反馈
请在此处提交有关“ln()”的任何评论、建议或更正。