summaryrefslogtreecommitdiff
path: root/tests/tpow_z.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2007-11-17 09:59:19 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2007-11-17 09:59:19 +0000
commit5c2992320912750e020620ef8d52039d7f65a617 (patch)
treeeb253688569ee1649ea60be820d0be0af392e094 /tests/tpow_z.c
parent0a4ea5356442f845fc7ec79bf9f5646e9ba69295 (diff)
downloadmpfr-5c2992320912750e020620ef8d52039d7f65a617.tar.gz
got rid of mpfr_init_gmp_rand/MPFR_TEST_USE_RANDS and not-reentrant gmp
random functions (mpn_random*, mpz_random*, mpf_random*). Now all tests use either RANDS (which is cleared by tests_rand_end called by tests_end_mpfr), or the gmp_randstate_t mechanism. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4953 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tpow_z.c')
-rw-r--r--tests/tpow_z.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/tpow_z.c b/tests/tpow_z.c
index 16050ff0d..20beb97bb 100644
--- a/tests/tpow_z.c
+++ b/tests/tpow_z.c
@@ -22,6 +22,7 @@ MA 02110-1301, USA. */
#include <stdlib.h>
#include <float.h>
+#include <time.h>
#include <math.h>
#include "mpfr-test.h"
@@ -146,6 +147,10 @@ check_integer (mp_prec_t begin, mp_prec_t end, unsigned long max)
mp_prec_t p;
int res1, res2;
mp_rnd_t rnd;
+ gmp_randstate_t state;
+
+ gmp_randinit (state, GMP_RAND_ALG_LC, 128);
+ gmp_randseed_ui (state, time(NULL));
mpfr_inits2 (begin, x, y1, y2, (void *) 0);
mpz_init (z);
@@ -156,7 +161,9 @@ check_integer (mp_prec_t begin, mp_prec_t end, unsigned long max)
mpfr_set_prec (y2, p);
for (i = 0 ; i < max ; i++)
{
- mpz_random (z, (i&1) == 0 ? -1 : 1);
+ mpz_urandomb (z, state, GMP_NUMB_BITS);
+ if ((i & 1) != 0)
+ mpz_neg (z, z);
mpfr_random (x);
mpfr_mul_2ui (x, x, 1, GMP_RNDN); /* 0 <= x < 2 */
rnd = (mp_rnd_t) RND_RAND ();
@@ -189,6 +196,7 @@ check_integer (mp_prec_t begin, mp_prec_t end, unsigned long max)
} /* for i */
} /* for p */
mpfr_clears (x, y1, y2, (void *) 0);
+ gmp_randclear (state);
mpz_clear (z);
}
@@ -257,7 +265,6 @@ bug20071104 (void)
int
main (void)
{
- MPFR_TEST_USE_RANDS ();
tests_start_mpfr ();
check_special ();