PostgreSQL ATAN2 Function

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PostgreSQL ATAN2() function

ATAN2() function

The PostgreSQL atan2() function is used to return the inverse tangent of a division given in the argument.

Syntax :

atan2(b,a)

PostgreSQL Version : 9.3

Pictorial presentation of PostgreSQL ATAN2() function

 

Example 1: PostgreSQL ATAN2() function

SELECT ATAN2(0,1) AS "Atan2 (0,1)";

Output :

 Atan2 (0,1)
-------------
           0
(1 row)

Example 2: PostgreSQL ATAN2() function

SELECT ATAN2(1,0) AS "Atan2 (1,0)";

Output :

   Atan2 (1,0)
-----------------
 1.5707963267949
(1 row)

Example 3: PostgreSQL ATAN2() function

SELECT ATAN2(1,-1) AS "Atan2 (1,-1)";

Output :

   Atan2 (1,-1)
------------------
 2.35619449019234
(1 row)

Example 4: PostgreSQL ATAN2() function

SELECT ATAN2(-3,2) AS "Atan2 (-3,2)";

Output :

    Atan2 (-3,2)
--------------------
 -0.982793723247329
(1 row)