REMAINDER(3)

NAME
remainder, remainderf, remquo, remquof - minimal residue functions

LIBRARY
libm

SYNOPSIS
#include <math.h>
double
remainder(double x, double y);
float
remainderf(float x, float y);
double
remquo(double x, double y, int *quo);
float
remquof(float x, float y, int *quo);

DESCRIPTION
remainder(), remainderf(), remquo(), and remquof() return the remainder r := x - n*y where n is the integer nearest the exact value of x/y; moreover if \*(Ban - x/y\*(Ba = 1/2 then n is even. Consequently the remainder is computed exactly and \*(Bar\*(Ba \*(Bay\*(Ba/2. But attempting to take the remainder when y is 0 or x is is an invalid operation that produces a .

The remquo() and remquof() functions also store the last k bits of n in the location pointed to by quo, provided that n exists. The number of bits k is platform-specific, but is guaranteed to be at least 3.

SEE ALSO
fmod(3), ieee(3), math(3)

STANDARDS
The remainder(), remainderf(), remquo(), and remquof() routines conform to isoC-99. The remainder is as defined in ieee754.

HISTORY
The remainder() and remainderf() functions appeared in 4.3BSD and FreeBSD 2.0, respectively. The remquo() and remquof() functions were added in FreeBSD 6.0.