public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/27986] New: remquo does not always set quo to a value with a negative sign when x/y has a negative sign
@ 2021-06-16 12:17 vincent-srcware at vinc17 dot net
2021-06-16 12:18 ` [Bug math/27986] " vincent-srcware at vinc17 dot net
0 siblings, 1 reply; 2+ messages in thread
From: vincent-srcware at vinc17 dot net @ 2021-06-16 12:17 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27986
Bug ID: 27986
Summary: remquo does not always set quo to a value with a
negative sign when x/y has a negative sign
Product: glibc
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: math
Assignee: unassigned at sourceware dot org
Reporter: vincent-srcware at vinc17 dot net
Target Milestone: ---
The ISO C standard says about remquo: "In the object pointed to by quo they
store a value whose sign is the sign of x/y and whose magnitude is congruent
modulo 2^n to the magnitude of the integral quotient of x/y, where n is an
implementation-defined integer greater than or equal to 3."
But when x/y has a negative sign, in some cases (at least when the mathematical
quotient is 0?), quo is not set to a value with a negative sign.
Testcase:
#include <stdio.h>
#include <math.h>
int main (void)
{
int quo = -1;
volatile double x = -1.0, y = 3.0;
remquo (x, y, &quo);
printf ("quo = %d\n", quo);
return 0;
}
Here, x/y < 0, so that one would expect quo < 0 (as in two's complement, 0 has
a positive sign). But on my x86_64 Debian machine with GNU libc 2.31, I get:
quo = 0
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug math/27986] remquo does not always set quo to a value with a negative sign when x/y has a negative sign
2021-06-16 12:17 [Bug math/27986] New: remquo does not always set quo to a value with a negative sign when x/y has a negative sign vincent-srcware at vinc17 dot net
@ 2021-06-16 12:18 ` vincent-srcware at vinc17 dot net
0 siblings, 0 replies; 2+ messages in thread
From: vincent-srcware at vinc17 dot net @ 2021-06-16 12:18 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27986
Vincent Lefèvre <vincent-srcware at vinc17 dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|unspecified |2.31
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-16 12:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16 12:17 [Bug math/27986] New: remquo does not always set quo to a value with a negative sign when x/y has a negative sign vincent-srcware at vinc17 dot net
2021-06-16 12:18 ` [Bug math/27986] " vincent-srcware at vinc17 dot net
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).