summaryrefslogtreecommitdiff
path: root/tests/tdiv.c
diff options
context:
space:
mode:
authorPaul Zimmermann <paul.zimmermann@inria.fr>2008-10-21 11:16:12 +0000
committerPaul Zimmermann <paul.zimmermann@inria.fr>2008-10-21 11:16:12 +0000
commit02be205fee96577cd56d04dd1a67ac4f4e4f1d2d (patch)
treea7be11f09366b51a45faf583ebaf0489fd757144 /tests/tdiv.c
parentb5b1ecf5610727cbde03864131642e1a45120da6 (diff)
downloadmpc-git-02be205fee96577cd56d04dd1a67ac4f4e4f1d2d.tar.gz
[tdiv.c] added test for real divisor, which should give a 100% coverage
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/mpc/trunk@262 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tdiv.c')
-rw-r--r--tests/tdiv.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/tdiv.c b/tests/tdiv.c
index 39e094f..bcc7925 100644
--- a/tests/tdiv.c
+++ b/tests/tdiv.c
@@ -96,6 +96,21 @@ check_regular (void)
exit (1);
}
+ /* pure real divisor */
+ mpc_set_prec (b, 4);
+ mpc_set_prec (c, 4);
+ mpc_set_prec (q, 4);
+ mpc_set_si_si (b, 15, 14, MPC_RNDNN);
+ mpc_set_si_si (c, 11, 0, MPC_RNDNN);
+ inex = mpc_div (q, b, c, MPC_RNDNN); /* should be 11/8 + 5/4*I */
+ mpc_set_si_si (b, 11, 10, MPC_RNDNN);
+ mpc_div_ui (b, b, 8, MPC_RNDNN);
+ if (mpc_cmp (q, b) || inex != MPC_INEX(1, -1))
+ {
+ printf ("mpc_div failed for (15+14*I)/11\n");
+ exit (1);
+ }
+
mpc_clear (b);
mpc_clear (c);
mpc_clear (q);