Technical Support
On-Line Manuals
CARM User's Guide
Discontinued
#include <math.h>
double fmod (
double x, /* value to calculate modulo for */
double y); /* integer portion of modulo */
The fmod function returns a value f such that
f has the same sign as x, the absolute
value of f is less than the absolute value of y, and there exists an integer k such that:
k * y + f =
x
If the quotient x / y cannot
be represented, the result is undefined.
The fmod function returns the floating-point remainder of
x / y.
#include <math.h>
#include <stdio.h> /* for printf */
void tst_fmod (void) {
float f;
f = fmod (15.0, 4.0);
printf ("fmod (15.0, 4.0) = %f.