预订演示
前页 后页

tanh

Hyperbolic tangent.

SYNOPSIS:

double x, y, tanh();
y = tanh(x);

DESCRIPTION:

Returns the hyperbolic tangent of an argument in the range MINLOG to MAXLOG.

A rational function is used for |x| < 0.625.  The form:
x + x**3 P(x)/Q(x) of Cody _& Waite
is employed.
Otherwise:
   tanh(x) = sinh(x)/cosh(x) = 1 - 2/(exp(2x) + 1).

ACCURACY:
                      Relative error:
arithmetic   domain     # trials      peak         rms
    DEC       -2,2        50000       3.3e-17     6.4e-18
    IEEE      -2,2        30000       2.5e-16     5.8e-17