Does remquo work?
Stephen L Moshier
steve@moshier.net
Sun Jun 9 10:37:00 GMT 2002
Responding to an inquiry, I tried to use "remquo" in a sentence
and it doesn't seem to make sense. The standard says (I think) that
along with the remainder it returns at least 3 low-order bits of the
integer-valued quotient. So if you put, say, 4.1 in the denominator
and 7 * 4.1 in the numerator, the quotient should read 7.
Instead, it returns 2:
remquo(2.90000000e+01/4.10000000e+00) = 3.00000000e-01, quo = 2
(This is on x86, libc-2.2.5.)
Am I reading the spec wrongly, or is there a problem here?
--------
extern double remquo(double x, double y, int *quo);
main()
{
double n, d, r;
int q;
n = 29.0;
d = 4.1;
r = remquo (n, d, &q);
printf ("remquo(%.8e/%.8e) = %.8e, quo = %d\n", n, d, r, q);
}
---------
More information about the Libc-alpha
mailing list