I read here that remquo
should return:
If successful, returns the floating-point remainder of the division
x/y
as defined in std::remainder, and a value whose sign is the sign ofx/y
and whose magnitude is congruent modulo 2n to the magnitude of the integral quotient ofx/y
, where n is an implementation-defined integer greater than or equal to 3.
Now clearly I've misunderstood all that techno-speak cause I thought that I was going to get back the fractional result of the division. Instead this operation:
int quot;
const float rem = remquo(7.0F, 4.0F, ");
Sets quot
to 2 and rem
to -1.0! I can see how that is valid because 4.0 * 2 = 8.0 and 7.0 - 8.0 = -1.0. But why are we using a quot
that will result in a negative rem
? Shouldn't I be getting back a quot
of 1 and a rem
of 3.0?