Loads exponent of a floating-point number.
#include <math.h> float ldexpf (x, exp) float x; int exp; long double ldexpl (x, exp) long double x; int exp; double ldexp (x, exp) double x; int exp;
The ldexpf, ldexpl, and ldexp subroutines compute the quantity x * 2exp.
An application wishing to check for error situations should set the errno global variable to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these functions. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.
x | Specifies the value to be computed. |
exp | Specifies the exponent of 2. |
Upon successful completion, the ldexpf, ldexpl, and ldexp subroutines return x multiplied by 2, raised to the power exp.
If the ldexpf, ldexpl, or ldexp subroutines would cause overflow, a range error occurs and the ldexpf, ldexpl, and ldexp subroutines return ±HUGE_VALF, ±HUGE_VALL, and ±HUGE_VAL (according to the sign of x), respectively.
If the correct value would cause underflow, and is not representable, a range error may occur, and 0.0 is returned.
If x is NaN, a NaN is returned.
If x is ±0 or Inf, x is returned.
If exp is 0, x is returned.
If the correct value would cause underflow, and is representable, a range error may occur and the correct value is returned.
If the result of the ldexp or ldexpl subroutine overflows, then +/- HUGE_VAL is returned, and the global variable errno is set to ERANGE.
If the result of the ldexp or ldexpl subroutine underflows, 0 is returned, and the errno global variable is set to a ERANGE value.
feclearexcept Subroutine, fetestexcept Subroutine, and class, _class, finite, isnan, or unordered Subroutines
math.h in AIX 5L Version 5.2 Files Reference.