PostgreSQL/Math Functions/log
Содержание
log(10, 12.0) AS log_12, log(3, 12.0) AS "log 12, base 3";
<source lang="sql">
postgres=# postgres=# SELECT log(10, 12.0) AS log_12, postgres-# log(3, 12.0) AS "log 12, base 3";
log_12 | log 12, base 3
+--------------------
1.07918124604762482772 | 2.2618595071429149
(1 row) postgres=#
</source>
log(b numeric, x numeric) logarithm to base b
<source lang="sql">
postgres=# -- log(b numeric, x numeric) logarithm to base b postgres=# postgres=# select log(2.0, 64.0);
log
6.0000000000000000
(1 row) postgres=#
</source>
log(b, x): Returns the base b logarithm of x
<source lang="sql">
postgres=# postgres=# -- log(b, x): Returns the base b logarithm of x postgres=# select log(exp(1.0), 10.0) AS natural_log;
natural_log
2.3025850929940457
(1 row) postgres=#
</source>
log(dp or numeric) base 10 logarithm
<source lang="sql">
postgres=# -- log(dp or numeric) base 10 logarithm postgres=# select log(100.0);
log
2.0000000000000000
(1 row) postgres=#
</source>
log(x): Returns the base 10 logarithm of x
<source lang="sql">
postgres=# -- log(x): Returns the base 10 logarithm of x postgres=# SELECT log(12.0) AS log_12;
log_12
1.07918124604762482772
(1 row) postgres=#
</source>