Important: The information in this document is obsolete and should not be used for new development.
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 [-\x86, +\x86], 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 +\x86 x < 0 None +\x86/2 y > 0 None -\x86/2 y < 0 None \xB10 None x > 0 Inexact -\x86 x < 0 Inexact +\x86/2 y > 0 None -\x86/2 y < 0 None \xB1\x86 Inexact NaN[47] None[48] NaN None \x86/2 Inexact \xB10 None \xB13\x86/4 Inexact -\x86/2 Inexact \xB1\x86 None \xB13\x86/4 Inexact EXAMPLES
z = atan2(1.0, 1.0); /* z = arctan 1/1 = arctan 1 = \x86/4. The inexact exception is raised. */ z = atan2(3.5, 0.0); /* z = arctan 3.5/0 = arctan = \x86/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.