diff options
author | thevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2008-09-23 10:36:33 +0000 |
---|---|---|
committer | thevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2008-09-23 10:36:33 +0000 |
commit | c790de37513620efa92a17bbadf1cfe8a44229f6 (patch) | |
tree | 6e5662c3606aa2bc2966310ee16da94b8b5a4651 /tests/tdiv.c | |
parent | 9dd7c83ed9f5a47c097463399fbef3da2caf5898 (diff) | |
download | mpc-c790de37513620efa92a17bbadf1cfe8a44229f6.tar.gz |
src/div.c: Fix bug (an exact case was not correctly handle).
test/tdiv.c: Add a test for this bug.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@186 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tdiv.c')
-rw-r--r-- | tests/tdiv.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/tdiv.c b/tests/tdiv.c index cda51f9..e986043 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -282,6 +282,27 @@ check_regular (void) exit (1); } + /* pure real dividend BUG-20080923 */ + mpc_set_prec (b, 4); + mpc_set_prec (c, 4); + mpc_set_prec (q, 4); + + mpc_set_si_si (b, -3, 0, MPC_RNDNN); + mpc_div_2exp (b, b, 206, MPC_RNDNN); + mpc_set_si_si (c, -1, -5, MPC_RNDNN); + mpfr_div_2ui (MPC_RE (c), MPC_RE (c), 733, GMP_RNDN); + mpfr_div_2ui (MPC_IM (c), MPC_IM (c), 1750, GMP_RNDN); + inex = mpc_div (q, b, c, MPC_RNDNZ); + mpc_set_si_si (b, 3, -7, MPC_RNDNN); + mpfr_mul_2ui (MPC_RE (b), MPC_RE (b), 527, GMP_RNDN); + mpfr_div_2ui (MPC_IM (b), MPC_IM (b), 489, GMP_RNDN); + + if (mpc_cmp (q, b)) + { + printf ("mpc_div failed for -3p-206/(-1p-733 -I* 5p-1750)\n"); + exit (1); + } + mpc_clear (b); mpc_clear (c); mpc_clear (q); |