diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2010-05-19 22:41:29 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2010-05-19 22:41:29 +0000 |
commit | e92c598aa9a76ef3fdb660f8499fed36a081632b (patch) | |
tree | d93c5ea0b4ac0fe90f9676b345b7706aa755c944 /tests | |
parent | f5c090f68bf52ca7a6af24ec0a7996dd50feb17d (diff) | |
download | mpfr-e92c598aa9a76ef3fdb660f8499fed36a081632b.tar.gz |
Type corrections for C++ compilers (in particular, mpfr_rnd_t vs int).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6825 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r-- | tests/texceptions.c | 3 | ||||
-rw-r--r-- | tests/tget_f.c | 14 | ||||
-rw-r--r-- | tests/tmodf.c | 2 | ||||
-rw-r--r-- | tests/tpow_all.c | 9 | ||||
-rw-r--r-- | tests/turandom.c | 6 |
5 files changed, 18 insertions, 16 deletions
diff --git a/tests/texceptions.c b/tests/texceptions.c index 9d168a0ce..8f7107d0c 100644 --- a/tests/texceptions.c +++ b/tests/texceptions.c @@ -53,7 +53,8 @@ check_default_rnd (void) t = (mpfr_get_default_rounding_mode) (); if ((mpfr_rnd_t) r != t) { - printf ("%s %s\n", mpfr_print_rnd_mode (r), mpfr_print_rnd_mode (t)); + printf ("%s %s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) r), + mpfr_print_rnd_mode (t)); ERROR("ERROR in setting / getting default rounding mode (1)"); } } diff --git a/tests/tget_f.c b/tests/tget_f.c index 6f59022ad..37add1c85 100644 --- a/tests/tget_f.c +++ b/tests/tget_f.c @@ -170,7 +170,7 @@ static void ternary_test (void) { int prec; - mpfr_rnd_t rnd; + int rnd; int inex, expected_inex; mpf_t x; mpfr_t y; @@ -189,12 +189,12 @@ ternary_test (void) RND_LOOP (rnd) { - inex = mpfr_get_f (x, y, rnd); + inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd); if (inex != 0 || mpfr_cmp_f (y, x) !=0) { printf ("Error in mpfr_get_f (x, y, %s)\nx = ", - mpfr_print_rnd_mode (rnd)); + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); mpf_out_str (stdout, 2, 0, x); printf ("\ny = "); mpfr_dump (y); @@ -220,13 +220,13 @@ ternary_test (void) expected_inex = -1; } - inex = mpfr_get_f (x, y, rnd); + inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd); if (! SAME_SIGN (expected_inex, inex) || SAME_SIGN (expected_inex, mpfr_cmp_f (y, x))) { printf ("Error in mpfr_get_f (x, y, %s)\nx = ", - mpfr_print_rnd_mode (rnd)); + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); mpf_out_str (stdout, 2, 0, x); printf ("\ny = "); mpfr_dump (y); @@ -243,12 +243,12 @@ ternary_test (void) RND_LOOP (rnd) { - inex = mpfr_get_f (x, y, rnd); + inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd); if (! SAME_SIGN (inex, -mpfr_cmp_f (y, x))) { printf ("Error in mpfr_get_f (x, y, %s)\nx = ", - mpfr_print_rnd_mode (rnd)); + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); mpf_out_str (stdout, 2, 0, x); printf ("\ny = "); mpfr_dump (y); diff --git a/tests/tmodf.c b/tests/tmodf.c index 92d1574f3..4a78b9786 100644 --- a/tests/tmodf.c +++ b/tests/tmodf.c @@ -118,7 +118,7 @@ check_special_exprange (void) mpfr_set_str (x, "0.11111111", 2, MPFR_RNDN); for (ov = 0; ov <= 1; ov++) { - char *s = ov ? "@Inf@" : "1"; + const char *s = ov ? "@Inf@" : "1"; if (ov) set_emax (0); diff --git a/tests/tpow_all.c b/tests/tpow_all.c index 162f0d59a..52fb03dbc 100644 --- a/tests/tpow_all.c +++ b/tests/tpow_all.c @@ -699,15 +699,16 @@ overflow_inv (void) if (rnd == MPFR_RNDA) rnd2 = s < 0 ? MPFR_RNDD : MPFR_RNDU; else - rnd2 = rnd; + rnd2 = (mpfr_rnd_t) rnd; overflow = t == 0 || - ((mpfr_rnd_t) rnd == MPFR_RNDN && (precx > 10 || t == 1)) || - ((mpfr_rnd_t) rnd2 == (s < 0 ? MPFR_RNDD : MPFR_RNDU) && + ((mpfr_rnd_t) rnd == MPFR_RNDN && + (precx > 10 || t == 1)) || + (rnd2 == (s < 0 ? MPFR_RNDD : MPFR_RNDU) && (precx > 10 || t <= 2)); inf = overflow && ((mpfr_rnd_t) rnd == MPFR_RNDN || - (mpfr_rnd_t) rnd2 == (s < 0 ? MPFR_RNDD : MPFR_RNDU)); + rnd2 == (s < 0 ? MPFR_RNDD : MPFR_RNDU)); mpfr_clear_flags (); inex = mpfr_pow (z, x, y, (mpfr_rnd_t) rnd); if (overflow ^ !! mpfr_overflow_p ()) diff --git a/tests/turandom.c b/tests/turandom.c index 21f4e0b4f..196d82d4c 100644 --- a/tests/turandom.c +++ b/tests/turandom.c @@ -160,7 +160,7 @@ main (int argc, char *argv[]) long nbtests; mpfr_prec_t prec; int verbose = 0; - mpfr_rnd_t rnd; + int rnd; long bit_index; tests_start_mpfr (); @@ -197,11 +197,11 @@ main (int argc, char *argv[]) RND_LOOP(rnd) { - test_urandom (nbtests, prec, rnd, bit_index, verbose); + test_urandom (nbtests, prec, (mpfr_rnd_t) rnd, bit_index, verbose); if (argc == 1) /* check also small precision */ { - test_urandom (nbtests, 2, rnd, -1, 0); + test_urandom (nbtests, 2, (mpfr_rnd_t) rnd, -1, 0); } } |