log10()

返回以 10 为底的对数的函数

log10() 是一个系统函数,用于返回指定值的以 10 为底的对数。

log10() 函数在 PostgreSQL 12 中被添加,是现有 log() 函数的 SQL 标准等效函数。

用法

log10 ( numeric ) → numeric
log10 ( double precision ) → double precision

提供的值必须大于 0

变更历史

示例

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

分类

系统函数

另请参阅

log(), ln()

反馈

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