From 82192170e3576ba627a8592079ac0bc4b4d465db Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Mon, 22 Dec 2008 14:53:37 +0000 Subject: [PATCH] re PR fortran/37472 (bad output on default-format write of double in common block with -m64) 2008-12-22 Jerry DeLisle PR libfortran/37472 * io/write_float.def (output_float_FMT_G_): Modify calculation of temp to avoid sensitivity to round-off. From-SVN: r142884 --- libgfortran/ChangeLog | 6 ++++++ libgfortran/io/write_float.def | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index f60c5d0e8de..c04331f60fe 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2008-12-22 Jerry DeLisle + + PR libfortran/37472 + * io/write_float.def (output_float_FMT_G_): Modify calculation of temp + to avoid sensitivity to round-off. + 2008-12-21 Jerry DeLisle PR libfortran/38398 diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def index a5d292ca76c..f94fde30b70 100644 --- a/libgfortran/io/write_float.def +++ b/libgfortran/io/write_float.def @@ -640,8 +640,8 @@ output_float_FMT_G_ ## x (st_parameter_dt *dtp, const fnode *f, \ GFC_REAL_ ## x temp;\ mid = (low + high) / 2;\ \ - temp = 0.1 * calculate_exp_ ## x (mid) - 0.5\ - * calculate_exp_ ## x (mid - d - 1);\ + temp = (calculate_exp_ ## x (mid) - \ + 5 * calculate_exp_ ## x (mid - d - 1)) / 10;\ \ if (m < temp)\ { \