[Bug libfortran/48511] New: Implement Steele-White algorithm for numeric output

thenlich at users dot sourceforge.net gcc-bugzilla@gcc.gnu.org
Fri Apr 8 08:07:00 GMT 2011


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

           Summary: Implement Steele-White algorithm for numeric output
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: thenlich@users.sourceforge.net


Created attachment 23923
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23923
Demonstration of correct rounding a la Steele-White

In their paper "How to Print Floating-Point Numbers Accurately" [1], Steele &
White describe an algorithm which for a internal binary floating-point number
outputs the shortest external decimal representation of that number which
converts back to the original number.

This should be implemented in libfortran, possibly as a separate I/O rounding
mode.

It would eliminate the problem of getting "odd" numbers, like 0.177699999999...
when the value 0.1977 is much shorter and represents the same exact binary
value.

Basically, their algorithm does the same as the attached program demonstrates,
only more efficiently.

[1] http://grouper.ieee.org/groups/754/email/pdfq3pavhBfih.pdf



More information about the Gcc-bugs mailing list