FORTRAN Reference Manual
Intrinsic Functions
FORTRAN Reference Manual—528615-001
8-9
ATAN2 Function
Considerations
•
The result type of the ATAN function is the same as the type of its argument.
•
The value of ATAN (x), for any x, is the angle a (in radians) such that
 and x = TAN (a)
Example of the ATAN Function
v = ATAN (x)
ATAN2 Function
The ATAN2 function returns an arctangent expressed in radians.
The table below shows the argument and function type for the ATAN2 generic function 
and its associated specific function.
Considerations
•
The result type of the ATAN2 function is the same as the type of its arguments. 
Both arguments must be the same type.
•
The value of ATAN2 (y, x) is the angle a (in radians) such that
 and y/x = TAN (a)
and the quadrant of a is determined by the signs of the ordinate y and the abscissa 
x as follows:
if y < 0 then a < 0
if x < 0 then |a| > π/2
if x = 0 then |a| = π/2
•
If x and y are both zero, program execution terminates abnormally with an error 
message.
Example of the ATAN2 Function
a = ATAN2 (4.0, 5.0)
Syntax Argument Type Function Type
ATAN2 (y, x)
ATAN2 (y, x)Real Real
DATAN2 (y, x) Double Precision Double Precision
y and x are arithmetic expressions.
π 2⁄ a π 2⁄≤≤–
π a<π≤–










