Export (0) Print
Expand All

ldexp

Visual Studio 6.0

Computes a real number from the mantissa and exponent.

double ldexp( double x, int exp );

Routine Required Header Compatibility
ldexp <math.h> ANSI, Win 95, Win NT

For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version

Return Value

The ldexp function returns the value of x * 2exp if successful. On overflow (depending on the sign of x), ldexp returns +/– HUGE_VAL; the errno variable is set to ERANGE.

Parameters

x

Floating-point value

exp

Integer exponent

Example

/* LDEXP.C */

#include <math.h>
#include <stdio.h>

void main( void )
{
   double x = 4.0, y;
   int p = 3;

   y = ldexp( x, p );
   printf( "%2.1f times two to the power of %d is %2.1f\n", x, p, y );
}

Output

4.0 times two to the power of 3 is 32.0

Floating-Point Support

See Also   frexp, modf

Show:
© 2015 Microsoft