summaryrefslogtreecommitdiff
path: root/tests/tsub.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-02-15 14:27:08 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-02-15 14:27:08 +0000
commitbfbaaa40580631c880fdf28693bae137c25d7b5f (patch)
tree1630659bf53932dfa608e40efde883175612ce52 /tests/tsub.c
parent4be9f8d6cd0e2ce860f81e9da9db57c778060342 (diff)
downloadmpfr-bfbaaa40580631c880fdf28693bae137c25d7b5f.tar.gz
[tests/tsub.c] Added bug20180215 test currently failing, found from a
failure using -DMPFR_GENERIC_ABI in CFLAGS and the --enable-assert=full configure option; but the test had to be extended so that it also fails with a simple "configure", i.e. without -DMPFR_GENERIC_ABI in CFLAGS and without the --enable-assert=full configure option. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12246 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tsub.c')
-rw-r--r--tests/tsub.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/tsub.c b/tests/tsub.c
index 55e0b61e1..365f59274 100644
--- a/tests/tsub.c
+++ b/tests/tsub.c
@@ -940,6 +940,38 @@ test_rndf_exact (mp_size_t pmax)
}
}
+static void
+bug20180215 (void)
+{
+ mpfr_t x, y, z1, z2;
+ mpfr_rnd_t r[] = { MPFR_RNDN, MPFR_RNDU, MPFR_RNDA };
+ int i, p;
+
+ for (p = 3; p <= 3 + 4 * GMP_NUMB_BITS; p++)
+ {
+ mpfr_inits2 (p, x, y, z1, z2, (mpfr_ptr) 0);
+ mpfr_set_ui_2exp (x, 1, p - 1, MPFR_RNDN);
+ mpfr_nextabove (x);
+ mpfr_set_ui_2exp (y, 3, -1, MPFR_RNDN);
+ mpfr_set (z1, x, MPFR_RNDN);
+ mpfr_nextbelow (z1);
+ mpfr_nextbelow (z1);
+ for (i = 0; i < numberof (r); i++)
+ {
+ test_sub (z2, x, y, r[i]);
+ if (! mpfr_equal_p (z1, z2))
+ {
+ printf ("Error in bug20180215 in precision %d, %s\n",
+ p, mpfr_print_rnd_mode (r[i]));
+ printf ("expected "); mpfr_dump (z1);
+ printf ("got "); mpfr_dump (z2);
+ exit (1);
+ }
+ }
+ mpfr_clears (x, y, z1, z2, (mpfr_ptr) 0);
+ }
+}
+
#define TEST_FUNCTION test_sub
#define TWO_ARGS
#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
@@ -962,6 +994,7 @@ main (void)
check_inexact ();
check_max_almosteven ();
bug_ddefour ();
+ bug20180215 ();
for (p=2; p<200; p++)
for (i=0; i<50; i++)
check_two_sum (p);