public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/48047] New: Incorrect output rounding of double precision numbers
@ 2011-03-09 15:46 thenlich at users dot sourceforge.net
  2011-03-09 18:01 ` [Bug libfortran/48047] " kargl at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: thenlich at users dot sourceforge.net @ 2011-03-09 15:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48047

           Summary: Incorrect output rounding of double precision numbers
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: thenlich@users.sourceforge.net


Created attachment 23603
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23603
Test case

The Fortran library does not round real(8) numbers correctly on output if 39
decimal digits are requested and real(16) is supported. This violates IEEE Std
754-2008 which demands that the minimum of supported significant digits for
correct rounding of all supported binary formats (H) is at least H=39 if the
binary128 format is supported.

Thus, GCC misses this requirement by 1 digit.

The attached program fails because the exact value, as given by
quadmath_snprintf(..., (__float128)0.14285714285714285) is
0.142857142857142849212692681248881854116916656494...

IEEE Std 754-2008 says:
===
5.12.2 External decimal character sequences representing finite numbers   
...
For the purposes of discussing the limits on correctly rounded conversion,
define the following quantities:
...
- for binary128, Pmin (binary128) = 36
...
- M = max(Pmin(bf)) for all supported binary formats bf
...

There might be an implementation-defined limit on the number of significant
digits that can be converted with correct rounding to and from supported binary
formats. That limit, H, shall be such that H >= M + 3 and it should be that H
is unbounded.

For all supported binary formats the conversion operations shall support
correctly rounded conversions to or from external character sequences for all
significant digit counts from 1 through H (that is, for all
expressible counts if H is unbounded).
...
===


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-05-02 11:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-09 15:46 [Bug libfortran/48047] New: Incorrect output rounding of double precision numbers thenlich at users dot sourceforge.net
2011-03-09 18:01 ` [Bug libfortran/48047] " kargl at gcc dot gnu.org
2011-03-09 19:06 ` burnus at gcc dot gnu.org
2011-03-09 20:07 ` jakub at gcc dot gnu.org
2011-03-10  9:37 ` thenlich at users dot sourceforge.net
2011-03-10  9:39 ` thenlich at users dot sourceforge.net
2011-03-10  9:41 ` thenlich at users dot sourceforge.net
2011-03-11  0:59 ` jvdelisle at gcc dot gnu.org
2011-03-11 18:49 ` jvdelisle at gcc dot gnu.org
2011-03-11 19:12 ` jakub at gcc dot gnu.org
2011-03-12  0:50 ` jvdelisle at gcc dot gnu.org
2011-05-02 11:32 ` thenlich at users dot sourceforge.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).