|HP-UX Reference > S
HP-UX 11i Version 3: February 2007
scalb(), scalbf(), scalbl(), scalbw(), scalbq() — scale exponent of a radix-independent floating-point number
The scalb() function returns x * ry, where r is the radix of the machine's floating-point arithmetic. The radix r is 2 on all PA-RISC and Integrity servers.
Integrity Server Only
scalbf() is a float version of scalb(); it takes float arguments and returns a float result.
scalbl() is a long double version of scalb(); it takes long double arguments and returns a long double result.
scalbw() is an extended version of scalb(); it takes extended arguments and returns an extended result.
scalbq() is equivalent to scalbl() on HP-UX systems.
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) scalbw() or scalbq(), compile also with the -fpwidetypes option.
Make sure your program includes <math.h>. Link in the math library by specifying -lm on the compiler or linker command line.
scalb(-x, y) and -scalb(x, y) are equivalent.
If y is ±0, scalb() returns x.
If x is +0 and y is +INFINITY, scalb() returns a NaN and raises the invalid exception.
If x is +0 and y is an integer less than +INFINITY, scalb() returns +0.
If x is +INFINITY and y is an integer greater than -INFINITY, scalb() returns +INFINITY.
If x is finite and positive-signed and y is -INFINITY, scalb() returns +0.
If x is positive and y is +INFINITY, scalb() returns +INFINITY.
If x is +INFINITY and y is -INFINITY, scalb() returns a NaN.
If x or y is NaN, scalb() returns a NaN.
scalb() returns a properly signed infinity (equal to ±HUGE_VAL) (equal to +-HUGE_VAL) in lieu of a value whose magnitude is too large, and raises the overflow and inexact exceptions.
scalb() 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.
If the correct value would overflow or underflow, scalb() sets errno to [ERANGE].