C/math.h/frexp

Материал из C\C++ эксперт
Перейти к: навигация, поиск

frexp: decomposes the num into a mantissa in the range 0.5 to less than 1, and an integer exponent such that num = mantissa * 2^exp

    
//Declaration: float frexpf(float num, int *exp); 
               double frexp(double num, int *exp); 
               long double frexpl(long double num, int *exp);  
//Return:      The mantissa is returned by the function, and the exponent is stored at the variable pointed to by exp. 
    
  
  #include <math.h>
  #include <stdio.h>
  int main(void)
  {
     int e;
     double f;
     f = frexp(10.0, &e);
     printf("%f %d", f, e);
 
  }
         
/*
0.625000 4
*/