Syntax
#include <math.h> double fmod(double x, double y);Description
fmod calculates the floating-point remainder of x/y. The absolute value of the result is always less than the absolute value of y. The result will have the same sign as x.
fmod returns the floating-point remainder of x/y. If y is zero or if x/y causes an overflow, fmod returns 0.
This example computes z as the remainder of x/y; here, x/y is -3 with a remainder of -1.
#include <math.h> int main(void) { double x,y,z; x = -10.0; y = 3.0; z = fmod(x, y); /* z = -1.0 */ printf("fmod( %lf, %lf) = %lf\n", x, y, z); return 0; /**************************************************************************** The output should be: fmod( -10.000000, 3.000000) = -1.000000 ****************************************************************************/ }Related Information