summaryrefslogtreecommitdiff
path: root/tests/tdiv_ui.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-13 13:44:41 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-13 13:44:41 +0000
commit1931b8fa551b44b3ac787f2b077a231c4d339829 (patch)
treeddec24d0ab243d55f3e953f2b0d372d8773ecc13 /tests/tdiv_ui.c
parent006f3c4678c66c90ad60336c1a89be3bec7f0c2c (diff)
downloadmpfr-1931b8fa551b44b3ac787f2b077a231c4d339829.tar.gz
improved test coverage
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2706 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tdiv_ui.c')
-rw-r--r--tests/tdiv_ui.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/tdiv_ui.c b/tests/tdiv_ui.c
index cf823a9bb..af946ace1 100644
--- a/tests/tdiv_ui.c
+++ b/tests/tdiv_ui.c
@@ -89,6 +89,28 @@ special (void)
exit (1);
}
+ /* corner case */
+ mpfr_set_prec (x, 2 * mp_bits_per_limb);
+ mpfr_set_prec (y, 2);
+ mpfr_set_ui (x, 4, GMP_RNDN);
+ mpfr_nextabove (x);
+ mpfr_div_ui (y, x, 2, GMP_RNDN); /* exactly in the middle */
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 2) == 0);
+
+ mpfr_set_prec (x, 3 * mp_bits_per_limb);
+ mpfr_set_prec (y, 2);
+ mpfr_set_ui (x, 2, GMP_RNDN);
+ mpfr_nextabove (x);
+ mpfr_div_ui (y, x, 2, GMP_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0);
+
+ mpfr_set_prec (x, 3 * mp_bits_per_limb);
+ mpfr_set_prec (y, 2);
+ mpfr_set_si (x, -4, GMP_RNDN);
+ mpfr_nextbelow (x);
+ mpfr_div_ui (y, x, 2, GMP_RNDD);
+ MPFR_ASSERTN(mpfr_cmp_si (y, -3) == 0);
+
for (xprec = 53; xprec <= 128; xprec++)
{
mpfr_set_prec (x, xprec);
@@ -174,10 +196,10 @@ main (int argc, char **argv)
tests_start_mpfr ();
- check_inexact ();
-
special ();
+ check_inexact ();
+
check("1.0", 3, GMP_RNDN, "3.3333333333333331483e-1");
check("1.0", 3, GMP_RNDZ, "3.3333333333333331483e-1");
check("1.0", 3, GMP_RNDU, "3.3333333333333337034e-1");