aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2012-03-17 19:19:49 +0200
committerJanne Blomqvist <jb@gcc.gnu.org>2012-03-17 19:19:49 +0200
commit789ebabf1dcee46e046767c6501d464bc588a571 (patch)
treea1204728b1f21e1526d548bbab648a4d04b7ea53
parent4dc86aa8aa24c359ebba7ac25530ce5af520a0c3 (diff)
downloadgcc-789ebabf1dcee46e046767c6501d464bc588a571.zip
gcc-789ebabf1dcee46e046767c6501d464bc588a571.tar.gz
gcc-789ebabf1dcee46e046767c6501d464bc588a571.tar.bz2
PR libfortran/52608 Move the removal of initial zeros.
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
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/write_float.def13
2 files changed, 13 insertions, 6 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index d2b74ac..d593134 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -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.
diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def
index 07437f0..6521f3c 100644
--- a/libgfortran/io/write_float.def
+++ b/libgfortran/io/write_float.def
@@ -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. */