acos
You can use the acos 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
The acos function returns the arc cosine of its argument x. The return value is expressed in radians in the range [0, �].
such that for -1
x
1
The cos 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 the acos function is a zero, a NaN, or an Infinity, plus other special cases for the acos function.
Special cases for the acos function
Operation | Result | Exceptions raised |
|
for |x| > 1 | NaN | Invalid |
|
| � | Inexact |
|
| +0 | None |
|
| �/2 | Inexact |
|
| �/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) = �. The inexact exception is
raised. */
[44] If the NaN is a signaling NaN, the invalid exception is raised.