Pré. | Proc. |
powi
Real raised to integer power.SYNOPSIS:
double x, y, powi();
int n;
y = powi(x, n);
DESCRIPTION:
Returns an argument x raised to the nth power. The routine efficiently decomposes n as a sum of powers of two. The desired power is a product of two-to-the-kth powers of x. Thus to compute the 32767 power of x requires 28 multiplications instead of 32767 multiplications.
ACCURACY:
Relative error:
arithmetic x domain n domain # trials peak rms
DEC .04,26 -26,26 100000 2.7e-16 4.3e-17
IEEE .04,26 -26,26 50000 2.0e-15 3.8e-16
IEEE 1,2 -1022,1023 50000 8.6e-14 1.6e-14
Returns MAXNUM on overflow, zero on underflow.