> ~ Online tutorial

modf

 modf splits double into integer and fraction parts
 modfl splits long double into integer and fraction parts

 Declaration:

double modf(double x, double *ipart);
 long double modfl(long double (x), long double *(ipart));

 Remarks:

 modf breaks the double x into two parts: the integer and the fraction. It
stores the integer in ipart and returns the fraction.

 modfl is the long double version of modf.

 Return Value:


Both functions return the fractional part of x.

 Example:

 #include <math.h>
 #include <stdio.h>

 int main(void)
 {
    double fraction, integer;
    double number = 100000.567;

    fraction = modf(number, &integer);
    printf("The whole and fractional parts of %lf are %lf and %lf\n",
           number, integer, fraction);
    return 0;
 }

Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: