fmod


Calculate the remainder

[Classification]

Mathematical library

[Syntax]

#include <math.h>

double __far fmod(double x, double y);

[Return value]

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

If x or y is a Not-a-Number (NaN) , fmod returns a Not-a-Number (NaN) and sets macro EDOM to global variable errno.

If x is ±∞ or y is zero, fmod returns a Not-a-Number (NaN) and sets macro EDOM to global variable errno.

If x is not ±∞ or y is ±∞, fmod returns x 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, the value of "x - i * y" for integer i is calculated when y is not 0. The result has the same sign as that of x, and the absolute value is smaller than that of y.