Calculates x
REM y
as a double precision
value.
Include
<math.h>
Prototype
double remainder(double x, double y);
Arguments
x
y
Return Value
Returns the remainder x
REM y
, being
x − ny
, where n
is the nearest integer to the
exact value of x/y
. The rounding mode is ignored.
Remarks
If the remainder is 0, its sign shall be the same as that of
x
.
Example
#include <math.h>
#include <stdio.h>
int main(void)
{
double x,y,z;
x = 7.0;
y = 3.0;
z = remainder(x, y);
printf("%f REM %f is %f\n", x, y, z);
}
Example Output
7.000000 REM 3.000000 is 1.000000