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

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

Версия 13:45, 26 мая 2010

atan, atan2(-1, 0), atan

postgres=# SELECT atan2(1, 0) AS positive_x,
postgres-#        atan2(-1, 0) AS negative_x,
postgres-#        atan2(0, 0) AS zero_x,
postgres-#        pi() / 2 AS pi_over_two;
   positive_x    |    negative_x    | zero_x |   pi_over_two
-----------------+------------------+--------+-----------------
 1.5707963267949 | -1.5707963267949 |      0 | 1.5707963267949
(1 row)
postgres=#



atan2(x, y): Returns the inverse tangent of the quotient of x and y

postgres=#
postgres=# -- atan2(x, y): Returns the inverse tangent of the quotient of x and y
postgres=# SELECT atan2(0, 1), atan2(1, 1),
postgres-#        atan(0 / 1) AS functionally,
postgres-#        atan(1 / 1) AS identical;
 atan2 |       atan2       | functionally |     identical
-------+-------------------+--------------+-------------------
     0 | 0.785398163397448 |            0 | 0.785398163397448
(1 row)
postgres=#