Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)

ldexp(3) Guardian Native C Library Calls Reference Manual
NAME
ldexp - Multiplies a oating-point number by a power of 2
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 ldexp(
double value,
int exp
);
PARAMETERS
value Species the value to be multiplied by a power of 2.
exp Species the exponent for 2.
DESCRIPTION
Every nonzero number can be written uniquely as x times 2 raised to the power n, where the
mantissa (fraction), x, is in the range 0.5 | x | < 1.0, and the exponent, n, is an integer.
The ldexp() function multiplies the oating-point number value by an integral power of 2.
NOTES
This function supports both IEEE Std 754-1985 oating-point and Tandem oating-point values
in the native environment. IEEE values can include NaN and innity, 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 oating-point formats. Refer to the Guar-
dian Programmers Guide for a discussion of oating-point conversions.
RETURN VALUES
Upon successful completion, the ldexp() function returns a double value equal to value times 2
to the power exp.
For IEEE oating-point values, if the value of value is NaN, NaN is returned. If the value of
value is positive or negative innity, the value of value is returned.
If ldexp() would cause overow, positive or negative HUGE_VAL is returned (according to the
sign of value) and errno is set to [ERANGE]. If ldexp() would cause underow, a value of 0.0
(zero) is returned and errno is set to [ERANGE].
ERRORS
If any of the following conditions occurs, the ldexp() function sets errno to the corresponding
value:
[ERANGE] The value to be returned would cause an overow or underow.
RELATED INFORMATION
Functions: fp_class(3), frexp(3), isnan(3), modf(3).
414 Hewlett-Packard Company 527192-007