MODF(3)

NAME
modf, modff - split fractional and integer parts

SYNOPSIS

#include <math.h>

double modf(double val, double *ipart);

float modff(float val, 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 *ipart. No rounding whatsoever is done; the sum of the integer and fractional parts is guaranteed to be exactly equal to val. That is, if realpart = modf(val, &intpart); then `realpart+intpart' is the same as 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.