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


tan

You can use the tan function to compute the tangent of a real number.

double_t tan (double_t x);
x
Any finite floating-point number.
DESCRIPTION
The tan function returns the tangent of its argument. The argument is the measure of an angle expressed in radians. This function is antisymmetric.

The atan function performs the inverse operation (arctan(y)) .

EXCEPTIONS
When x is finite and nonzero, the result of tan(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-22 shows the results when the argument to the tan function is a zero, a NaN, or an Infinity, plus other special cases for the tan function.
Special cases for the tan function
OperationResultExceptions raised
tan(pi) 0Inexact
tan(pi/2) + Inexact
tan(+0) +0None
tan(-0) -0 None
tan(NaN) NaNNone[43]
tan(+ ) NaNInvalid
tan(- ) NaNInvalid

EXAMPLES
z = tan(pi);   /* z = 0. The inexact exception is raised. */
z = tan(pi/2); /* z = +INFINITY. The inexact exception is 
                  raised. */
z = tan(pi/4); /* z = 1. The inexact exception is raised. */

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

Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996