]> gcc.gnu.org Git - gcc.git/commitdiff
PR libfortran/52608 Move the removal of initial zeros.
authorJanne Blomqvist <jb@gcc.gnu.org>
Sat, 17 Mar 2012 17:19:49 +0000 (19:19 +0200)
committerJanne Blomqvist <jb@gcc.gnu.org>
Sat, 17 Mar 2012 17:19:49 +0000 (19:19 +0200)
2012-03-17  Janne Blomqvist  <jb@gcc.gnu.org>

PR libfortran/52608
* io/write_float.def (output_float): Move removal of initial zeros
until after the scale factor has been applied.

From-SVN: r185486

libgfortran/ChangeLog
libgfortran/io/write_float.def

index d2b74accdc592cd28ad15540a31188403a8d5e04..d593134e29ee32f3bd28a4353ce23ef592fe8903 100644 (file)
@@ -1,3 +1,9 @@
+2012-03-17  Janne Blomqvist  <jb@gcc.gnu.org>
+
+       PR libfortran/52608
+       * io/write_float.def (output_float): Move removal of initial zeros
+       until after the scale factor has been applied.
+
 2012-03-16  Janne Blomqvist  <jb@gcc.gnu.org>
 
        * io/unix.h (struct stream): Rename to stream_vtable.
index 07437f0a3e145dddcb46b1a0d7d5c2d97e3350c4..6521f3c06232a0b560728531cfdf1beeeee366cc 100644 (file)
@@ -180,12 +180,6 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
       /* Make sure the decimal point is a '.'; depending on the
         locale, this might not be the case otherwise.  */
       digits[nbefore] = '.';
-      if (digits[0] == '0' && nbefore == 1)
-       {
-         digits++;
-         nbefore--;
-         ndigits--;
-       }
       if (p != 0)
        {
          if (p > 0)
@@ -229,6 +223,13 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
          nafter = d;
        }
 
+      while (digits[0] == '0' && nbefore > 0)
+       {
+         digits++;
+         nbefore--;
+         ndigits--;
+       }
+
       expchar = 0;
       /* If we need to do rounding ourselves, get rid of the dot by
         moving the fractional part.  */
This page took 0.059792 seconds and 5 git commands to generate.