ATAN2 Function

Returns the arctangent of the x and y coordinates of a right triangle, in radians.

Category: Trigonometric
Returned data type: DOUBLE

Syntax

Arguments

expression-1

specifies any valid SQL expression that evaluates to a numeric value. expression-1 specifies the x coordinate of the end of the hypotenuse of a right triangle.

Data type DOUBLE
See <sql-expression>
FedSQL Expressions

expression-2

specifies any valid SQL expression that evaluates to a numeric value. expression-2 specifies the y coordinate of the end of the hypotenuse of a right triangle.

Data type DOUBLE
See <sql-expression>
FedSQL Expressions

Details

The ATAN2 function returns the arctangent (inverse tangent) of two numeric variables. The result of this function is similar to the result of calculating the arctangent of expression-1 / expression-2, except that the signs of both arguments are used to determine the quadrant of the result. If either of the arguments in ATAN2 is missing, then ATAN2 returns either a null or a SAS missing value.

Comparisons

The ATAN2 function is similar to the ATAN function except that ATAN calculates the arctangent of the angle from the value of one argument rather than from two arguments.

Example

The following statements illustrate the ATAN2 function:
Statements
Results
select atan2(-1, 0.5);
-1.10715
select atan2(6,8);
0.643501
select atan2(5,-3);
2.111216