Réserver une Démo
Pré. Proc.

log

Natural logarithm.

SYNOPSIS:

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

DESCRIPTION:

Returns the base e (2.718...) logarithm of x.

The argument is separated into its exponent and fractional parts. If the exponent is between -1 and +1, the logarithm of the fraction is approximated by:

     log(1+x) = x - 0.5 x**2 + x**3 P(x)/Q(x).

Otherwise, setting  z = 2(x-1)/x+1),

     log(x) = z + z**3 P(z)/Q(z).


ACCURACY:
                      Relative error:
arithmetic   domain     # trials      peak         rms
    IEEE      0.5, 2.0    150000      1.44e-16    5.06e-17
    IEEE      +-MAXNUM    30000       1.20e-16    4.78e-17
    DEC       0, 10       170000      1.8e-17     6.3e-18

In the tests over the interval [+-MAXNUM], the logarithms of the random arguments were uniformly distributed over [0,MAXLOG].

ERROR MESSAGES:

singularity:  x = 0; returns -INFINITY
domain:       x < 0; returns NAN