Name

ldexp, ldexpf, ldexpl
- multiply floating-point number by integral power of 2

Library

libm.lib

Synopsis

  #include <math.h>
  double ldexp (double x, int exp);
  float ldexpf (float x, int exp);
  long double ldexpl (long double x, int exp);

Return values

These functions return the value of x times 2 raised to the power exp.

Detailed description

The ldexp, ldexpf, and ldexpl functions multiply a floating-point number by an integral power of 2.

Examples

#include <math.h>
int main( void )
{
   double x1 = 0.8, x2 = 4, y;
   y = ldexp( x1, x2 );
   printf( "ldexp(%f , %f) = %f\n", x1, x2, y );
   y = ldexpf( x1, x2 );
   printf( "ldexpf(%f , %f) = %f\n", x1, x2, y );
   y = ldexpl( x1, x2 );
   printf( "ldexpl(%f , %f) = %f\n", x1, x2, y );
}

         

Output

ldexp ( 0.8, 4 ) = 12.8
ldexpf( 0.8, 4 ) = 12.8
ldexpl( 0.8, 4 ) = 12.8

         


See also

frexp, math, modf

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top