MODF 3CW "09 March 2006" "mathcw-1.00"

Table of contents


NAME

modff, modf, modfl, modfw, modfq, modfll, modfdf, modfd, modfdl, modfdll - split floating-point number into whole number and fraction

SYNOPSIS

cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ]

#include <mathcw.h>

extern float modff (float x, /*@out@*/ float *iptr);

extern double modf (double x, /*@out@*/ double *iptr);

extern long double modfl (long double x, /*@out@*/ long double *iptr);

extern __float80 modfw (__float80 x, /*@out@*/ __float80 *iptr);

extern __float128 modfq (__float128 x, /*@out@*/ __float128 *iptr);

extern long_long_double modfll (long_long_double x, /*@out@*/ long_long_double *iptr);

extern decimal_float modfdf (decimal_float x, /*@out@*/ decimal_float *iptr);

extern decimal_double modfd (decimal_double x, /*@out@*/ decimal_double *iptr);

extern decimal_long_double modfdl (decimal_long_double x, /*@out@*/ decimal_long_double *iptr);

extern decimal_long_long_double modfdll (decimal_long_long_double x, /*@out@*/ decimal_long_long_double *iptr);

NB: Functions with prototypes containing underscores in type names may be available only with certain extended compilers.


DESCRIPTION

Split the argument into integral and fractional parts, each with the same sign and type as the argument.

The splitting is always exact, so that the original number can be recovered by (exact) addition of the integral and fractional parts.


RETURN VALUES

The integral part is stored in the object pointed to by iptr, unless the pointer is NULL, in which case the store is suppressed. The signed fractional part is returned as the function value.

If the argument is +Infinity or -Infinity, the fractional part returned is a zero of the same sign as the argument, and any integral part that is stored is the argument.

If the argument is a NaN, both the integral part (if stored) and the returned fractional part are quiet NaNs.


ERRORS

None.

SEE ALSO

ceil(3CW), floor(3CW), fmod(3CW), llrint(3CW), llround(3CW), lrint(3CW), lround(3CW), nearbyint(3CW), rint(3CW), round(3CW), trunc(3CW).