Commit 789ebabf by Janne Blomqvist

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
parent 4dc86aa8
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> 2012-03-16 Janne Blomqvist <jb@gcc.gnu.org>
* io/unix.h (struct stream): Rename to stream_vtable. * io/unix.h (struct stream): Rename to stream_vtable.
......
...@@ -180,12 +180,6 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, ...@@ -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 /* Make sure the decimal point is a '.'; depending on the
locale, this might not be the case otherwise. */ locale, this might not be the case otherwise. */
digits[nbefore] = '.'; digits[nbefore] = '.';
if (digits[0] == '0' && nbefore == 1)
{
digits++;
nbefore--;
ndigits--;
}
if (p != 0) if (p != 0)
{ {
if (p > 0) if (p > 0)
...@@ -229,6 +223,13 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, ...@@ -229,6 +223,13 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
nafter = d; nafter = d;
} }
while (digits[0] == '0' && nbefore > 0)
{
digits++;
nbefore--;
ndigits--;
}
expchar = 0; expchar = 0;
/* If we need to do rounding ourselves, get rid of the dot by /* If we need to do rounding ourselves, get rid of the dot by
moving the fractional part. */ moving the fractional part. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment