summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-02-17 13:06:46 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-02-17 13:06:46 +0000
commit538945d728e8a3451ed045d0c7ce3b93270503a4 (patch)
treed7a86d40c60328d0bf1d92cb35aa18cf45803c0b
parent61d926c9e549175fa85aac61777e062d71122c91 (diff)
downloadmpfr-538945d728e8a3451ed045d0c7ce3b93270503a4.tar.gz
[tests/tgeneric.c] Fixed a typo in latest commit, and added min/max
and max/min special tests for functions with 2 arguments. This triggers a failure in tfmod on 64-bit machines at least. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10051 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--tests/tgeneric.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/tests/tgeneric.c b/tests/tgeneric.c
index ed806f041..085556408 100644
--- a/tests/tgeneric.c
+++ b/tests/tgeneric.c
@@ -202,7 +202,13 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
mpfr_set_prec (u, sizeof (unsigned long) * CHAR_BIT);
#endif
- if (n > 3 || prec < p1)
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+#define NSPEC 8
+#else
+#define NSPEC 4
+#endif
+
+ if (n >= NSPEC || prec < p1)
{
#if defined(RAND_FUNCTION)
RAND_FUNCTION (x);
@@ -222,7 +228,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
}
else
{
- /* Special cases tested in precision p1 if n <= 3. They are
+ /* Special cases tested in precision p1 if n < NSPEC. They are
useful really in the extended exponent range. */
#if (defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)) && defined(MPFR_ERRDIVZERO)
goto next_n;
@@ -235,10 +241,10 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
mpfr_set_exp (x, REDUCE_EMIN);
#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, MPFR_RNDN);
- mpfr_set_exp (u, REDUCE_EMAX);
+ mpfr_set_exp (u, REDUCE_EMIN);
#endif
}
- else /* 2 <= n <= 3 */
+ else if (n <= 3)
{
mpfr_set_si (x, n == 2 ? 1 : -1, MPFR_RNDN);
mpfr_setmax (x, REDUCE_EMAX);
@@ -247,6 +253,26 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
mpfr_setmax (u, REDUCE_EMAX);
#endif
}
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ else if (n <= 5)
+ {
+ mpfr_set_si (x, n == 4 ? 1 : -1, MPFR_RNDN);
+ mpfr_set_exp (x, REDUCE_EMIN);
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, MPFR_RNDN);
+ mpfr_setmax (u, REDUCE_EMAX);
+#endif
+ }
+ else
+ {
+ mpfr_set_si (x, n == 6 ? 1 : -1, MPFR_RNDN);
+ mpfr_setmax (x, REDUCE_EMAX);
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, MPFR_RNDN);
+ mpfr_set_exp (u, REDUCE_EMIN);
+#endif
+ }
+#endif
}
#if defined(ULONG_ARG1) || defined(ULONG_ARG2)
@@ -667,3 +693,4 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
#undef ULONG_ARG2
#undef TEST_FUNCTION
#undef test_generic
+#undef NSPEC