Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: PowerPC Numerics / Part 2 - The PowerPC Numerics C Implementation
Chapter 10 - Transcendental Functions / Trigonometric Functions


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, \x86].

 such that  for -1  x  1
The cos function performs the inverse operation (cos(y)) .

EXCEPTIONS
When x is finite and nonzero, the result of acos(x) 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
OperationResultExceptions raised
acos(x) for |x| > 1NaNInvalid
acos(-1) \x86Inexact
acos(+1) +0None
acos(+0) \x86/2Inexact
acos(-0) \x86/2Inexact
acos(NaN) NaNNone[44]
acos(+ ) NaNInvalid
acos(- ) NaNInvalid

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.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996