Contents|Index|Previous|Next

fmod, fmodf
[floating-point remainder (modulo)]

SYNOPSIS

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

DESCRIPTION

The fmod and fmodf functions compute the floating-point remainder of x/y (x modulo y).

RETURNS

The fmod function returns the value x – i y, for the largest integer i such that, if y is nonzero, the result has the same sign as x and magnitude less than the magnitude of y.

fmod(x,0) returns NaN, and sets errno to EDOM.

You can modify error treatment for these functions using matherr.

COMPLIANCE

fmod is ANSI C. fmodf is an extension.