diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2006-08-28 05:14:05 +0000 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2006-08-28 05:14:05 +0000 |
commit | 20e1580fadc08ed87a2a9c3f118b2268112edee8 (patch) | |
tree | 784aa5a8321e597079f249cda1afed864f63db7e | |
parent | 7f22b9fca4fea70b3d837e7c6abcb14bd1509b18 (diff) | |
download | gcc-20e1580fadc08ed87a2a9c3f118b2268112edee8.zip gcc-20e1580fadc08ed87a2a9c3f118b2268112edee8.tar.gz gcc-20e1580fadc08ed87a2a9c3f118b2268112edee8.tar.bz2 |
re PR libfortran/28354 ([4.1 Only] 0.99999 printed as 0. instead of 1. by format(f3.0))
2006-08-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/28354
* io/write.c: Check for special case of zero precision in format
and pre-round the real value.
From-SVN: r116502
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/write.c | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 773f806..7151344 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2006-08-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/28354 + * io/write.c: Check for special case of zero precision in format + and pre-round the real value. + 2006-08-15 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/25828 diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index bee367c..79018cc 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -426,6 +426,15 @@ output_float (st_parameter_dt *dtp, const fnode *f, GFC_REAL_LARGEST value) if (value < 0) value = -value; + /* Special case when format specifies no digits after the decimal point. */ + if (d == 0) + { + if (value < 0.5) + value = 0.0; + else if (value < 1.0) + value = value + 0.5; + } + /* Printf always prints at least two exponent digits. */ if (value == 0) edigits = 2; |