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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Invalid UP rounding with F  |Invalid UP/DOWN rounding
                   |editing                     |with F editing

--- Comment #17 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-05-03 
11:45:06 UTC ---
The first part of this for DOWN side is easy:

Index: write_float.def
===================================================================
--- write_float.def    (revision 173234)
+++ write_float.def    (working copy)
@@ -242,7 +242,13 @@ output_float (st_parameter_dt *dtp, const fnode *f
     if (!sign_bit)
       goto skip;
     rchar = '0';
-    break;
+    /* Scan for trailing zeros to see if we really need to round it.  */
+    for(i = nbefore + nafter; i < ndigits; i++)
+      {
+        if (digits[i] != '0')
+          goto do_rnd;
+      }
+    goto skip;
       case ROUND_NEAREST:
     /* Round compatible unless there is a tie. A tie is a 5 with
        all trailing zero's.  */

The last two cases with + or - .09 is more subtle.  We are incorrectly forcing
it to zero and not rounding at all.  I am still working at that part.

Reply via email to