On Sun, Apr 24, 2011 at 23:32, Jerry DeLisle <jvdeli...@frontier.com> wrote: > The final solution to 48602 I want to do as a second phase to this. The > second phase will attempt to avoid floating point comparisons which are > sensitive to optimizations and or printf behavior.
Sounds like a good idea. I think it should be possible to modify the algorithm to just count decimal places with integer arithmetic. > Regression tested on x86-64. I do have some concern that the test cases > modified may have issues on other platforms because we have increased the > default precision on some reals. If this happens we should be able to > adjust test cases by not using default formatting. Or xfail the testcases in question on those targets; I think it makes sense to assume IEEE 754 hardware and a snprintf() capable of correct rounding as the baseline. Now, for one of the testcase changes: --- gcc/testsuite/gfortran.dg/char4_iunit_1.f03 (revision 172909) +++ gcc/testsuite/gfortran.dg/char4_iunit_1.f03 (working copy) @@ -24,11 +24,11 @@ program char4_iunit_1 write(string, *) .true., .false. , .true. if (string .ne. 4_" T F T ") call abort write(string, *) 1.2345e-06, 4.2846e+10_8 - if (string .ne. 4_" 1.23450002E-06 42846000000.000000 ") call abort + if (string .ne. 4_" 1.234500019E-06 42846000000.000000 ") call abort This looks wrong. For correctly rounded REAL(4) output, we need 9 significant digits, but here we print 10. -- Janne Blomqvist