You are here : Cmath.hldexp

ldexp() - math.h

The C library function double ldexp(double x, int exponent) returns x multiplied by 2 raised to the power of exponent.


Syntax

double ldexp(double x, int exponent)


Example

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

int main ()
{
   double x, ret;
   int n;

   x = 0.65;
   n = 3;
   ret = ldexp(x ,n);
   printf("%f * 2^%d = %f\n", x, n, ret);
   
   return(0);
}


Output / Return Value

0.650000 * 2^3 = 5.200000


Limitations


Alternatives / See Also


Reference