[Bug libfortran/48787] Invalid UP/DOWN rounding with F editing
thenlich at users dot sourceforge.net
gcc-bugzilla@gcc.gnu.org
Mon Jun 20 07:15:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48787
--- Comment #24 from Thomas Henlich <thenlich at users dot sourceforge.net> 2011-06-20 07:15:19 UTC ---
(In reply to comment #22)
> This is kind of bad:
>
> print "(RU,F7.0)", 7500.0 ! 8. expected 7500.
> print "(RD,F7.0)", -7500.0 ! -8. expected -7500.
I've traced the bug down to this code:
http://gcc.gnu.org/viewcvs/trunk/libgfortran/io/write_float.def?r1=173231&r2=173408&pathrev=173408
+ rchar = '0';
+ if (w > 0 && d == 0 && p == 0)
+ nbefore = 1;
+ /* Scan for trailing zeros to see if we really need to round it. */
which I don't understand. Why are we setting the number of digits before the
decimal point to 1 if the width is zero and the scale factor is zero and the
number of requested digits after the decimal point is zero?
More information about the Gcc-bugs
mailing list