log10() 是一个系统函数,用于返回指定值的以 10 为底的对数。
log10() 函数在 PostgreSQL 12 中被添加,是现有 log() 函数的 SQL 标准等效函数。
用法
log10 (numeric) →numeric
log10 (double precision) →double precision
提供的值必须大于 0。
变更历史
- PostgreSQL 12
- 添加(提交 f1d85aa9)
示例
log10() 的基本用法示例
postgres=# SELECT log10(2);
log10
--------------------
0.3010299956639812
(1 row)
无法计算零或负数的对数
postgres=# SELECT log10(0); ERROR: cannot take logarithm of zero postgres=# SELECT log10(-1); ERROR: cannot take logarithm of a negative number
参考资料
- PostgreSQL 文档: 数学函数
分类
反馈
请在此处 提交关于“log10()”的任何评论、建议或更正。