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 / Hyperbolic Functions


tanh

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

double_t tanh (double_t x);
x
Any floating-point number.
DESCRIPTION
The tanh function returns the hyperbolic tangent of its argument. The return value is in the range [-1, +1]. This function is antisymmetric.

The atanh function performs the inverse operation (arctanh(y)) .

EXCEPTIONS
When x is finite and nonzero, the result of tanh(x) raises the following exception:

  • inexact (for all finite, nonzero values of x)

SPECIAL CASES
Table 10-29 shows the results when the argument to the tanh function is a zero, a NaN, or an Infinity.
Special cases for the tanh function
OperationResultExceptions raised
tanh(+0) +0None
tanh(-0) -0 None
tanh(NaN) NaNNone[51]
tanh(+ ) +1None
tanh(- ) -1None

EXAMPLES
z = tanh(1.0);    /* z  0.761594. The inexact exception is 
                     raised. */
z = tanh(-1.0);   /* z  0.761594. The inexact exception is 
                     raised. */

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

Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996