预订演示
前页 后页

pow

Power function

SYNOPSIS:

double x, y, z, pow();
z = pow(x, y);

DESCRIPTION:

Computes x raised to the yth power.  Analytically:

      x**y  =  exp(y log(x)).

Following Cody and Waite, this program uses a lookup table of 2**-i/16 and pseudo extended precision arithmetic to obtain an extra three bits of accuracy in both the logarithm and the exponential.

ACCURACY:
                      Relative error:
arithmetic   domain     # trials      peak         rms
    IEEE     -26,26       30000      4.2e-16      7.7e-17
    DEC      -26,26       60000      4.8e-17      9.1e-18
1/26 < x < 26, with log(x) uniformly distributed.
-26 < y < 26, y uniformly distributed.
    IEEE     0,8700       30000      1.5e-14      2.1e-15
0.99 < x < 1.01, 0 < y < 8700, uniformly distributed.


ERROR MESSAGES:
message          condition         value returned
overflow       x**y > MAXNUM          INFINITY
underflow      x**y < 1/MAXNUM          0.0
domain         x<0 and y noninteger     0.0