From d89cd8cbd7a332f0fa34c59333347e805b9a633f Mon Sep 17 00:00:00 2001 From: zimmerma Date: Tue, 24 May 2016 18:46:35 +0000 Subject: added generic tests for mpfr_log_ui + compare with mpfr_log git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10359 280ebfd0-de03-0410-8827-d642c229c3f4 --- tests/tgeneric.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'tests/tgeneric.c') diff --git a/tests/tgeneric.c b/tests/tgeneric.c index a4189826d..78a852115 100644 --- a/tests/tgeneric.c +++ b/tests/tgeneric.c @@ -30,10 +30,16 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., /* TODO: Add support for type long and extreme integer values, as done in tgeneric_ui.c; then tgeneric_ui.c could probably disappear. */ +#ifndef ONE_ARG #if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) || \ defined(ULONG_ARG1) || defined(ULONG_ARG2) #define TWO_ARGS_ALL #endif +#endif + +#if defined(TWO_ARGS_ALL) || defined(ULONG_ARG1) || defined(ULONG_ARG2) +#define NEED_U +#endif #ifndef TEST_RANDOM_POS /* For the random function: one number on two is negative. */ @@ -141,7 +147,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) { mpfr_prec_t prec, xprec, yprec; mpfr_t x, y, z, t, w; -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U mpfr_t u; #endif #if defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) @@ -161,7 +167,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) old_emax = mpfr_get_emax (); mpfr_inits2 (MPFR_PREC_MIN, x, y, z, t, w, (mpfr_ptr) 0); -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U mpfr_init2 (u, MPFR_PREC_MIN); #endif @@ -319,6 +325,8 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) compare = TEST_FUNCTION (y, x, d, rnd); /* d can be infinite due to overflow in mpfr_get_d */ infinite_input |= DOUBLE_ISINF (d); +#elif defined(ULONG_ARG1) && defined(ONE_ARG) + compare = TEST_FUNCTION (y, i, rnd); #elif defined(ULONG_ARG1) compare = TEST_FUNCTION (y, i, x, rnd); #elif defined(ULONG_ARG2) @@ -381,6 +389,8 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) inexact = TEST_FUNCTION (w, d, x, rnd); #elif defined(DOUBLE_ARG2) inexact = TEST_FUNCTION (w, x, d, rnd); +#elif defined(ULONG_ARG1) && defined(ONE_ARG) + inexact = TEST_FUNCTION (w, i, rnd); #elif defined(ULONG_ARG1) inexact = TEST_FUNCTION (w, i, x, rnd); #elif defined(ULONG_ARG2) @@ -400,7 +410,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) (mpfr_eexp_t) oemin, (mpfr_eexp_t) e - 1); printf ("x = "); mpfr_dump (x); -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U printf ("u = "); mpfr_dump (u); #endif @@ -429,6 +439,8 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) inexact = TEST_FUNCTION (w, d, x, rnd); #elif defined(DOUBLE_ARG2) inexact = TEST_FUNCTION (w, x, d, rnd); +#elif defined(ULONG_ARG1) && defined(ONE_ARG) + inexact = TEST_FUNCTION (w, i, rnd); #elif defined(ULONG_ARG1) inexact = TEST_FUNCTION (w, i, x, rnd); #elif defined(ULONG_ARG2) @@ -448,7 +460,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) (mpfr_eexp_t) e + 1, (mpfr_eexp_t) oemax); printf ("x = "); mpfr_dump (x); -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U printf ("u = "); mpfr_dump (u); #endif @@ -492,6 +504,8 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) inexact = TEST_FUNCTION (w, d, x, rnd); #elif defined(DOUBLE_ARG2) inexact = TEST_FUNCTION (w, x, d, rnd); +#elif defined(ULONG_ARG1) && defined(ONE_ARG) + inexact = TEST_FUNCTION (w, i, rnd); #elif defined(ULONG_ARG1) inexact = TEST_FUNCTION (w, i, x, rnd); #elif defined(ULONG_ARG2) @@ -512,7 +526,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) (mpfr_eexp_t) emin, (mpfr_eexp_t) emax); printf ("x = "); mpfr_dump (x); -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U printf ("u = "); mpfr_dump (u); #endif @@ -601,6 +615,8 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) inexact = TEST_FUNCTION (z, d, x, rnd); #elif defined(DOUBLE_ARG2) inexact = TEST_FUNCTION (z, x, d, rnd); +#elif defined(ULONG_ARG1) && defined(ONE_ARG) + inexact = TEST_FUNCTION (z, i, rnd); #elif defined(ULONG_ARG1) inexact = TEST_FUNCTION (z, i, x, rnd); #elif defined(ULONG_ARG2) @@ -615,7 +631,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) printf ("tgeneric: results differ for " MAKE_STR(TEST_FUNCTION) " on\n x = "); mpfr_dump (x); -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U printf (" u = "); mpfr_dump (u); #endif @@ -642,7 +658,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) "\n", mpfr_print_rnd_mode (rnd), compare, inexact); printf ("x = "); mpfr_dump (x); -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U printf ("u = "); mpfr_dump (u); #endif @@ -668,7 +684,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) mpfr_print_rnd_mode (rnd)); printf ("x = "); mpfr_dump (x); -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U printf ("u = "); mpfr_dump (u); #endif @@ -691,7 +707,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) #endif mpfr_clears (x, y, z, t, w, (mpfr_ptr) 0); -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U mpfr_clear (u); #endif } @@ -704,6 +720,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) #undef RAND_FUNCTION #undef TWO_ARGS #undef TWO_ARGS_ALL +#undef NEED_U #undef DOUBLE_ARG1 #undef DOUBLE_ARG2 #undef ULONG_ARG1 -- cgit v1.2.1