Syntax
#include <math.h> double ldexp(double x, int exp);Description
ldexp calculates the value of x * (2exp).
ldexp returns the value of x*(2exp). If an overflow results, the function returns +HUGE_VAL for a large result or -HUGE_VAL for a small result, and sets errno to ERANGE.
This example computes y as 1.5 times 2 to the fifth power (1.5*25):
#include <math.h> int main(void) { double x,y; int p; x = 1.5; p = 5; y = ldexp(x, p); printf("%lf times 2 to the power of %d is %lf\n", x, p, y); return 0; /**************************************************************************** The output should be: 1.500000 times 2 to the power of 5 is 48.000000 ****************************************************************************/ }Related Information