diff options
author | Paul Brook <paul@codesourcery.com> | 2004-09-02 01:33:01 +0000 |
---|---|---|
committer | Paul Brook <pbrook@gcc.gnu.org> | 2004-09-02 01:33:01 +0000 |
commit | d809264e863ffbf312af0e23bd30799ffa999096 (patch) | |
tree | f174d83e96b96dfdc5e9932f24caad92c63d9fe1 /libgfortran | |
parent | 130d5426f03f01226b351b31ccf6fffbd85b1410 (diff) | |
download | gcc-d809264e863ffbf312af0e23bd30799ffa999096.zip gcc-d809264e863ffbf312af0e23bd30799ffa999096.tar.gz gcc-d809264e863ffbf312af0e23bd30799ffa999096.tar.bz2 |
format.c (parse_format_list): Set repeat count for P descriptors.
* io/format.c (parse_format_list): Set repeat count for P descriptors.
* write.c (output_float): Fix condition. Correctly handle nonzero
scale factor.
testsuite/
* gfortran.dg/edit_real_1.f90: Add new tests.
From-SVN: r86952
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/format.c | 1 | ||||
-rw-r--r-- | libgfortran/io/write.c | 15 |
3 files changed, 19 insertions, 3 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index c467b8c..6bf52bb 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2004-09-02 Paul Brook <paul@codesourcery.com> + + * io/format.c (parse_format_list): Set repeat count for P descriptors. + * write.c (output_float): Fix condition. Correctly handle nonzero + scale factor. + 2004-09-01 Eric Botcazou <ebotcazou@libertysurf.fr> * mk-sik-inc.sh: Use a temporary string instead of 'echo -n'. diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c index f886f7f..23b8d5e 100644 --- a/libgfortran/io/format.c +++ b/libgfortran/io/format.c @@ -501,6 +501,7 @@ format_item: p_descriptor: get_fnode (&head, &tail, FMT_P); tail->u.k = value; + tail->repeat = 1; t = format_lex (); if (t == FMT_F || t == FMT_EN || t == FMT_ES || t == FMT_D diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index 152754f..f4d888e 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -307,7 +307,8 @@ output_float (fnode *f, double value, int len) edigits = 2; } - if (FMT_F || FMT_ES) + if (ft == FMT_F || ft == FMT_EN + || ((ft == FMT_D || ft == FMT_E) && g.scale_factor != 0)) { /* Always convert at full precision to avoid double rounding. */ ndigits = 27 - edigits; @@ -368,18 +369,26 @@ output_float (fnode *f, double value, int len) case FMT_E: case FMT_D: i = g.scale_factor; + e -= i; if (i < 0) { nbefore = 0; nzero = -i; nafter = d + i; } - else + else if (i > 0) { nbefore = i; nzero = 0; - nafter = d - i; + nafter = (d - i) + 1; } + else /* i == 0 */ + { + nbefore = 0; + nzero = 0; + nafter = d; + } + if (ft = FMT_E) expchar = 'E'; else |