PostgreSQL/Math Functions/log — различия между версиями

Материал из SQL эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 10:14, 26 мая 2010

log(10, 12.0) AS log_12, log(3, 12.0) AS "log 12, base 3";

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=#



log(b numeric, x numeric) logarithm to base b

postgres=# -- log(b numeric, x numeric) logarithm to base b
postgres=#
postgres=# select log(2.0, 64.0);
        log
--------------------
 6.0000000000000000
(1 row)
postgres=#



log(b, x): Returns the base b logarithm of x

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=#



log(dp or numeric) base 10 logarithm

postgres=# -- log(dp or numeric) base 10 logarithm
postgres=# select log(100.0);
        log
--------------------
 2.0000000000000000
(1 row)
postgres=#



log(x): Returns the base 10 logarithm of x

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=#