Decomposes a floating-point number. Format #include <math.h> double modf (double x, double *iptr); float modff (float x, float *iptr); (Integrity servers, Alpha) long double modfl (long double x, long double *iptr); (Integrity servers, Alpha)
1 – Arguments
x An object of type double, float, or long double. iptr A pointer to an object of type double, float, or long double to match the type of x.
2 – Description
The modf functions decompose their first argument x into a positive fractional part f and an integer part i, each of which has the same sign as x. The functions return f and assign i to the object pointed to by the second argument (iptr).
3 – Return Values
x The fractional part of the argument x. NaN x is NaN; errno is set to EDOM and *iptr is set to NaN. 0 Underflow occurred; errno is set to ERANGE.