diff options
Diffstat (limited to 'tests/tset_z.c')
-rw-r--r-- | tests/tset_z.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/tests/tset_z.c b/tests/tset_z.c index f0f49f5fc..afdc971a6 100644 --- a/tests/tset_z.c +++ b/tests/tset_z.c @@ -1,6 +1,6 @@ /* Test file for mpfr_set_z. -Copyright 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +Copyright 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -31,17 +31,18 @@ static void check0(void) mpz_t y; mpfr_t x; int inexact, r; + /* Check for +0 */ - mpfr_init(x); - mpz_init(y); - mpz_set_si(y, 0); - for(r = 0 ; r < GMP_RND_MAX ; r++) + mpfr_init (x); + mpz_init (y); + mpz_set_si (y, 0); + for(r = 0; r < GMP_RND_MAX; r++) { - inexact = mpfr_set_z(x, y, r); + inexact = mpfr_set_z (x, y, (mp_rnd_t) r); if (!MPFR_IS_ZERO(x) || !MPFR_IS_POS(x) || inexact) { printf("mpfr_set_z(x,0) failed for %s\n", - mpfr_print_rnd_mode(r)); + mpfr_print_rnd_mode ((mp_rnd_t) r)); exit(1); } } @@ -94,27 +95,27 @@ check_large (void) /* check overflow */ emax = mpfr_get_emax (); - mpfr_set_emax (2); + set_emax (2); mpz_set_str (z, "7", 10); mpfr_set_z (x, z, GMP_RNDU); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); - mpfr_set_emax (3); + set_emax (3); mpfr_set_prec (x, 2); mpz_set_str (z, "7", 10); mpfr_set_z (x, z, GMP_RNDU); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); - mpfr_set_emax (emax); + set_emax (emax); /* check underflow */ emin = mpfr_get_emin (); - mpfr_set_emin (3); + set_emin (3); mpz_set_str (z, "1", 10); mpfr_set_z (x, z, GMP_RNDZ); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x)); - mpfr_set_emin (2); + set_emin (2); mpfr_set_z (x, z, GMP_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x)); - mpfr_set_emin (emin); + set_emin (emin); mpz_clear (z); mpfr_clear (x); @@ -129,11 +130,12 @@ main (int argc, char *argv[]) tests_start_mpfr (); check_large (); - check (0, 0); + check (0, (mp_rnd_t) 0); for (j = 0; j < 200000; j++) - check (randlimb () & LONG_MAX, RND_RAND () ); - check0(); + check (randlimb () & LONG_MAX, (mp_rnd_t) RND_RAND ()); + check0 (); tests_end_mpfr (); + return 0; } |