public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/14686] New: remainder sometimes fails to raise INVALID exception with -lieee
@ 2012-10-08 22:48 jsm28 at gcc dot gnu.org
2012-10-08 22:50 ` [Bug math/14686] " jsm28 at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-10-08 22:48 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=14686
Bug #: 14686
Summary: remainder sometimes fails to raise INVALID exception
with -lieee
Product: glibc
Version: 2.16
Status: NEW
Severity: normal
Priority: P2
Component: math
AssignedTo: unassigned@sourceware.org
ReportedBy: jsm28@gcc.gnu.org
Classification: Unclassified
The following test, on x86_64, with -fno-builtin -lieee, shows the remainder
function failing to raise the INVALID exception.
#include <errno.h>
#include <fenv.h>
#include <math.h>
#include <stdio.h>
#include <float.h>
#include <complex.h>
volatile double a = INFINITY, b = 2.0;
int
main (void)
{
feclearexcept (FE_ALL_EXCEPT);
errno = 0;
volatile double r = remainder (a, b);
if (fetestexcept (FE_DIVBYZERO))
printf ("DIVBYZERO ");
if (fetestexcept (FE_INEXACT))
printf ("INEXACT ");
if (fetestexcept (FE_INVALID))
printf ("INVALID ");
if (fetestexcept (FE_OVERFLOW))
printf ("OVERFLOW ");
if (fetestexcept (FE_UNDERFLOW))
printf ("UNDERFLOW ");
printf ("%.18g %m\n", r);
return 0;
}
The problem is the code in dbl-64/e_remainder.c
if (kx == 0x7ff00000 && u.i[LOW_HALF] == 0 && y == 1.0)
return x / x;
which acts only when y == 1.0, but should act for any non-NaN value of y
(finite or infinite). Any remainder (non-NaN, 0) or remainder (Inf, non-NaN)
should return NaN and raise the INVALID exception. In the absence of -lieee,
this issue is masked by the w_remainder.c wrapper.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug math/14686] remainder sometimes fails to raise INVALID exception with -lieee
2012-10-08 22:48 [Bug math/14686] New: remainder sometimes fails to raise INVALID exception with -lieee jsm28 at gcc dot gnu.org
@ 2012-10-08 22:50 ` jsm28 at gcc dot gnu.org
2013-04-05 21:02 ` tschwinge at sourceware dot org
2014-06-17 4:06 ` fweimer at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-10-08 22:50 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=14686
--- Comment #1 from Joseph Myers <jsm28 at gcc dot gnu.org> 2012-10-08 22:49:59 UTC ---
The same issue applies for remainder (1.0, 0.0), which likewise needs logic to
raise the INVALID exception rather than just quietly returning a NaN.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug math/14686] remainder sometimes fails to raise INVALID exception with -lieee
2012-10-08 22:48 [Bug math/14686] New: remainder sometimes fails to raise INVALID exception with -lieee jsm28 at gcc dot gnu.org
2012-10-08 22:50 ` [Bug math/14686] " jsm28 at gcc dot gnu.org
@ 2013-04-05 21:02 ` tschwinge at sourceware dot org
2014-06-17 4:06 ` fweimer at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: tschwinge at sourceware dot org @ 2013-04-05 21:02 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=14686
Thomas Schwinge <tschwinge at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |tschwinge at sourceware dot
| |org
Resolution| |FIXED
AssignedTo|unassigned at sourceware |tschwinge at sourceware dot
|dot org |org
Target Milestone|--- |2.18
--- Comment #2 from Thomas Schwinge <tschwinge at sourceware dot org> 2013-04-05 21:02:45 UTC ---
commit a1cbf437a53b24f2ff1f6af42028b607f6aa279d
Author: Thomas Schwinge <thomas@codesourcery.com>
Date: Thu Apr 4 17:35:12 2013 +0200
[BZ #14686, #15336] Fix standard compliance. Don't use hard-coded qNaN
values.
Additional tests in
<http://news.gmane.org/find-root.php?message_id=%3C87r4iqxq1n.fsf%40schwinge.name%3E>
not yet committed.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug math/14686] remainder sometimes fails to raise INVALID exception with -lieee
2012-10-08 22:48 [Bug math/14686] New: remainder sometimes fails to raise INVALID exception with -lieee jsm28 at gcc dot gnu.org
2012-10-08 22:50 ` [Bug math/14686] " jsm28 at gcc dot gnu.org
2013-04-05 21:02 ` tschwinge at sourceware dot org
@ 2014-06-17 4:06 ` fweimer at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2014-06-17 4:06 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=14686
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Flags| |security-
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-17 4:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-08 22:48 [Bug math/14686] New: remainder sometimes fails to raise INVALID exception with -lieee jsm28 at gcc dot gnu.org
2012-10-08 22:50 ` [Bug math/14686] " jsm28 at gcc dot gnu.org
2013-04-05 21:02 ` tschwinge at sourceware dot org
2014-06-17 4:06 ` fweimer at redhat dot com
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).