预订演示
前页 后页

exp

Exponential function.

SYNOPSIS:

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

DESCRIPTION:

Returns e (2.71828...) raised to the x power.

Range reduction is accomplished by separating the argument into an integer k and fraction f such that:

      x    k   f
     e  = 2   e

A Pade' form
  1 + 2x P(x**2)/(Q(x**2) - P(x**2)) of degree 2/3 is used to approximate exp(f) in the basic interval [-0.5, 0.5].


ACCURACY:
                      Relative error:
arithmetic   domain     # trials      peak         rms
    DEC       +- 88       50000       2.8e-17     7.0e-18
    IEEE      +- 708      40000       2.0e-16     5.6e-17


Error amplification in the exponential function can be a serious matter.  The error propagation involves:
exp(X(1+delta)) = exp(X) (1 + X*delta + ...)
This shows that a 1 lsb error in representing X produces a relative error of X times 1 lsb in the function. While the routine gives an accurate result for arguments that are exactly represented by a double precision computer number, the result contains an amplified roundoff error for large arguments not exactly represented.

ERROR MESSAGES:
  message         condition      value returned
  underflow       x < MINLOG        0.0
  overflow        x > MAXLOG        INFINITY