HP-UX Reference (11i v3 07/02) - 3 Library Functions A-M (vol 6)

l
ldexp(3M) ldexp(3M)
NAME
ldexp(), ldexpf(), ldexpl( ), ldexpw( ), ldexpq() - scale exponent of a floating-point number
SYNOPSIS
#include <math.h>
double ldexp(double x, int exp);
HP Integrity Server Only
float ldexpf(float x, int exp);
long double ldexpl(long double y, int exp);
extended ldexpw(extended x, int exp);
quad ldexpq(quad x, int exp);
DESCRIPTION
The ldexp() function computes the quantity x *2
exp
.
ldexp() computes the same value as scalbn().
Integrity Server Only
ldexpf() is a float version of ldexp(); it takes a float first argument and returns a
float
result.
ldexpl() is a long double version of ldexp(); it takes a long double first argument and
returns a
long double result.
ldexpw() is an extended version of ldexp(); it takes a extended first argument and returns an
extended result.
ldexpq() is equivalent to ldexpl() on HP-UX systems.
USAGE
To use (for Integrity servers) ldexpf(), compile either with the default -Ae option or with the
-Aa
option.
To use (for Integrity servers) ldexpl(), ldexpw(),orldexpq(), compile either with the default
-Ae
option or with the -Aa and -D_HPUX_SOURCE
options.
To use (for Integrity servers)
ldexpw() or ldexpq(), compile also with the -fpwidetypes
option.
To use any of these functions, make sure your program includes
<math.h>, and link in the math library
by specifying -lm on the compiler or linker command line.
For more information, see the HP-UX floating-point guide for HP Integrity servers at the following site:
http://www.hp.com/go/fp
.
RETURN VALUE
Upon successful completion, the
ldexp() function returns x *2
exp
.
If x is ±INFINITY, zero, or a NaN,
ldexp() returns x.
ldexp() returns a properly signed infinity (equal to ±HUGE_VAL) in lieu of a value whose magnitude is
too large, and raises the overflow and inexact exceptions.
ldexp() 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.
ERRORS
If the correct value would overflow, ldexp() sets errno to [ERANGE].
Integrity Server Only
HP-UX libm functions on Integrity servers do not set errno by default. For errno setting, compile
with the +Olibmerrno option.
SEE ALSO
frexp(3M), ilogb(3M), logb(3M), scalb(3M), scalbln(3M), scalbn(3M), math(5).
HP-UX 11i Version 3: February 2007 1 Hewlett-Packard Company 715