`modf`

, `modff`

---split fractional and integer parts#include <math.h> double modf(doubleval, double *ipart); float modff(floatval, float *ipart);

**Description**

`modf`

splits the double `val` apart into an integer part
and a fractional part, returning the fractional part and
storing the integer part in `*`

. No rounding
whatsoever is done; the sum of the integer and fractional
parts is guaranteed to be exactly equal to `ipart``val`. That
is, if . `realpart` = modf(`val`, &`intpart`); then
`

' is the same as `realpart`+`intpart``val`.
`modff`

is identical, save that it takes and returns
`float`

rather than `double`

values.

**Returns**

The fractional part is returned. Each result has the same
sign as the supplied argument `val`.

**Portability**

`modf`

is ANSI C. `modff`

is an extension.

Go to the first, previous, next, last section, table of contents.