summaryrefslogtreecommitdiff
path: root/tests/tgeneric.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-01-20 13:52:38 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-01-20 13:52:38 +0000
commitfbc20c99787f338771883628acaa5efbf6ba8c30 (patch)
tree216010434c86e636b7246b4f2a22b98e335b54cb /tests/tgeneric.c
parent635a67b964758b2e7777fd9a26cd5ece988d5110 (diff)
downloadmpfr-fbc20c99787f338771883628acaa5efbf6ba8c30.tar.gz
[tests/tgeneric.c] Improved the generic tests in order to trigger the
mpfr_jn bug found by Fredrik Johansson (r9841) and potential similar bugs: For half cases, the precision of the inputs was modified to be smaller than the base precision (for the result). Here, this rule is changed so that if the base precision is small (< 16), then the precision of the inputs is chosen to be significantly *larger* than the base precision in general. Note: With this improvement, both tj0 and tj1 fail in r9840. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@9848 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tgeneric.c')
-rw-r--r--tests/tgeneric.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/tgeneric.c b/tests/tgeneric.c
index 99f1a675c..93c386146 100644
--- a/tests/tgeneric.c
+++ b/tests/tgeneric.c
@@ -176,7 +176,12 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
xprec = prec;
if (randlimb () & 1)
{
- xprec *= (double) randlimb () / MPFR_LIMB_MAX;
+ /* In half cases, modify the precision of the inputs:
+ If the base precision (for the result) is small,
+ take a larger input precision in general, else
+ take a smaller precision. */
+ xprec *= (prec < 16 ? 256.0 : 1.0) *
+ (double) randlimb () / MPFR_LIMB_MAX;
if (xprec < MPFR_PREC_MIN)
xprec = MPFR_PREC_MIN;
}