| 
 Separates a floating-point number into integer and fraction parts 
#include <math.h>
double modf ( double x , double *intpart  );
float modff ( float x , float *intpart  );         (C99)
long double modfl ( long double x , long double *intpart  );         (C99)
 
 The modf( ) functions analyze a floating-point number into an integer and a fraction whose magnitude is less than one. The integer part is stored in the location addressed by the second argument, and fractional part is the return value. | |  | There is no type-generic macro for the modf( ) functions. | 
 | 
 
 Example
double x, integer = 0.0, fraction = 0.0;
x = 1.23;
fraction = modf( x, &integer );
printf("%10f = %f + %f\n", x , integer, fraction );
x = -1.23;
fraction = modf( x, &integer );
printf("%10f = %f + %f\n", x , integer, fraction );
 The example produces the following output: 
  1.230000 = 1.000000 + 0.230000
 -1.230000 = -1.000000 + -0.230000
 
 See Alsofrexp( ) |