Synopsis
#include <math.h>
float fmod(float x, float y);
Description

fmod computes the floating-point remainder of x divided by y. fmod returns the value x - ny, for some integer n such that, if y is nonzero, the result has the same sign as x and magnitude less than the magnitude of y.

Fast math library behavior

If y = 0, fmodf returns zero and errno is set to EDOM.

IEC 60559 math library behavior

fmodf(±0, y) is ±0 for y not zero.
fmodf(∞, y) is NaN and raises the “invalid” floating-point exception.
fmodf(x, 0) is NaN and raises the “invalid” floating-point exception.
fmodf(x, ±∞) is x for x not infinite.

Portability

fmodf conforms to ISO/IEC 9899:1990 (C90) and ISO/IEC 9899:1999 (C99).