C examples for math.h:fmod
function
<cmath> <ctgmath> <math.h>
Returns the floating-point remainder of numer/denom (rounded towards zero)
long double fmodl (long double numer, long double denom); long double fmod (long double numer, long double denom); long double fmod (long double numer, long double denom); double fmod (double numer, double denom); float fmodf (float numer , float denom); double fmod (Type1 numer , Type2 denom);
Parameter | Description |
---|---|
numer | Value of the quotient numerator. |
denom | Value of the quotient denominator. |
The remainder of dividing the arguments. If denom is zero, the function may either return zero or cause a domain error.
#include <stdio.h> #include <math.h> /* fmod */ int main ()//from www.ja va 2 s. c o m { printf ( "%f\n", fmod (5.3,2) ); printf ( "%f\n", fmod (0,2) ); printf ( "%f\n", fmod (1.5,4.2) ); return 0; }