How to use frexp() function to get floating point value N into a normalized fraction and an integral power of two in C

1 Answer

0 votes
#include <stdio.h>     
#include <math.h>
 
int main(int argc, char **argv)
{	
	int i;
    double f2 = frexp(12.34, &i);
    printf("frexp(12.34, &i) = %f * 2^%d\n", f2, i);
	
    return 0;
}

/*
run:
  
frexp(12.34, &i) = 0.771250 * 2^4

*/

 



answered Mar 18, 2016 by avibootz
...