summaryrefslogtreecommitdiff
path: root/src/mul.c
diff options
context:
space:
mode:
authorenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2012-03-02 20:11:19 +0000
committerenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2012-03-02 20:11:19 +0000
commit6b4c0d42ae380734a72e2da45859e130b7f1d323 (patch)
tree897a1756aa06b653dbf614989ce39b7fcfee84fe /src/mul.c
parent8a7e70572083c8d964bcbf7297a4d2868835f225 (diff)
downloadmpc-6b4c0d42ae380734a72e2da45859e130b7f1d323.tar.gz
mul.c: reverted previous, too hasty commit; needs more thought
mpc-impl.h, mul.c, sqr.c: for the time being, exported mpfr_fmma to be shared between mul.c and sqr.c sqr.dat: added commented out test that currently fails with naive and Karatsuba algorithms alike git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1135 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'src/mul.c')
-rw-r--r--src/mul.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mul.c b/src/mul.c
index 6d64329..842d0ef 100644
--- a/src/mul.c
+++ b/src/mul.c
@@ -171,7 +171,7 @@ mul_imag (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd)
}
-static int
+int
mpfr_fmma (mpfr_ptr z, mpfr_srcptr a, mpfr_srcptr b, mpfr_srcptr c,
mpfr_srcptr d, int sign, mpfr_rnd_t rnd)
{
@@ -201,9 +201,10 @@ 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_inf_p (u) || mpfr_inf_p (v)
- || mpfr_zero_p (u) || mpfr_zero_p (v)) {
- /* There is at least one over- or underflow.
+ 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
+ least representable number, with a sign to be determined.
Redo the computations with mpz_t exponents */
mpfr_exp_t ea, eb, ec, ed;
mpz_t eu, ev;