modf


Divide floating-point number into integer and decimal

[Classification]

Mathematical library

[Syntax]

#include <math.h>

double modf(double val, double *ipart);

[Return value]

Returns a decimal part. The sign of the result is the same as the sign of val.

[Description]

This function divides val of double type into integer and decimal parts, and stores the integer part in *ipart. Rounding is not performed. It is guaranteed that the sum of the integer part and decimal part accurately coincides with val. For example, where realpart = modff (val, &intpart), "realpart + intpartt" coincides with val.