summaryrefslogtreecommitdiff
path: root/src/fma.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-04-16 13:54:22 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-04-16 13:54:22 +0000
commit486c844c86edd3d27ec25b41bb1fdfb4dc40af9c (patch)
tree762725eb4215319c46a3854c381d3556ca981f1c /src/fma.c
parente1bd2a84df300354b9371b492cdf13a16e32f0ee (diff)
downloadmpfr-486c844c86edd3d27ec25b41bb1fdfb4dc40af9c.tar.gz
[src/fma.c] Updated easy case of underflow.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12602 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/fma.c')
-rw-r--r--src/fma.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/fma.c b/src/fma.c
index e166de892..0706d4acb 100644
--- a/src/fma.c
+++ b/src/fma.c
@@ -241,16 +241,17 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
return mpfr_overflow (s, rnd_mode, sign_u);
}
}
- else /* underflow: one has |xy| < 2^(emin-1). */
+ else /* underflow: one has |x*y| < 2^(emin-1). */
{
MPFR_LOG_MSG (("Underflow on x*y\n", 0));
- /* Let's detect easy cases, i.e. when 2^(emin-1) is less than
- one half of both ulp(z) and ulp(s), so that one can replace
- x*y by sign(x*y) * 2^(emin-1).
+ /* Easy cases: when 2^(emin-1) <= 1/2 * min(ulp(z),ulp(s)),
+ one can replace x*y by sign(x*y) * 2^(emin-1). Note that
+ this is even true in case of equality for MPFR_RNDN thanks
+ to the even-rounding rule.
The + 1 on MPFR_PREC (s) is necessary because the exponent
of the result can be EXP(z) - 1. */
- if (MPFR_GET_EXP (z) - __gmpfr_emin >
+ if (MPFR_GET_EXP (z) - __gmpfr_emin >=
MAX (MPFR_PREC (z), MPFR_PREC (s) + 1))
{
MPFR_PREC (u) = MPFR_PREC_MIN;