Name

ldexp

Synopsis

Multiplies a floating-point number by a power of two

#include <math.h>
doubleldexp( 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 × 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.

Get C in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.