[Bug libfortran/48602] New: Invalid F conversion of G descriptor for values close to powers of 10

thenlich at users dot sourceforge.net gcc-bugzilla@gcc.gnu.org
Thu Apr 14 08:02:00 GMT 2011


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

           Summary: Invalid F conversion of G descriptor for values close
                    to powers of 10
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: thenlich@users.sourceforge.net


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

Libfortran does not correctly implement the G conversion method from Fortran
2008 10.7.5.2.2(4) for the UP and DOWN I/O rounding modes.

The number of significant digits d is incorrect in some cases where the
magnitude of the internal value is close to a power of 10.

For instance

print "(RU,G15.2)", .991d0
prints 1.00 but the expected result is 1.0 because 1 - r * 10**-2 < .991 with r
= 1 because of UP rounding mode

print "(RD,G15,2)", .996d0
prints 0.9 but expected is 0.99 because .996 < 1 - r * 10**-2 with r = 0
because of DOWN rounding mode



More information about the Gcc-bugs mailing list