HP-UX Reference (11i v3 07/02) - 3 Library Functions N-Z (vol 7)

p
pow(3M) pow(3M)
USAGE
To use these functions, compile either with the default
-Ae option or with the -Aa and
-D_HPUX_SOURCE
options.
To use (for Integrity servers)
poww(),
powq(), pownw(), pownq(), powllnw(),orpowllnq(),
compile also with the
-fpwidetypes option.
To use any of these functions, make sure your program includes
<math.h>, and link in the math library
by specifying
-lm on the compiler or linker command line.
For more information, see the HP-UX floating-point guide for HP Integrity servers at the following site:
http://www.hp.com/go/fp
.
PA-RISC Only
Millicode versions of the
pow() function are available. Millicode versions of math library functions are
usually faster than their counterparts in the standard library. To use these versions, compile your program
with the +Olibcalls or the +Oaggressive optimization option.
For special cases, the millicode versions return the same values as their standard library counterparts, but
do not set errno. (See the RETURN VALUE section.)
RETURN VALUE
Integrity System
For Integrity servers, the
pow() function follows the C99 specification for special cases:
pow(±0,y) returns ±Inf and raises the divide-by-zero floating-point exception for y an odd integer < 0.
pow(±0,y) returns +Inf and raises the divide-by-zero floating-point exception for y<0 and not an odd
integer.
pow(±0,y) returns ±0 for y an odd integer > 0.
pow(±0,y) returns +0 for y>0 and not an odd integer.
pow(-1,±Inf) returns 1.
pow(+1,x) returns 1 for any x, even a NaN.
pow(x,±0) returns 1 for any x, even a NaN.
pow(x,y) returns a NaN and raises the invalid floating-point exception for finite x<0 and finite non-integer
y.
pow(x,-Inf) returns +Inf for |x|<1.
pow(x,-Inf) returns +0 for |x|>1.
pow(x,+Inf) returns +0 for |x|<1.
pow(x,+Inf) returns +Inf for |x|>1.
pow(-Inf,y) returns -0 for y an odd integer < 0.
pow(-Inf,y) returns +0 for y<0 and not an odd integer.
pow(-Inf,y) returns -Inf for y an odd integer > 0.
pow(-Inf,y) returns +Inf for y>0 and not an odd integer.
pow(+Inf,y) returns +0 for y<0.
pow(+Inf,y) returns +inf for y>0.
Otherwise, if either argument is a NaN, then pow() returns a NaN.
pow() returns infinity in lieu of a value whose magnitude is too large, and raises the overflow and inexact
exceptions.
pow() raises the underflow and inexact exceptions whenever a result is tiny (essentially denormal or zero)
and thereby suffers loss of accuracy, and may raise those exceptions if the result is merely tiny.
pow() raises the inexact exception whenever a rounded result does not equal the mathematical result.
Return values and errno settings for pow() that match the PA-RISC behavior specified below can be
obtained on Integrity servers by compiling with the +Olibmerrno option.
HP-UX 11i Version 3: February 2007 2 Hewlett-Packard Company 123