summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-04-03 13:02:58 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-04-03 13:02:58 +0000
commitda46f937f5b145de2246e4d7e4e540ebf2b4a611 (patch)
treec7844d5d3093cfcac3b3600a5f3e633622f7524b
parent8f23cebf5706d6bd7a495b636866ab562b113714 (diff)
downloadmpfr-da46f937f5b145de2246e4d7e4e540ebf2b4a611.tar.gz
[tests/tsub.c]
* Fixed the test_ubf test, which may fail with some seeds, such as GMP_CHECK_RANDOMIZE=1585822440108893: A random precision was too small, so that an input for the test was not computed exactly. Also check that the inputs are computed exactly. * Corrected MPFR_ASSERTD to MPFR_ASSERTN. (merged changesets r13862,13867-13868 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/4.0@13869 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--tests/tsub.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/tests/tsub.c b/tests/tsub.c
index 452ce4588..bb1f43b7a 100644
--- a/tests/tsub.c
+++ b/tests/tsub.c
@@ -1203,9 +1203,9 @@ static void test_ubf_aux (void)
for (j = 0; j < numberof (e); j++)
{
inexact = mpfr_set_exp_t (ee, e[j], MPFR_RNDN);
- MPFR_ASSERTD (inexact == 0);
+ MPFR_ASSERTN (inexact == 0);
inexact = mpfr_get_z (MPFR_ZEXP (p[0]), ee, MPFR_RNDN);
- MPFR_ASSERTD (inexact == 0);
+ MPFR_ASSERTN (inexact == 0);
mpz_sub_ui (MPFR_ZEXP (p[0]), MPFR_ZEXP (p[0]), kn);
for (k = -kn; k <= kn; k++)
@@ -1266,23 +1266,31 @@ static void test_ubf_aux (void)
{
static int v[4] = { 26, 1, 256, 231 };
- mpfr_init2 (p[i], i < 4 ? 5 + (randlimb () % 128) : 256);
+ mpfr_init2 (p[i], i < 4 ? 8 + (randlimb () % 128) : 256);
if (i < 4)
- mpfr_set_si_2exp (p[i], v[i], -5, MPFR_RNDN);
+ {
+ inexact = mpfr_set_si_2exp (p[i], v[i], -5, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ }
else
{
- mpfr_set_si_2exp (p[i], 1, 200, MPFR_RNDN);
- mpfr_add (p[i], p[i], p[i-4], MPFR_RNDN);
+ inexact = mpfr_set_si_2exp (p[i], 1, 200, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ inexact = mpfr_add (p[i], p[i], p[i-4], MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
}
ex[i] = mpfr_get_exp (p[i]) + 5;
- MPFR_ASSERTD (ex[i] >= 0);
+ MPFR_ASSERTN (ex[i] >= 0);
}
mpfr_inits2 (3, p[8], p[9], p[10], (mpfr_ptr) 0);
- mpfr_set_si_2exp (p[8], 1, 0, MPFR_RNDN);
+ inexact = mpfr_set_si_2exp (p[8], 1, 0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
ex[8] = 5;
- mpfr_set_si_2exp (p[9], 1, 0, MPFR_RNDN); /* will be epsilon */
+ inexact = mpfr_set_si_2exp (p[9], 1, 0, MPFR_RNDN); /* will be epsilon */
+ MPFR_ASSERTN (inexact == 0);
ex[9] = 0;
- mpfr_set_si_2exp (p[10], 7, 0, MPFR_RNDN);
+ inexact = mpfr_set_si_2exp (p[10], 7, 0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
ex[10] = 5;
for (i = 0; i < 11; i++)
@@ -1294,9 +1302,9 @@ static void test_ubf_aux (void)
for (j = 0; j < numberof (e); j++)
{
inexact = mpfr_set_exp_t (ee, e[j], MPFR_RNDN);
- MPFR_ASSERTD (inexact == 0);
+ MPFR_ASSERTN (inexact == 0);
inexact = mpfr_get_z (MPFR_ZEXP (p[0]), ee, MPFR_RNDN);
- MPFR_ASSERTD (inexact == 0);
+ MPFR_ASSERTN (inexact == 0);
for (i = 1; i < 11; i++)
mpz_set (MPFR_ZEXP (p[i]), MPFR_ZEXP (p[0]));
for (i = 0; i < 11; i++)