This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Does remquo work?
- From: Stephen L Moshier <steve at moshier dot net>
- To: <libc-alpha at sources dot redhat dot com>
- Date: Sun, 9 Jun 2002 13:37:01 -0400 (EDT)
- Subject: Does remquo work?
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);
}
---------