NAME

power - exponentiation

SYNOPSIS

double power(x, y)
double x, y;

DESCRIPTION

Power returns y, i.e., x raised to the power y.  If y is zero, one is returned.  If x is zero and y is non-negative, one is returned.  The actual exponentiation is performed with pow (see exp(3)).  The absolute values of x and y are passed to pow.  The signs of x and y are applied to the result of pow to guarantee that it does not detect an error condition.  If y is negative, the reciprocal is taken.  If x is negative and y is odd, the value returned is negative.  If x is negative and y is even, the value returned is positive. 

It is more efficient to square a value by multiplying it by itself.  It is more efficient to take the square root of a value with sqr(math). 

This function implements exponentiation. 

SEE ALSO

sqr(math)
exp(3) in the UNIX Programmer’s Manual

DIAGNOSTICS

Error 11 (Division by zero) is generated if x is zero and y is negative. 

Error 5 (Illegal function call) is generated if x is negative and y is not an integer (mathematically). 

from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber