SQL Reference

Returns the arctangent of the x and y coordinates specified by expression1 and expression2.

ATAN2 ( expression1 , expression2 ) |

ATAN2 takes the ratio of two sides of a right triangle and returns the corresponding angle. The ratio is the length of the side opposite the angle divided by the length of the side adjacent to the angle.

expression1 and expression2 specify the x and y coordinates of the end of the hypotenuse opposite the angle.

The result is expressed in radians and is in the range -pi/2 to pi/2 radians. To convert degrees to radians, multiply degrees by pi/180. To convert radians to degrees, multiply radians by 180/pi.

Both expression1 and expression2 must evaluate to approximate numeric data types.

The following example illustrates two ways to use the ATAN2 function:

select atan2 (1,1) * (180/ pi()) 'Arctangent in degrees' from syscalctable; ARCTANGENT IN DEGREES ----------------------- 45.000000000000000 1 record selected select atan2 (1,1) 'Arctangent in radians' from syscalctable; ARCTANGENT IN RADIANS ----------------------- 0.785398163397448 1 record selected |

ODBC compatible

© 2017 Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved.

Progress® OpenEdge® Release 11.7