Next: fpclassify, Previous: fmin, Up: Math
fmod
, fmodf
—floating-point remainder (modulo)#include <math.h> double fmod(double x, double y); float fmodf(float x, float y);
Description
The fmod
and fmodf
functions compute the floating-point
remainder of x/y (x modulo y).
Returns
fmod
function returns the value
x-i*y,
for the largest integer i such that, if y is nonzero, the
result has the same sign as x and magnitude less than the
magnitude of y.
fmod(
x,0)
returns NaN, and sets errno
to EDOM
.
You can modify error treatment for these functions using matherr
.
Portability
fmod
is ANSI C. fmodf
is an extension.