atan2
atan2(
n_y
n_x
)
=> f_result
Description
Computes the principal value of the arc tangent of n_y/n_x, using the signs of both arguments to determine the quadrant of the return value.
Arguments
|
n_y
|
Vertical coordinate value.
|
|
n_x
|
Horizontal coordinate value.
|
|
|
n_y/n_x is the tangent of the required angle.
|
Value Returned
|
f_result
|
Arc tangent of y/x in the range [-pi,pi] radians. If both arguments are 0.0, 0.0 is returned.If x or y is NaN, NaN is returned. In IEEE754 mode, atan2() handles the following exceptional arguments according to ANSI/IEEE Std 754-1985:
|
|
|
atan2(+0,x) returns +0 for x>0 or x=+0
atan2(+0,x) returns +pi for x<0 or x=-0
atan2(y,+0) returns pi/2 for y>0
atan2(y,+0) returns -pi/2 for y<zatan2(+y,Inf) returns +0 for finite y>0atan2(+Inf,x) returns +pi/2 for finite xatan2(+y,-Inf) returns +pi for finite y>0atan2(+Inf,Inf) returns +pi/4atan2(+Inf,-Inf) returns +3pi/4
|
Examples
atan2(1 1)
=> 0.7853982
atan2(0 0)
=> 0.0
Related Topics
Trigonometric Functions
atan
Return to top