diff options
author | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-17 17:19:49 +0000 |
---|---|---|
committer | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-17 17:19:49 +0000 |
commit | 06e6fdfb0064b570ee7f86cd7ed3e948b79cb1a2 (patch) | |
tree | a1204728b1f21e1526d548bbab648a4d04b7ea53 /libgfortran/io | |
parent | 4b17ee64cb8a01dc6205f52ea7cdae9eabbc4278 (diff) | |
download | gcc-06e6fdfb0064b570ee7f86cd7ed3e948b79cb1a2.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185486 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io')
-rw-r--r-- | libgfortran/io/write_float.def | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def index 07437f0a3e1..6521f3c0623 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. */ |