re PR libfortran/20101 (zero prints incorrectly with 1pe12.4)

libgfortran/
2005-02-27  Fran��ois-Xavier Coudert  <coudert@clipper.ens.fr>

 PR libfortran/20101
* write.c (output_float): Adding special check for value 0.0 in
PE format.

gcc/testsuite/
2005-02-27  Fran��ois-Xavier Coudert  <coudert@clipper.ens.fr>

PR libfortran/20101
* gfortran.dg/write_0_pe_format.f90: New test.

From-SVN: r95628
This commit is contained in:
Francois-Xavier Coudert 2005-02-27 20:47:12 +01:00 committed by Tobias Schlüter
parent 6e09312586
commit d8f92af2cf
4 changed files with 22 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2005-02-27 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/20101
* gfortran.dg/write_0_pe_format.f90: New test.
2005-02-27 Jakub Jelinek <jakub@redhat.com>
PR c++/20206

View File

@ -0,0 +1,9 @@
! { dg-do run }
! PR libfortran/20101
! With format "PE", 0.0 must still have "+00" as exponent
character(len=10) :: c1, c2
write(c1,"(1pe9.2)") 0.0
write(c2,"(1pe9.2)") 1.0
if (trim(adjustl(c1)) .ne. "0.00E+00") call abort()
if (trim(adjustl(c2)) .ne. "1.00E+00") call abort()
end

View File

@ -1,3 +1,9 @@
2005-02-27 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/20101
* write.c (output_float): Added special check for value 0.0 in
PE format.
2004-02-27 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* io/write.c (output_float): Fix typo in condition.

View File

@ -375,7 +375,8 @@ output_float (fnode *f, double value, int len)
case FMT_E:
case FMT_D:
i = g.scale_factor;
e -= i;
if (value != 0.0)
e -= i;
if (i < 0)
{
nbefore = 0;