atan2
You can use theatan2
function to compute the arc tangent of a real number divided by another real number.
double_t atan2 (double_t y, double_t x);
y
- Any floating-point number.
x
- Any floating-point number.
DESCRIPTION
Theatan2
function returns the arc tangent of its first argument divided by its second argument. The return value is expressed in radians in the range [-�, +�], using the signs of its operands to determine the quadrant.such that
EXCEPTIONS
When x and y are finite and nonzero, the result of might raise one of the following exceptions:
- inexact (if either x or y is any finite, nonzero value)
- underflow (if the result is inexact and must be represented as a denormalized number or 0)
SPECIAL CASES
Table 10-26 shows the results when one of the arguments to theatan2
function is a zero, a NaN, or an Infinity. In this table, x and y are finite, nonzero floating-point numbers.
Special cases for the atan2
functionOperation Result Exceptions raised +0 x > 0 None +� x < 0 None +�/2 y > 0 None -�/2 y < 0 None �0 None x > 0 Inexact -� x < 0 Inexact +�/2 y > 0 None -�/2 y < 0 None �� Inexact NaN[47] None[48] NaN None �/2 Inexact �0 None �3�/4 Inexact -�/2 Inexact �� None �3�/4 Inexact EXAMPLES
z = atan2(1.0, 1.0); /* z = arctan 1/1 = arctan 1 = �/4. The inexact exception is raised. */ z = atan2(3.5, 0.0); /* z = arctan 3.5/0 = arctan= �/2 */
[47] If both arguments are NaNs, it is undefined which oneatan2
returns.
[48] If the NaN is a signaling NaN, the invalid exception is raised.