diff options
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/edit_real_1.f90 | 4 | ||||
-rw-r--r-- | libgfortran/io/write.c | 7 |
4 files changed, 15 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b5ebb4f..fe5e531 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-09-06 Steven G. Kargl <kargls@comcast.net> + + * io/write.c (output_float): Typo in comment. Remove debugging + printf. Fix format for FP of form 1e10. + 2004-09-06 Mohan Embar <gnustuff@thisiscool.com> * Makefile.in (rtl.o): Remove -DGENERATOR_FILE. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a968825..076bbf5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-09-06 Paul Brook <paul@codesourcery.com> + + * gfortran.dg/edit_real_1.f90: Add new test. + 2004-09-05 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> * gcc.dg/tree-ssa/loop-2.c: New test. diff --git a/gcc/testsuite/gfortran.dg/edit_real_1.f90 b/gcc/testsuite/gfortran.dg/edit_real_1.f90 index dc8eee1..3ac7cb4 100644 --- a/gcc/testsuite/gfortran.dg/edit_real_1.f90 +++ b/gcc/testsuite/gfortran.dg/edit_real_1.f90 @@ -70,5 +70,9 @@ program edit_real_1 s = x write (s, '(-2PE10.4,A)') 1.25, "z" if (s .ne. '0.0013E+03z') call abort + ! E format, single digit precision + s = x + write (s, '(E10.1,A)') 1.1, "z" + if (s .ne. ' 0.1E+01z') call abort end diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index f4d888e..2392b3c 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -292,7 +292,7 @@ output_float (fnode *f, double value, int len) /* Use sprintf to print the number in the format +D.DDDDe+ddd For an N digit exponent, this gives us (32-6)-N digits after the - decimal point, plus annother one before the decimal point. */ + decimal point, plus another one before the decimal point. */ sign = calculate_sign (value < 0.0); if (value < 0) value = -value; @@ -325,14 +325,11 @@ output_float (fnode *f, double value, int len) ndigits = 27 - edigits; } - sprintf (buffer, "%+-31.*e", ndigits - 1, value); + sprintf (buffer, "%+-#31.*e", ndigits - 1, value); /* Check the resulting string has punctuation in the correct places. */ if (buffer[2] != '.' || buffer[ndigits + 2] != 'e') - { - printf ("'%s', %d\n", buffer, ndigits); internal_error ("printf is broken"); - } /* Read the exponent back in. */ e = atoi (&buffer[ndigits + 3]) + 1; |