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


sin

You can use the sin function to compute the sine of a real number.

double_t sin (double_t x);
x
Any finite floating-point number.
DESCRIPTION
The sin function returns the sine of its argument. The argument is the measure of an angle expressed in radians. This function is antisymmetric with respect to the y-axis
(sin x sin -x).

The asin function performs the inverse operation (arcsin(y)) .

EXCEPTIONS
When x is finite and nonzero, the result of sin(x) might raise one of the following exceptions:

  • inexact (for all finite, nonzero values of x)
  • underflow (if the result is inexact and must be represented as a denormalized number or 0)

SPECIAL CASES
Table 10-21 shows the results when the argument to the sin function is a zero, a NaN, or an Infinity, plus other special cases for the sin function.
Special cases for the sin function
OperationResultExceptions raised
sin(pi) 0Inexact
sin(+0) +0None
sin(-0) -0None
sin(NaN) NaNNone[42]
sin(+ ) NaNInvalid
sin(- ) NaNInvalid

EXAMPLES
z = sin(pi/2);    /* z = 1. The inexact exception is raised. */
z = sin(pi);      /* z = 0. The inexact exception is raised. */
z = sin(-pi/2);   /* z = -1. The inexact exception is raised. */
z = sin(-pi);     /* z = 0. The inexact exception is raised. */

[42] If the NaN is a signaling NaN, the invalid exception is raised.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996