HP-UX Reference (11i v1 05/09) - 3 Library Functions N-Z (vol 7)

s
scalb(3M) scalb(3M)
NAME
scalb() - scale exponent of a radix-independent floating-point number
SYNOPSIS
#include <math.h>
double scalb(double x, double y);
DESCRIPTION
The scalb() function returns x r
y
, where r is the radix of the machine’s floating-point arithmetic.
When r is 2 (as it is on all PA-RISC systems),
scalb() is equivalent to ldexp().
The
scalb() function is recommended by the IEEE-754 standard for floating-point arithmetic. The
ISO/ANSI C committee has approved the
scalb() function for inclusion in the C9X draft standard.
To use this functions, compile either with the default
-Ae option or with the -Aa and -D_HPUX_SOURCE
options. Make sure your program includes <
math.h>. Link in the math library by specifying -lm on the
compiler or linker command line.
RETURN VALUE
Upon successful completion, the
scalb() function returns x r
y
.
scalb(-x, y) and -scalb(x, y) are equivalent.
If y is nonintegral, scalb() returns a NaN.
If y is ±zero, scalb() returns x.
If x is +zero and y is +INFINITY,
scalb() returns a NaN and raises the invalid exception.
If x is +zero and y is an integer less than +INFINITY,
scalb() returns +zero.
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 +zero.
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.
If the correct value after rounding would be smaller in magnitude than MINDOUBLE, scalb() returns
zero.
If the correct value would overflow,
scalb() returns ±HUGE_VAL (according to the sign of x) and sets
errno to [ERANGE].
ERRORS
If scalb() fails, errno is set to the following value.
[ERANGE] The correct value would overflow.
SEE ALSO
scalbn(3M), ilogb(3M), ldexp(3M), logb(3M), math(5), values(5).
STANDARDS CONFORMANCE
scalb(): SVID3, XPG4.2
Section 3854 Hewlett-Packard Company 1 HP-UX 11i Version 1: September 2005