diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2015-05-29 10:19:18 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2015-05-29 10:19:18 +0000 |
commit | 1dda6f3270c62d40dc6faff877c08ab935d2a138 (patch) | |
tree | 886bbee077f0697a892aa23a7814f1c6f087d4ce /tests/tgeneric.c | |
parent | b8b853306f903fe8e2806a3ed29fb7fa53b31f34 (diff) | |
download | mpfr-1dda6f3270c62d40dc6faff877c08ab935d2a138.tar.gz |
[tests] Added always_scale argument (boolean) to tests_default_random()
so that when it is true, scaling is always performed on random numbers
generated by mpfr_urandomb(), instead of preferring numbers of the order
of magnitude of 1 for half outputs. This will be useful for mpfr_rint_*
tests.
For tgeneric.c, the value of this argument is controlled by a new macro
TEST_RANDOM_ALWAYS_SCALE (0 by default, which corresponds to the current
behavior). For the other tests that call tests_default_random(), the
argument is set to 0, so that the behavior remains the same.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@9471 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tgeneric.c')
-rw-r--r-- | tests/tgeneric.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/tgeneric.c b/tests/tgeneric.c index da2f33dd2..31f9f247d 100644 --- a/tests/tgeneric.c +++ b/tests/tgeneric.c @@ -43,6 +43,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #define TEST_RANDOM_EMAX 255 #endif +#ifndef TEST_RANDOM_ALWAYS_SCALE +#define TEST_RANDOM_ALWAYS_SCALE 0 +#endif + /* If the MPFR_SUSPICIOUS_OVERFLOW test fails but this is not a bug, then define TGENERIC_SO_TEST with an adequate test (possibly 0) to omit this particular case. */ @@ -182,10 +186,12 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) #endif #else tests_default_random (x, TEST_RANDOM_POS, - TEST_RANDOM_EMIN, TEST_RANDOM_EMAX); + TEST_RANDOM_EMIN, TEST_RANDOM_EMAX, + TEST_RANDOM_ALWAYS_SCALE); #if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) tests_default_random (u, TEST_RANDOM_POS2, - TEST_RANDOM_EMIN, TEST_RANDOM_EMAX); + TEST_RANDOM_EMIN, TEST_RANDOM_EMAX, + TEST_RANDOM_ALWAYS_SCALE); #endif #endif } @@ -497,6 +503,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) #undef TEST_RANDOM_POS2 #undef TEST_RANDOM_EMIN #undef TEST_RANDOM_EMAX +#undef TEST_RANDOM_ALWAYS_SCALE #undef RAND_FUNCTION #undef TWO_ARGS #undef TWO_ARGS_UI |