HPlogo HP-UX Reference Volume 4 of 5 > s

scalb(3M)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

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 * ry, 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 * ry.

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.

STANDARDS CONFORMANCE

scalb(): SVID3, XPG4.2

© Hewlett-Packard Development Company, L.P.