fmod


Remainder function

[Classification]

Mathematical library

[Syntax]

#include <math.h>

double fmod(double x, double y);

[Return value]

Returns a floating-point value that is the remainder resulting from dividing x by y.

If y is +∞, fmod returns x.

If x is +∞ or y is zero, fmod returns a NaN and sets macro EDOM to global variable errno.

[Description]

This function calculates a floating-point value that is the remainder resulting from dividing x by y. In other words, it calculates the value "x - i * y" for the maximum integer i that has a sign the same as x and is less than y, if y is not zero.