remainderf Function

Calculates x REM y as a single precision value.

Include

<math.h>

Prototype

float remainderf(float x, float y);

Arguments

 x a single precision floating-point value y a single precision floating-point value

Return Value

Returns the remainder x REM y, being x − ny, where n is the nearest integer to the exact value of x/y when y is not 0. The rounding mode is ignored. If the remainder is 0, its sign shall be the same as that of x.

Example

See the notes at the beginning of this chapter or section for information on using printf() or scanf() (and other functions reading and writing the stdin or stdout streams) in the example code.

#include <math.h>
#include <stdio.h>

int main(void)
{
float x,y,z;

x = 7.0;
y = 3.0;
z = remainderf(x, y);
printf("%f REM %f is %f\n", x, y, z);
}

Example Output

7.000000 REM 3.000000 is 1.000000