summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2012-03-02 20:22:53 +0000
committerenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2012-03-02 20:22:53 +0000
commit2ae2f0f5ca393f10d5145fbbedcda6945cb8e71f (patch)
tree0a3d69865e21f2098ec3a3fbee85b7bc5244c726 /src
parent6b4c0d42ae380734a72e2da45859e130b7f1d323 (diff)
downloadmpc-2ae2f0f5ca393f10d5145fbbedcda6945cb8e71f.tar.gz
mul.c: added missing case of exactly one underflow to mpfr_fmma;
commented out test case in sqr.dat now passes when artificially forcing naive squaring git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1136 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'src')
-rw-r--r--src/mul.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mul.c b/src/mul.c
index 842d0ef..ff220e5 100644
--- a/src/mul.c
+++ b/src/mul.c
@@ -201,6 +201,14 @@ mpfr_fmma (mpfr_ptr z, mpfr_srcptr a, mpfr_srcptr b, mpfr_srcptr c,
mpfr_set_si (z, (mpfr_signbit (z) ? -1 : 1), GMP_RNDN);
inex = mpfr_mul_2ui (z, z, mpfr_get_emax (), rnd);
}
+ else if (mpfr_zero_p (u) && !mpfr_zero_p (v)) {
+ /* exactly u underflowed, determine inexact flag */
+ inex = (mpfr_signbit (u) ? 1 : -1);
+ }
+ else if (mpfr_zero_p (v) && !mpfr_zero_p (u)) {
+ /* exactly v underflowed, determine inexact flag */
+ inex = (mpfr_signbit (v) ? 1 : -1);
+ }
else if (mpfr_nan_p (z) || (mpfr_zero_p (u) && mpfr_zero_p (v))) {
/* In the first case, u and v are infinities with opposite signs.
In the second case, u and v are zeroes; their sum may be 0 or the