diff options
author | zimmerma <zimmerma@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2011-08-31 14:11:25 +0000 |
---|---|---|
committer | zimmerma <zimmerma@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2011-08-31 14:11:25 +0000 |
commit | d18edc9328a68a9ca6a5e2154ea98ac634660b4b (patch) | |
tree | d75c4a68ff3e75187993bb9ab5dc03265ab7af0e /src/mul.c | |
parent | 36ff7976b51c7ce4a1c6bd8449e144ef07a6cbe3 (diff) | |
download | mpc-d18edc9328a68a9ca6a5e2154ea98ac634660b4b.tar.gz |
[src/mul.c] in mpc_mul_karatsuba, check that a*d and b*c are exact
(no underflow nor overflow) otherwise the algorithm might be wrong
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1055 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'src/mul.c')
-rw-r--r-- | src/mul.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -418,11 +418,13 @@ mpc_mul_karatsuba (mpc_ptr rop, mpc_srcptr op1, mpc_srcptr op2, mpc_rnd_t rnd) mpfr_init2 (w, prec_w = mpfr_get_prec (b) + mpfr_get_prec (c)); mpfr_init2 (x, 2); - mpfr_mul (v, a, d, GMP_RNDN); /* exact */ + inexact = mpfr_mul (v, a, d, GMP_RNDN); /* exact if no underflow/overflow */ + MPC_ASSERT(inexact == 0); if (mul_a == -1) mpfr_neg (v, v, GMP_RNDN); - mpfr_mul (w, b, c, GMP_RNDN); /* exact */ + inexact = mpfr_mul (w, b, c, GMP_RNDN); /* exact if no underflow/overflow */ + MPC_ASSERT(inexact == 0); if (mul_c == -1) mpfr_neg (w, w, GMP_RNDN); |