Commit 69774e69 by Jerry DeLisle

re PR fortran/32446 (F0.n output format fails with large numbers)

2007-06-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/32446
	* io/write.c (output_float): Calculate ndigits correctly for large
	numbered formats that must pad zeros before the decimal point.

From-SVN: r125985
parent 2eae3dc7
2007-06-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/32446
* io/write.c (output_float): Calculate ndigits correctly for large
numbered formats that must pad zeros before the decimal point.
2007-06-15 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> 2007-06-15 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
PR libfortran/32345 PR libfortran/32345
......
...@@ -810,16 +810,21 @@ output_float (st_parameter_dt *dtp, const fnode *f, GFC_REAL_LARGEST value) ...@@ -810,16 +810,21 @@ output_float (st_parameter_dt *dtp, const fnode *f, GFC_REAL_LARGEST value)
if (nbefore > 0) if (nbefore > 0)
{ {
if (nbefore > ndigits) if (nbefore > ndigits)
{
i = ndigits; i = ndigits;
else
i = nbefore;
memcpy (out, digits, i); memcpy (out, digits, i);
ndigits = 0;
while (i < nbefore) while (i < nbefore)
out[i++] = '0'; out[i++] = '0';
}
else
{
i = nbefore;
memcpy (out, digits, i);
ndigits -= i;
}
digits += i; digits += i;
ndigits -= i;
out += nbefore; out += nbefore;
} }
/* Output the decimal point. */ /* Output the decimal point. */
......
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