write.c (output_float): special check when writing 0.0 with EN and ES formats.

* write.c (output_float): special check when writing 0.0 with
          EN and ES formats.

        * pr20480.f90: New test.

From-SVN: r96566
This commit is contained in:
Francois-Xavier Coudert 2005-03-16 19:09:03 +01:00 committed by François-Xavier Coudert
parent e4d5432a73
commit dcdeec06a0
4 changed files with 24 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2005-03-16 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/20480
* pr20480.f90: New test.
2005-03-16 Richard Henderson <rth@redhat.com>
PR middle-end/15700

View File

@ -0,0 +1,9 @@
! { dg-do run }
! PR libfortran/20480
! fxcoudert@gcc.gnu.org
character(len=80) c
write (c,'(ES12.3)') 0.0
if (trim(adjustl(c)) .ne. '0.000E+00') call abort ()
write (c,'(EN12.3)') 0.0
if (trim(adjustl(c)) .ne. '0.000E+00') call abort ()
end

View File

@ -1,3 +1,9 @@
2005-03-16 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/20480
* write.c (output_float): special check when writing 0.0 with
EN and ES formats.
2005-03-11 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/20124

View File

@ -411,7 +411,8 @@ output_float (fnode *f, double value, int len)
case FMT_EN:
/* The exponent must be a multiple of three, with 1-3 digits before
the decimal point. */
e--;
if (value != 0.0)
e--;
if (e >= 0)
nbefore = e % 3;
else
@ -428,7 +429,8 @@ output_float (fnode *f, double value, int len)
break;
case FMT_ES:
e--;
if (value != 0.0)
e--;
nbefore = 1;
nzero = 0;
nafter = d;