Previous Page
Next Page

ldexp

Multiplies a floating-point number by a power of two

#include <math.h>
double ldexp ( double mantissa , int exponent  );
float ldexpf ( float mantissa , int exponent  );         (C99)
long double ldexpl ( long double mantissa , int exponent  );         (C99)

The ldexp( ) functions calculate a floating-point number from separate mantissa and exponent values. The exponent parameter is an integer exponent to base 2.

The function returns the value mantissa x 2exponent. If the result is not representable in the function's type, a range error may occur.

Example

See the example for frexp( ) in this chapter.

See Also

The function frexp( ), which performs the reverse operation, analyzing a floating-point number into a mantissa and an exponent to base 2.


Previous Page
Next Page