diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2002-04-20 13:17:37 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2002-04-20 13:17:37 +0000 |
commit | 35a542057b715da0510a4edf00b470828e1765a9 (patch) | |
tree | e265e4ac470763a9f6c6de6996cbf1eac80157d7 /get_d.c | |
parent | 43c8e2afde56b697d49c7ee124bc6721a105bdc1 (diff) | |
download | mpfr-35a542057b715da0510a4edf00b470828e1765a9.tar.gz |
Avoid constant floating expression, as this doesn't give the correct
result with gcc on some Alpha machines. (patch by Paul Zimmermann)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1906 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'get_d.c')
-rw-r--r-- | get_d.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -116,13 +116,18 @@ mpfr_get_d3 (mpfr_srcptr src, mp_exp_t e, mp_rnd_t rnd_mode) subnormal is 2^(-1074)=0.1e-1073 */ if (e < -1073) { + /* Note: Avoid using a constant expression DBL_MIN * DBL_EPSILON + as this gives 0 instead of the correct result with gcc on some + Alpha machines. */ d = negative ? (rnd_mode == GMP_RNDD || (rnd_mode == GMP_RNDN && mpfr_cmp_si_2exp(src, -1, -1075) < 0) - ? -DBL_MIN * DBL_EPSILON : -0.0) : + ? -DBL_MIN : -0.0) : (rnd_mode == GMP_RNDU || (rnd_mode == GMP_RNDN && mpfr_cmp_si_2exp(src, 1, -1075) > 0) - ? DBL_MIN * DBL_EPSILON : 0.0); + ? DBL_MIN : 0.0); + if (d != 0.0) + d *= DBL_EPSILON; } /* the largest normalized number is 2^1024*(1-2^(-53))=0.111...111e1024 */ else if (e > 1024) |