Important: The information in this document is obsolete and should not be used for new development.
acos
You can use theacos
function to compute the arc cosine of a real number between -1 and +1.
double_t acos (double_t x);
x
- Any floating-point number in the range -1 x 1.
DESCRIPTION
Theacos
function returns the arc cosine of its argument x. The return value is expressed in radians in the range [0, \x86].
such that for -1 x 1Thecos
function performs the inverse operation .EXCEPTIONS
When x is finite and nonzero, the result of might raise one of the following exceptions:
- inexact (for all finite, nonzero values of x other than 1)
- invalid (if |x|>1)
SPECIAL CASES
Table 10-23 shows the results when the argument to theacos
function is a zero, a NaN, or an Infinity, plus other special cases for theacos
function.
Special cases for the acos
functionOperation Result Exceptions raised for |x| > 1 NaN Invalid \x86 Inexact +0 None \x86/2 Inexact \x86/2 Inexact NaN None[44] NaN Invalid NaN Invalid EXAMPLES
z = acos(1.0); /* z = arccos (1) = 0.0 */ z = acos(-1.0); /* z = arccos (-1) = \x86. The inexact exception is raised. */
[44] If the NaN is a signaling NaN, the invalid exception is raised.