http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48906
Summary: Wrong rounding results with -m32 Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran AssignedTo: jvdeli...@gcc.gnu.org ReportedBy: jvdeli...@gcc.gnu.org This PR is to carry forward the remaining issue identified in PR48602 comment #37 Here is a test case showing the problem. print "(ru,g15.2)", .099d0 ! > 0.10E+00 expected 0.10 print "(rc,g15.1)", .095d0 ! > 0.1E+00 expected 0.1 print "(rc,g15.2)", .0995d0 ! > 0.10E+00 expected 0.10 print "(ru,g15.3)", .0999d0 ! > 0.100E+00 expected 0.100 end $ gfc bug.f03 $ ./a.out 0.10 0.1 0.10 0.100 $ gfc -O1 bug.f03 $ ./a.out 0.10 0.1 0.10 0.100 $ gfc -m32 -O1 bug.f03 $ ./a.out 0.10E+00 0.1E+00 0.10E+00 0.100E+00 $ gfc -m32 bug.f03 $ ./a.out 0.10E+00 0.1E+00 0.10E+00 0.100E+00 The problem is rooted in excess precision and that we use sensitive floating point operations to determine the formatting parameters. I am seeking a solution that will avoid using floating point to do this.