public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/14551] New: strtold overflow handling for IBM long double
@ 2012-09-06 15:57 jsm28 at gcc dot gnu.org
2014-02-07 2:43 ` [Bug libc/14551] [ldbl-128ibm] " 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-09-06 15:57 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=14551
Bug #: 14551
Summary: strtold overflow handling for IBM long double
Product: glibc
Version: 2.16
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: unassigned@sourceware.org
ReportedBy: jsm28@gcc.gnu.org
CC: drepper.fsp@gmail.com
Classification: Unclassified
Host: powerpc*-linux*
The core strtold code treats IBM long double as an IEEE type with a fixed
mantissa precision of 106 bits. It's then
sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c that actually encodes the result in long
double.
Where the value overflows for IBM long double (because of the requirement that
the two parts, added together in round-to-nearest mode, equal the top part of
the long double) but not for the 106-bit IEEE type, the mpn2ldbl code generates
an invalid long double value. It should generate the appropriate overflowed
result (typically an infinity, but properly depending on rounding mode), set
errno to ERANGE and raise the overflow exception. Testcase:
#include <stdio.h>
#include <stdlib.h>
int
main (void)
{
union { long double ld; double d[2]; } x;
x.ld = strtold ("0x1.fffffffffffff8p+1023", NULL);
printf ("%a %a\n", x.d[0], x.d[1]);
return 0;
}
This prints:
inf -0x1p+970
That's not a valid infinity (and so causes problems such as not comparing equal
to a proper infinity); the least significant part of an infinity must be +0 or
-0 as per GCC's libgcc/config/rs6000/ibm-ldouble-format.
--
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
end of thread, other threads:[~2015-08-27 22:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-06 15:57 [Bug libc/14551] New: strtold overflow handling for IBM long double jsm28 at gcc dot gnu.org
2014-02-07 2:43 ` [Bug libc/14551] [ldbl-128ibm] " jsm28 at gcc dot gnu.org
2014-06-17 4:45 ` fweimer at redhat dot com
2015-08-27 22:10 ` [Bug math/14551] " jsm28 at gcc dot gnu.org
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).