Mega Code Archive

 
Categories / C / Math
 

Get mantissa and exponent of floating-point value

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