Mega Code Archive

 
Categories / C / Code Snippets
 

Get floating-point value from mantissa and exponent how to use ldexp

#include <stdio.h> #include <math.h> int main () { double p, result; int j; p = 0.88; j = 9; result = ldexp (p, j); printf ("%f * 2^%d = %f\n", p, j, result); return 0; }