diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-08-30 14:26:54 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-08-30 14:26:54 +0000 |
commit | fc747ffa4479f39fe015487f08387ea722ce1a78 (patch) | |
tree | 06ebd52aad63c1b0741821e9c248e94d2bfa4352 | |
parent | 1bf10c039d1e51ec43eea53fe777f74630ebee4f (diff) | |
download | mpfr-fc747ffa4479f39fe015487f08387ea722ce1a78.tar.gz |
tgeneric.c: output a warning when too few normal cases are tested
(so that the random function can be improved...).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4809 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | tests/tgeneric.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/tgeneric.c b/tests/tgeneric.c index a51242f73..711557f14 100644 --- a/tests/tgeneric.c +++ b/tests/tgeneric.c @@ -94,6 +94,7 @@ test_generic (mp_prec_t p0, mp_prec_t p1, unsigned int N) mp_rnd_t rnd; int inexact, compare, compare2; unsigned int n; + unsigned long ctrt = 0, ctrn = 0; mpfr_init (x); mpfr_init (y); @@ -175,6 +176,7 @@ test_generic (mp_prec_t p0, mp_prec_t p1, unsigned int N) #endif TGENERIC_CHECK ("Bad inexact flag", (compare != 0) ^ (mpfr_inexflag_p () == 0)); + ctrt++; if (MPFR_IS_SINGULAR (y)) { if (MPFR_IS_NAN (y) || mpfr_nanflag_p ()) @@ -203,6 +205,7 @@ test_generic (mp_prec_t p0, mp_prec_t p1, unsigned int N) } else if (mpfr_can_round (y, yprec, rnd, rnd, prec)) { + ctrn++; mpfr_set (t, y, rnd); #ifdef DEBUG_TGENERIC TGENERIC_INFO (TEST_FUNCTION, MPFR_PREC (z)); @@ -260,6 +263,10 @@ test_generic (mp_prec_t p0, mp_prec_t p1, unsigned int N) } } + if (3 * ctrn < 2 * ctrt) + printf ("Warning! Too few normal cases in generic tests (%lu / %lu)\n", + ctrn, ctrt); + mpfr_clear (x); mpfr_clear (y); mpfr_clear (z); |