PostgreSQL atan2() Function
The PostgreSQL atan2()
function returns the arc tangent of the result of dividing the specified two numbers, in radians.
atan2()
Syntax
This is the syntax of the PostgreSQL atan2()
function:
atan2(x, y)
Parameters
x
-
Required. The dividend.
y
-
Required. The divisor.
Return value
The PostgreSQL atan2(x, y)
function returns the arc tangent of the result of dividing the specified two numbers, in radians.
If the parameter number
is NULL
, the atan2()
function will return NULL
.
atan2()
Examples
Here are a few examples of the atan2()
function:
SELECT
atan2(1, 0) AS "atan2(1, 0)",
atan2(1, 2) AS "atan2(1, 2)",
atan2(0, 1) AS "atan2(0, 1)";
-[ RECORD 1 ]+-------------------
atan2d(1, 0) | 90
atan2d(1, 2) | 26.565051177077986
atan2d(0, 1) | 0