summaryrefslogtreecommitdiff
path: root/src/mul.c
diff options
context:
space:
mode:
authorenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2011-02-15 19:25:12 +0000
committerenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2011-02-15 19:25:12 +0000
commit16c28658af9cc7289ff650829ea391cd56886e7a (patch)
tree3fde8c249069b6e30977e38913b5cee629cfb370 /src/mul.c
parentebbd10d7f7b360697f34e107bf60d5e425bc63a2 (diff)
downloadmpc-16c28658af9cc7289ff650829ea391cd56886e7a.tar.gz
mul.c: removed square case from mul_naive, since tested in mul
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@923 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'src/mul.c')
-rw-r--r--src/mul.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/mul.c b/src/mul.c
index aea7dd5..b3d5ae3 100644
--- a/src/mul.c
+++ b/src/mul.c
@@ -248,6 +248,7 @@ mul_pure_imaginary (mpc_ptr a, mpc_srcptr u, mpfr_srcptr y, mpc_rnd_t rnd,
int
mpc_mul_naive (mpc_ptr a, mpc_srcptr b, mpc_srcptr c, mpc_rnd_t rnd)
{
+ /* We assume that b and c are different, which is checked in mpc_mul. */
int overlap, inex_re, inex_im;
mpfr_t u, v, t;
mpfr_prec_t prec;
@@ -275,13 +276,8 @@ mpc_mul_naive (mpc_ptr a, mpc_srcptr b, mpc_srcptr c, mpc_rnd_t rnd)
/* Im(a) = Re(b)*Im(c) + Im(b)*Re(c) */
mpfr_mul (u, MPC_RE(b), MPC_IM(c), GMP_RNDN); /* exact */
- if (b == c) /* square case */
- inex_im = mpfr_mul_2exp (MPC_IM(a), u, 1, MPC_RND_IM(rnd));
- else
- {
- mpfr_mul (v, MPC_IM(b), MPC_RE(c), GMP_RNDN); /* exact */
- inex_im = mpfr_add (MPC_IM(a), u, v, MPC_RND_IM(rnd));
- }
+ mpfr_mul (v, MPC_IM(b), MPC_RE(c), GMP_RNDN); /* exact */
+ inex_im = mpfr_add (MPC_IM(a), u, v, MPC_RND_IM(rnd));
mpfr_clear (u);
mpfr_clear (v);