### fmod -- Calculate Floating-Point Remainder

Format

>     #include <math.h>
>     double fmod(double x, double y);

Language Level: ANSI, POSIX, XPG4
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.

Return Value
fmod returns the floating-point remainder of x/y. If y is zero or if x/y causes an overflow, fmod returns 0.

Example
This example computes z as the remainder of x/y; here, x/y is -3 with a remainder of -1.

    #include <math.h>
    #include <stdio.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);

       /********************************************
          The output should be:

          fmod( -10.000000, 3.000000) = -1.000000
       ********************************************/
    }

ceil -- Find Integer >= Argument
fabs -- Calculate Floating-Point Absolute Value
floor -- Integer <= Argument
<math.h>