summaryrefslogtreecommitdiff
path: root/tests/tdiv.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2016-06-24 08:20:41 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2016-06-24 08:20:41 +0000
commit6daf4759710917bfafb02fb93afdd5ea4207e93a (patch)
treed7c681020f6f2e01bc46a9807b51238796e4ecfc /tests/tdiv.c
parent094cb2fd15fd38b90a3bf70ed684149a0f6c85b7 (diff)
downloadmpfr-6daf4759710917bfafb02fb93afdd5ea4207e93a.tar.gz
added exhaustive tests for add,sub,mul,div,sqrt
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/faithful@10497 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tdiv.c')
-rw-r--r--tests/tdiv.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/tdiv.c b/tests/tdiv.c
index 2e3525a06..8c3a570c9 100644
--- a/tests/tdiv.c
+++ b/tests/tdiv.c
@@ -1312,11 +1312,62 @@ test_extreme (void)
set_emax (emax);
}
+static void
+testall_rndf (mpfr_prec_t pmax)
+{
+ mpfr_t a, b, c, d;
+ mpfr_prec_t pa, pb, pc;
+
+ for (pa = MPFR_PREC_MIN; pa <= pmax; pa++)
+ {
+ mpfr_init2 (a, pa);
+ mpfr_init2 (d, pa);
+ for (pb = MPFR_PREC_MIN; pb <= pmax; pb++)
+ {
+ mpfr_init2 (b, pb);
+ mpfr_set_ui (b, 1, MPFR_RNDN);
+ while (mpfr_cmp_ui (b, 2) < 0)
+ {
+ for (pc = MPFR_PREC_MIN; pc <= pmax; pc++)
+ {
+ mpfr_init2 (c, pc);
+ mpfr_set_ui (c, 1, MPFR_RNDN);
+ while (mpfr_cmp_ui (c, 2) < 0)
+ {
+ mpfr_div (a, b, c, MPFR_RNDF);
+ mpfr_div (d, b, c, MPFR_RNDD);
+ if (mpfr_cmp (a, d))
+ {
+ mpfr_div (d, b, c, MPFR_RNDU);
+ if (mpfr_cmp (a, d))
+ {
+ printf ("Error: mpfr_div(a,b,c,RNDF) does not "
+ "match RNDD/RNDU\n");
+ printf ("b="); mpfr_dump (b);
+ printf ("c="); mpfr_dump (c);
+ printf ("a="); mpfr_dump (a);
+ exit (1);
+ }
+ }
+ mpfr_nextabove (c);
+ }
+ mpfr_clear (c);
+ }
+ mpfr_nextabove (b);
+ }
+ mpfr_clear (b);
+ }
+ mpfr_clear (a);
+ mpfr_clear (d);
+ }
+}
+
int
main (int argc, char *argv[])
{
tests_start_mpfr ();
+ testall_rndf (9);
check_inexact ();
check_hard ();
check_special ();