summaryrefslogtreecommitdiff
path: root/tests/tgeneric.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-01-10 12:22:11 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-01-10 12:22:11 +0000
commit43a1b9a5621ec7e553669ade0d99729d71502b34 (patch)
treea434fcce5d1fbbf42bc055647a3df591bd6c3b5d /tests/tgeneric.c
parent8c1025d5298df6c618830c4f324dc2da9d13dde7 (diff)
downloadmpfr-43a1b9a5621ec7e553669ade0d99729d71502b34.tar.gz
[tests/tgeneric.c] Do several overflow/underflow tests instead of 1, and
this for each precision. This allows one to detect the mpfr_ai bug found and fixed on 2018-01-07 (with 32-bit *and* 64-bit ABI): https://sympa.inria.fr/sympa/arc/mpfr/2018-01/msg00001.html Moreover, this makes tlgamma loop with a 32-bit ABI (x86). To be fixed. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12088 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tgeneric.c')
-rw-r--r--tests/tgeneric.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/tgeneric.c b/tests/tgeneric.c
index 464c3a885..942987498 100644
--- a/tests/tgeneric.c
+++ b/tests/tgeneric.c
@@ -157,7 +157,6 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
int inexact, compare, compare2;
unsigned int n;
unsigned long ctrt = 0, ctrn = 0;
- int test_of = 1, test_uf = 1;
mpfr_exp_t old_emin, old_emax;
old_emin = mpfr_get_emin ();
@@ -171,6 +170,12 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
/* generic test */
for (prec = p0; prec <= p1; prec++)
{
+ /* Number of overflow/underflow tests for each precision.
+ Since MPFR uses several algorithms and there may also be
+ early overflow/underflow detection, several tests may be
+ needed to detect a bug. */
+ int test_of = 3, test_uf = 3;
+
mpfr_set_prec (z, prec);
mpfr_set_prec (t, prec);
yprec = prec + 10;
@@ -425,7 +430,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
{
e = MPFR_GET_EXP (y); /* exponent of the result */
- if (test_of && e - 1 >= emax) /* overflow test */
+ if (test_of > 0 && e - 1 >= emax) /* overflow test */
{
mpfr_flags_t ex_flags;
@@ -485,10 +490,10 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
mpfr_dump (w);
exit (1);
}
- test_of = 0; /* Overflow is tested only once. */
+ test_of--;
}
- if (test_uf && e + 1 <= emin) /* underflow test */
+ if (test_uf > 0 && e + 1 <= emin) /* underflow test */
{
mpfr_flags_t ex_flags;
@@ -548,7 +553,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
mpfr_dump (w);
exit (1);
}
- test_uf = 0; /* Underflow is tested only once. */
+ test_uf--;
}
if (e < emin)