summaryrefslogtreecommitdiff
path: root/tests/tsub.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-02-16 02:08:03 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-02-16 02:08:03 +0000
commit7569be36ace56e9434387415be11a745fa387531 (patch)
tree1776055aedce3ebee84e19db2e8156b51e8941b4 /tests/tsub.c
parent273526299a0e4ed305bb89ba101090b718628367 (diff)
downloadmpfr-7569be36ace56e9434387415be11a745fa387531.tar.gz
[tests/tsub.c] Added bug20180216 test currently failing (corresponding
to the failure mentioned in r12253, r12254 and r12255, but reproducible with a simple "./configure"). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12256 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tsub.c')
-rw-r--r--tests/tsub.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/tsub.c b/tests/tsub.c
index 9045047fc..97f2ef2ee 100644
--- a/tests/tsub.c
+++ b/tests/tsub.c
@@ -977,6 +977,37 @@ bug20180215 (void)
}
}
+static void
+bug20180216 (void)
+{
+ mpfr_t x, y, z1, z2;
+ int r, p, inex;
+
+ for (p = 4; p <= 4 + 4 * GMP_NUMB_BITS; p++)
+ {
+ mpfr_inits2 (p, x, y, z1, z2, (mpfr_ptr) 0);
+ mpfr_set_ui (x, 5, MPFR_RNDN);
+ mpfr_nextabove (x);
+ mpfr_sub_ui (y, x, 4, MPFR_RNDN);
+ mpfr_set_ui (z1, 4, MPFR_RNDN);
+ RND_LOOP (r)
+ {
+ inex = test_sub (z2, x, y, (mpfr_rnd_t) r);
+ if (! mpfr_equal_p (z1, z2) || inex != 0)
+ {
+ printf ("Error in bug20180216 in precision %d, %s\n",
+ p, mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ printf ("expected "); mpfr_dump (z1);
+ printf (" with inex = 0\n");
+ printf ("got "); mpfr_dump (z2);
+ printf (" with inex = %d\n", inex);
+ 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)
@@ -1000,6 +1031,7 @@ main (void)
check_max_almosteven ();
bug_ddefour ();
bug20180215 ();
+ bug20180216 ();
for (p=2; p<200; p++)
for (i=0; i<50; i++)
check_two_sum (p);