Table of Contents

frexp

    double frexp(double);

Mantissa m. in *n is the exponent.

cpp Sourcecode Example

#include <iostream> /* including standard library */
#include <cmath> /* including math library */
 
using namespace std;
int main ( void ) 
{
  double x;
  int n;
 
  x = 42.0;
 
  //cout.setf(ios::fixed, ios::floatfield);
  cout.precision(8);
 
  cout << frexp (x, &n) << " * 2^" << n << " = " << x << endl;
  return 0;
}

output

   0.65625 * 2^0 = 42