Cloud

atan2

The atan2() function returns the inverse tangent (arctangent) of y divided by x, expressed in radians. Unlike atan(), atan2() uses the signs of both arguments to determine the correct quadrant of the result. See also atan2d() to return the result in degrees.

Syntax

ATAN2(y, x)

Arguments

  • y: A number of type real or double precision.

  • x: A number of type real or double precision, of the same type as y.

Return type

Same as the input type (real or double precision).

Examples

Basic usage

SELECT ATAN2(1, 0);
       atan2
-------------------
 1.5707963267948966
(1 row)

Negative y value

SELECT ATAN2(-1, 0);
        atan2
---------------------
 -1.5707963267948966
(1 row)