fmod()
Calculates x modulo y, the remainder of x/y
Declaration:
double fmod(double x, double y);
long double fmod(long double (x), long double (y));
Remarks:
fmod and fmodl calculate x modulo y. This is defined as the remainder f,
where
x = (ay + f) for some integer a
and
0 < f < y.
Return Value:
Where x = ay + f and 0 < f < y,
fmod and fmodl return the remainder f.
Where y = 0, fmod and fmodl return 0.
Example:
#include <stdio.h>
#include <math.h>
int main(void)
{
double x = 5.0, y = 2.0;
double result;
result = fmod(x,y);
printf("The remainder of (%lf / %lf) is %lf\n", x, y, result);
return 0;
}
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment