Loading...
Select Version
&pagelevel(4)&pagelevel
Definition | #include <math.h> double modf(double n, double *i_p); These functions split a floating-point number n into its integral and fractional parts. The result is the signed fraction and the integral part, the latter being returned indirectly via a result parameter i_p. |
Return val. | Fractional part of n with sign. |
Note | Note that the argument i_p must be a pointer! |
Example | The following program resolves the number -456.789 into its integral and fractional parts. #include <math.h>
#include <stdio.h>
int main(void)
{
double x, g;
x = modf(-456.789, &g);
printf("Fraction : %g\nIntegral part : %g\n", x, g);
return 0;
}
|
See also | frexp, ldexp |