summaryrefslogtreecommitdiff
path: root/src/div.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2009-08-24 14:39:57 +0000
committerzimmerma <zimmerma@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2009-08-24 14:39:57 +0000
commitd0fd01a69672ec32474d4199050a06c30194c03c (patch)
tree57558c02494b2d487251bad8de8836322e3dd4f9 /src/div.c
parent6ab853ae950f73ca5ef8026eb06eb983a27e2761 (diff)
downloadmpc-d0fd01a69672ec32474d4199050a06c30194c03c.tar.gz
[div.c] fixed bug in div(x,x,x) when real part x is zero
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@657 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'src/div.c')
-rw-r--r--src/div.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/div.c b/src/div.c
index b788ecd..1e346ef 100644
--- a/src/div.c
+++ b/src/div.c
@@ -206,6 +206,7 @@ mpc_div (mpc_ptr a, mpc_srcptr b, mpc_srcptr c, mpc_rnd_t rnd)
{
/* (re_b+i*im_b)/(i*c) = im_b/c - i * (re_b/c) */
int overlap = (a == b) || (a == c);
+ int imag_b = mpfr_zero_p (MPC_RE (b));
mpfr_t cloc;
if (overlap)
@@ -226,7 +227,7 @@ mpc_div (mpc_ptr a, mpc_srcptr b, mpc_srcptr c, mpc_rnd_t rnd)
if (mpfr_zero_p (MPC_RE (a)))
mpfr_setsign (MPC_RE (a), MPC_RE (a), (brs != crs && bis != cis),
GMP_RNDN); /* exact */
- if (mpfr_zero_p (MPC_RE (b)))
+ if (imag_b)
mpfr_setsign (MPC_IM (a), MPC_IM (a), (bis != crs && brs == cis),
GMP_RNDN);