Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)
scalb(3) Guardian Native C Library Calls Reference Manual
NAME
scalb - Computes exponent of a radix-independent floating-point number
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRESRL
G-series native OSS processes: /G/system/sysnn/zcresrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
H-series OSS processes: /G/system/zdllnnn/zcredll
SYNOPSIS
#include <math.h>
double scalb(
double x,
double n
);
PARAMETERS
x Is the value to be multiplied.
n Is the exponent of the radix.
DESCRIPTION
The scalb() function calculates the value of x * r**n for integral values of n, where r is the radix
of the machine’s floating-point arithmetic. When r is 2, the scalb() function is equivalent to the
ldexp() function.
NOTES
The scalb() function can be called only by native processes.
This function supports both IEEE Std 754-1985 floating-point and Tandem floating-point values.
IEEE values can include NaN and infinity, and the sign of 0.0 (zero) can be either positive or
negative. Refer to the fp_class(3) reference page for a description of IEEE value classes.
Guardian functions are available to convert between floating-point formats. Refer to the Guar-
dian Programmer’s Guide for a discussion of floating-point conversions.
RETURN VALUES
On successful completion, the scalb() function returns the value of x * r**n.
If the computed value would cause overflow, the scalb() function returns positive or negative
HUGE_VAL (based on the sign of the x parameter) and sets errno to [ERANGE]. If the com-
puted value would cause underflow, the scalb() function returns 0.0 (zero) and sets errno to
[ERANGE].
For IEEE floating-point values, if the value of x is positive or negative infinity, the value of x is
returned. If the value of x or n is NaN, NaN is returned.
ERRORS
If any of the following conditions occurs, the scalb() function sets errno to the corresponding
value:
[ERANGE] The correct return value would cause an underflow or an overflow.
RELATED INFORMATION
Functions: fp_class(3), isnan(3).
6−2 Hewlett-Packard Company 527192-005