diff options
author | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-22 21:17:42 +0000 |
---|---|---|
committer | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-22 21:17:42 +0000 |
commit | 5cbbcbc9cfece5949c8ed4ec796706e7cd3364d2 (patch) | |
tree | d78fc134f7ad49b35645da8bf676568d8cf59dd4 /libgfortran/io | |
parent | 7a54a09a41bcd1332316292c62f7ac2abc509747 (diff) | |
download | gcc-5cbbcbc9cfece5949c8ed4ec796706e7cd3364d2.tar.gz |
PR libfortran/21376
* io/write.c (output_float): Rework logic to avoid call to log10
with argument equal to zero.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100068 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io')
-rw-r--r-- | libgfortran/io/write.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index 36fee925988..793031a9375 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -296,6 +296,7 @@ output_float (fnode *f, double value) int nblanks; int i; sign_t sign; + double abslog; ft = f->format; w = f->u.real.w; @@ -320,9 +321,11 @@ output_float (fnode *f, double value) edigits = 2; else { - edigits = 1 + (int) log10 (fabs(log10 (value))); - if (edigits < 2) + abslog = fabs(log10 (value)); + if (abslog < 100) edigits = 2; + else + edigits = 1 + (int) log10 (abslog); } if (ft == FMT_F || ft == FMT_EN |