Calculates x
REM y
as a single precision
value.
Include
<math.h>
Prototype
float requof(float x, float y, int * quo);
Arguments
x
y
quo
int
object that can hold the
quotientReturn Value
Returns the same remainder as remainder function, being x −
ny
, where n
is the nearest integer to the exact value of
x/y
. In the object pointed to by quo
is stored a
quotient with the same sign as x/y
, and whose magnitude is congruent
modulo 2m to the magnitude of the integral quotient of x/y
, where m is
an implementation-defined integer greater than or equal to 3. 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)
{
float x, y, z;
int q;
x = 7.0;
y = 3.0;
z = remquof(x, y, &q);
printf("%f REM %f is %f with quotient %d\n", x, y, z, q);
}
Example Output
7.000000 REM 3.000000 is 1.000000