summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2008-06-09 16:21:34 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2008-06-09 16:21:34 +0000
commit848beb58ea198fd097580c88aad2e3a1710ea2f6 (patch)
tree818bc126517334c30221369a1182e6dbf3dd6fd7 /tests
parentf4f81f4b9304078e5d484c52209031391c57bb03 (diff)
downloadmpfr-848beb58ea198fd097580c88aad2e3a1710ea2f6.tar.gz
Clean-up and various changes to be able to build MPFR with g++.
But the following 3 tests currently fail with g++ 4.3.1: FAIL: tprintf FAIL: tsprintf FAIL: tfprintf This is an "Illegal instruction" error, so probably a bug in g++. [Edit: acinclude.m4 now uses gl_SIZE_MAX, typically from size_max.m4, but which is not installed on all machines; this will be added to the MPFR repository in changesets 5680 and 5683.] git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5385 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r--tests/mpfr-test.h11
-rw-r--r--tests/reuse.c184
-rw-r--r--tests/tabs.c26
-rw-r--r--tests/tadd.c6
-rw-r--r--tests/tconst_log2.c2
-rw-r--r--tests/tcos.c12
-rw-r--r--tests/tcot.c10
-rw-r--r--tests/tcoth.c10
-rw-r--r--tests/tdiv.c4
-rw-r--r--tests/tests.c8
-rw-r--r--tests/texp.c14
-rw-r--r--tests/texp10.c12
-rw-r--r--tests/texp2.c12
-rw-r--r--tests/tfactorial.c12
-rw-r--r--tests/tfma.c44
-rw-r--r--tests/tfms.c44
-rw-r--r--tests/tgeneric.c2
-rw-r--r--tests/tgeneric_ui.c2
-rw-r--r--tests/tget_str.c2
-rw-r--r--tests/tgmpop.c6
-rw-r--r--tests/thypot.c4
-rw-r--r--tests/tinternals.c9
-rw-r--r--tests/tlgamma.c2
-rw-r--r--tests/tmul.c4
-rw-r--r--tests/tout_str.c7
-rw-r--r--tests/tpow.c2
-rw-r--r--tests/tpow3.c2
-rw-r--r--tests/tpow_z.c2
-rw-r--r--tests/tprintf.c2
-rw-r--r--tests/tsec.c12
-rw-r--r--tests/tsech.c12
-rw-r--r--tests/tset_f.c2
-rw-r--r--tests/tset_si.c6
-rw-r--r--tests/tset_str.c10
-rw-r--r--tests/tset_z.c2
-rw-r--r--tests/tsin.c2
-rw-r--r--tests/tsin_cos.c16
-rw-r--r--tests/tsqrt.c2
-rw-r--r--tests/tstckintc.c9
-rw-r--r--tests/tsub.c4
-rw-r--r--tests/tsubnormal.c2
-rw-r--r--tests/tui_div.c2
-rw-r--r--tests/tui_pow.c2
-rw-r--r--tests/tzeta_ui.c3
44 files changed, 282 insertions, 261 deletions
diff --git a/tests/mpfr-test.h b/tests/mpfr-test.h
index f76cd3dbb..87b2e2642 100644
--- a/tests/mpfr-test.h
+++ b/tests/mpfr-test.h
@@ -35,7 +35,7 @@ MA 02110-1301, USA. */
#define MAXNORM 1.7976931348623157081e308 /* 2^(1023)*(2-2^(-52)) */
/* Generates a random rounding mode */
-#define RND_RAND() (randlimb() % GMP_RND_MAX)
+#define RND_RAND() ((mp_rnd_t) (randlimb() % GMP_RND_MAX))
/* Generates a random sign */
#define SIGN_RAND() ( (randlimb()%2) ? MPFR_SIGN_POS : MPFR_SIGN_NEG)
@@ -54,6 +54,8 @@ MA 02110-1301, USA. */
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define ABS(x) (((x)>0) ? (x) : -(x))
+#define FLIST mpfr_ptr, mpfr_srcptr, mp_rnd_t
+
#if defined (__cplusplus)
extern "C" {
#endif
@@ -81,9 +83,10 @@ FILE *src_fopen _MPFR_PROTO ((const char *, const char *));
void set_emin _MPFR_PROTO ((mp_exp_t));
void set_emax _MPFR_PROTO ((mp_exp_t));
void tests_default_random _MPFR_PROTO ((mpfr_ptr, int, mp_exp_t, mp_exp_t));
-void data_check _MPFR_PROTO ((char *, int (*) (), char *));
-void bad_cases _MPFR_PROTO ((int (*)(), int (*)(), char *, int, mp_exp_t,
- mp_exp_t, mp_prec_t, mp_prec_t, mp_prec_t, int));
+void data_check _MPFR_PROTO ((char *, int (*) (FLIST), char *));
+void bad_cases _MPFR_PROTO ((int (*)(FLIST), int (*)(FLIST),
+ char *, int, mp_exp_t, mp_exp_t,
+ mp_prec_t, mp_prec_t, mp_prec_t, int));
int mpfr_cmp_str _MPFR_PROTO ((mpfr_srcptr x, const char *, int, mp_rnd_t));
#define mpfr_cmp_str1(x,s) mpfr_cmp_str(x,s,10,GMP_RNDN)
diff --git a/tests/reuse.c b/tests/reuse.c
index b7b124851..2e6891a6e 100644
--- a/tests/reuse.c
+++ b/tests/reuse.c
@@ -519,7 +519,7 @@ reldiff_wrapper (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
int
main (void)
{
- mp_rnd_t rnd;
+ int rnd;
mp_prec_t p;
tests_start_mpfr ();
@@ -531,99 +531,99 @@ main (void)
test2a (mpfr_floor, "mpfr_floor", p);
test2a (mpfr_trunc, "mpfr_trunc", p);
- test2ui (mpfr_add_ui, "mpfr_add_ui", p, rnd);
- test2ui (mpfr_div_2exp, "mpfr_div_2exp", p, rnd);
- test2ui (mpfr_div_ui, "mpfr_div_ui", p, rnd);
- test2ui (mpfr_mul_2exp, "mpfr_mul_2exp", p, rnd);
- test2ui (mpfr_mul_ui, "mpfr_mul_ui", p, rnd);
- test2ui (mpfr_pow_ui, "mpfr_pow_ui", p, rnd);
- test2ui (mpfr_sub_ui, "mpfr_sub_ui", p, rnd);
-
- testui2 (mpfr_ui_div, "mpfr_ui_div", p, rnd);
- testui2 (mpfr_ui_sub, "mpfr_ui_sub", p, rnd);
- testui2 (mpfr_ui_pow, "mpfr_ui_pow", p, rnd);
-
- test2 (mpfr_sqr, "mpfr_sqr", p, rnd);
- test2 (mpfr_sqrt, "mpfr_sqrt", p, rnd);
- test2 (mpfr_abs, "mpfr_abs", p, rnd);
- test2 (mpfr_neg, "mpfr_neg", p, rnd);
-
- test2 (mpfr_log, "mpfr_log", p, rnd);
- test2 (mpfr_log2, "mpfr_log2", p, rnd);
- test2 (mpfr_log10, "mpfr_log10", p, rnd);
- test2 (mpfr_log1p, "mpfr_log1p", p, rnd);
-
- test2 (mpfr_exp, "mpfr_exp", p, rnd);
- test2 (mpfr_exp2, "mpfr_exp2", p, rnd);
- test2 (mpfr_exp10, "mpfr_exp10", p, rnd);
- test2 (mpfr_expm1, "mpfr_expm1", p, rnd);
- test2 (mpfr_eint, "mpfr_eint", p, rnd);
-
- test2 (mpfr_sinh, "mpfr_sinh", p, rnd);
- test2 (mpfr_cosh, "mpfr_cosh", p, rnd);
- test2 (mpfr_tanh, "mpfr_tanh", p, rnd);
- test2 (mpfr_asinh, "mpfr_asinh", p, rnd);
- test2 (mpfr_acosh, "mpfr_acosh", p, rnd);
- test2 (mpfr_atanh, "mpfr_atanh", p, rnd);
- test2 (mpfr_sech, "mpfr_sech", p, rnd);
- test2 (mpfr_csch, "mpfr_csch", p, rnd);
- test2 (mpfr_coth, "mpfr_coth", p, rnd);
-
- test2 (mpfr_asin, "mpfr_asin", p, rnd);
- test2 (mpfr_acos, "mpfr_acos", p, rnd);
- test2 (mpfr_atan, "mpfr_atan", p, rnd);
- test2 (mpfr_cos, "mpfr_cos", p, rnd);
- test2 (mpfr_sin, "mpfr_sin", p, rnd);
- test2 (mpfr_tan, "mpfr_tan", p, rnd);
- test2 (mpfr_sec, "mpfr_sec", p, rnd);
- test2 (mpfr_csc, "mpfr_csc", p, rnd);
- test2 (mpfr_cot, "mpfr_cot", p, rnd);
-
- test2 (mpfr_erf, "mpfr_erf", p, rnd);
- test2 (mpfr_erfc, "mpfr_erfc", p, rnd);
- test2 (mpfr_j0, "mpfr_j0", p, rnd);
- test2 (mpfr_j1, "mpfr_j1", p, rnd);
- test2 (mpfr_y0, "mpfr_y0", p, rnd);
- test2 (mpfr_y1, "mpfr_y1", p, rnd);
- test2 (mpfr_zeta, "mpfr_zeta", p, rnd);
- test2 (mpfr_gamma, "mpfr_gamma", p, rnd);
- test2 (mpfr_lngamma, "mpfr_lngamma", p, rnd);
-
- test2 (mpfr_rint, "mpfr_rint", p, rnd);
- test2 (mpfr_rint_ceil, "mpfr_rint_ceil", p, rnd);
- test2 (mpfr_rint_floor, "mpfr_rint_floor", p, rnd);
- test2 (mpfr_rint_round, "mpfr_rint_round", p, rnd);
- test2 (mpfr_rint_trunc, "mpfr_rint_trunc", p, rnd);
- test2 (mpfr_frac, "mpfr_frac", p, rnd);
-
- test3 (mpfr_add, "mpfr_add", p, rnd);
- test3 (mpfr_sub, "mpfr_sub", p, rnd);
- test3 (mpfr_mul, "mpfr_mul", p, rnd);
- test3 (mpfr_div, "mpfr_div", p, rnd);
-
- test3 (mpfr_agm, "mpfr_agm", p, rnd);
- test3 (mpfr_min, "mpfr_min", p, rnd);
- test3 (mpfr_max, "mpfr_max", p, rnd);
-
- test3 (reldiff_wrapper, "mpfr_reldiff", p, rnd);
- test3 (mpfr_dim, "mpfr_dim", p, rnd);
-
- test3 (mpfr_remainder, "mpfr_remainder", p, rnd);
- test3 (mpfr_pow, "mpfr_pow", p, rnd);
- test3 (mpfr_atan2, "mpfr_atan2", p, rnd);
- test3 (mpfr_hypot, "mpfr_hypot", p, rnd);
-
- test3a (mpfr_sin_cos, "mpfr_sin_cos", p, rnd);
-
- test4 (mpfr_fma, "mpfr_fma", p, rnd);
- test4 (mpfr_fms, "mpfr_fms", p, rnd);
+ test2ui (mpfr_add_ui, "mpfr_add_ui", p, (mp_rnd_t) rnd);
+ test2ui (mpfr_div_2exp, "mpfr_div_2exp", p, (mp_rnd_t) rnd);
+ test2ui (mpfr_div_ui, "mpfr_div_ui", p, (mp_rnd_t) rnd);
+ test2ui (mpfr_mul_2exp, "mpfr_mul_2exp", p, (mp_rnd_t) rnd);
+ test2ui (mpfr_mul_ui, "mpfr_mul_ui", p, (mp_rnd_t) rnd);
+ test2ui (mpfr_pow_ui, "mpfr_pow_ui", p, (mp_rnd_t) rnd);
+ test2ui (mpfr_sub_ui, "mpfr_sub_ui", p, (mp_rnd_t) rnd);
+
+ testui2 (mpfr_ui_div, "mpfr_ui_div", p, (mp_rnd_t) rnd);
+ testui2 (mpfr_ui_sub, "mpfr_ui_sub", p, (mp_rnd_t) rnd);
+ testui2 (mpfr_ui_pow, "mpfr_ui_pow", p, (mp_rnd_t) rnd);
+
+ test2 (mpfr_sqr, "mpfr_sqr", p, (mp_rnd_t) rnd);
+ test2 (mpfr_sqrt, "mpfr_sqrt", p, (mp_rnd_t) rnd);
+ test2 (mpfr_abs, "mpfr_abs", p, (mp_rnd_t) rnd);
+ test2 (mpfr_neg, "mpfr_neg", p, (mp_rnd_t) rnd);
+
+ test2 (mpfr_log, "mpfr_log", p, (mp_rnd_t) rnd);
+ test2 (mpfr_log2, "mpfr_log2", p, (mp_rnd_t) rnd);
+ test2 (mpfr_log10, "mpfr_log10", p, (mp_rnd_t) rnd);
+ test2 (mpfr_log1p, "mpfr_log1p", p, (mp_rnd_t) rnd);
+
+ test2 (mpfr_exp, "mpfr_exp", p, (mp_rnd_t) rnd);
+ test2 (mpfr_exp2, "mpfr_exp2", p, (mp_rnd_t) rnd);
+ test2 (mpfr_exp10, "mpfr_exp10", p, (mp_rnd_t) rnd);
+ test2 (mpfr_expm1, "mpfr_expm1", p, (mp_rnd_t) rnd);
+ test2 (mpfr_eint, "mpfr_eint", p, (mp_rnd_t) rnd);
+
+ test2 (mpfr_sinh, "mpfr_sinh", p, (mp_rnd_t) rnd);
+ test2 (mpfr_cosh, "mpfr_cosh", p, (mp_rnd_t) rnd);
+ test2 (mpfr_tanh, "mpfr_tanh", p, (mp_rnd_t) rnd);
+ test2 (mpfr_asinh, "mpfr_asinh", p, (mp_rnd_t) rnd);
+ test2 (mpfr_acosh, "mpfr_acosh", p, (mp_rnd_t) rnd);
+ test2 (mpfr_atanh, "mpfr_atanh", p, (mp_rnd_t) rnd);
+ test2 (mpfr_sech, "mpfr_sech", p, (mp_rnd_t) rnd);
+ test2 (mpfr_csch, "mpfr_csch", p, (mp_rnd_t) rnd);
+ test2 (mpfr_coth, "mpfr_coth", p, (mp_rnd_t) rnd);
+
+ test2 (mpfr_asin, "mpfr_asin", p, (mp_rnd_t) rnd);
+ test2 (mpfr_acos, "mpfr_acos", p, (mp_rnd_t) rnd);
+ test2 (mpfr_atan, "mpfr_atan", p, (mp_rnd_t) rnd);
+ test2 (mpfr_cos, "mpfr_cos", p, (mp_rnd_t) rnd);
+ test2 (mpfr_sin, "mpfr_sin", p, (mp_rnd_t) rnd);
+ test2 (mpfr_tan, "mpfr_tan", p, (mp_rnd_t) rnd);
+ test2 (mpfr_sec, "mpfr_sec", p, (mp_rnd_t) rnd);
+ test2 (mpfr_csc, "mpfr_csc", p, (mp_rnd_t) rnd);
+ test2 (mpfr_cot, "mpfr_cot", p, (mp_rnd_t) rnd);
+
+ test2 (mpfr_erf, "mpfr_erf", p, (mp_rnd_t) rnd);
+ test2 (mpfr_erfc, "mpfr_erfc", p, (mp_rnd_t) rnd);
+ test2 (mpfr_j0, "mpfr_j0", p, (mp_rnd_t) rnd);
+ test2 (mpfr_j1, "mpfr_j1", p, (mp_rnd_t) rnd);
+ test2 (mpfr_y0, "mpfr_y0", p, (mp_rnd_t) rnd);
+ test2 (mpfr_y1, "mpfr_y1", p, (mp_rnd_t) rnd);
+ test2 (mpfr_zeta, "mpfr_zeta", p, (mp_rnd_t) rnd);
+ test2 (mpfr_gamma, "mpfr_gamma", p, (mp_rnd_t) rnd);
+ test2 (mpfr_lngamma, "mpfr_lngamma", p, (mp_rnd_t) rnd);
+
+ test2 (mpfr_rint, "mpfr_rint", p, (mp_rnd_t) rnd);
+ test2 (mpfr_rint_ceil, "mpfr_rint_ceil", p, (mp_rnd_t) rnd);
+ test2 (mpfr_rint_floor, "mpfr_rint_floor", p, (mp_rnd_t) rnd);
+ test2 (mpfr_rint_round, "mpfr_rint_round", p, (mp_rnd_t) rnd);
+ test2 (mpfr_rint_trunc, "mpfr_rint_trunc", p, (mp_rnd_t) rnd);
+ test2 (mpfr_frac, "mpfr_frac", p, (mp_rnd_t) rnd);
+
+ test3 (mpfr_add, "mpfr_add", p, (mp_rnd_t) rnd);
+ test3 (mpfr_sub, "mpfr_sub", p, (mp_rnd_t) rnd);
+ test3 (mpfr_mul, "mpfr_mul", p, (mp_rnd_t) rnd);
+ test3 (mpfr_div, "mpfr_div", p, (mp_rnd_t) rnd);
+
+ test3 (mpfr_agm, "mpfr_agm", p, (mp_rnd_t) rnd);
+ test3 (mpfr_min, "mpfr_min", p, (mp_rnd_t) rnd);
+ test3 (mpfr_max, "mpfr_max", p, (mp_rnd_t) rnd);
+
+ test3 (reldiff_wrapper, "mpfr_reldiff", p, (mp_rnd_t) rnd);
+ test3 (mpfr_dim, "mpfr_dim", p, (mp_rnd_t) rnd);
+
+ test3 (mpfr_remainder, "mpfr_remainder", p, (mp_rnd_t) rnd);
+ test3 (mpfr_pow, "mpfr_pow", p, (mp_rnd_t) rnd);
+ test3 (mpfr_atan2, "mpfr_atan2", p, (mp_rnd_t) rnd);
+ test3 (mpfr_hypot, "mpfr_hypot", p, (mp_rnd_t) rnd);
+
+ test3a (mpfr_sin_cos, "mpfr_sin_cos", p, (mp_rnd_t) rnd);
+
+ test4 (mpfr_fma, "mpfr_fma", p, (mp_rnd_t) rnd);
+ test4 (mpfr_fms, "mpfr_fms", p, (mp_rnd_t) rnd);
#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
- test2 (mpfr_li2, "mpfr_li2", p, rnd);
- test2 (mpfr_rec_sqrt, "mpfr_rec_sqrt", p, rnd);
- test3 (mpfr_fmod, "mpfr_fmod", p, rnd);
- test3a (mpfr_modf, "mpfr_modf", p, rnd);
- test3a (mpfr_sinh_cosh, "mpfr_sinh_cosh", p, rnd);
+ test2 (mpfr_li2, "mpfr_li2", p, (mp_rnd_t) rnd);
+ test2 (mpfr_rec_sqrt, "mpfr_rec_sqrt", p, (mp_rnd_t) rnd);
+ test3 (mpfr_fmod, "mpfr_fmod", p, (mp_rnd_t) rnd);
+ test3a (mpfr_modf, "mpfr_modf", p, (mp_rnd_t) rnd);
+ test3a (mpfr_sinh_cosh, "mpfr_sinh_cosh", p, (mp_rnd_t) rnd);
#endif
}
diff --git a/tests/tabs.c b/tests/tabs.c
index fc7bfbb15..02978b813 100644
--- a/tests/tabs.c
+++ b/tests/tabs.c
@@ -53,7 +53,7 @@ check_inexact (void)
for (q=2; q<2*p; q++)
{
mpfr_set_prec (y, q);
- for (rnd = 0; rnd < GMP_RND_MAX; rnd++)
+ RND_LOOP (rnd)
{
inexact = mpfr_abs (y, x, (mp_rnd_t) rnd);
cmp = mpfr_cmp (y, absx);
@@ -78,10 +78,10 @@ check_inexact (void)
}
static void
-check_cmp(int argc, char *argv[])
+check_cmp (int argc, char *argv[])
{
mpfr_t x, y;
- int n, k, rnd;
+ int n, k;
mpfr_inits2 (53, x, y, (mpfr_ptr) 0);
@@ -135,18 +135,20 @@ check_cmp(int argc, char *argv[])
n = (argc==1) ? 25000 : atoi(argv[1]);
for (k = 1; k <= n; k++)
{
- int sign = SIGN_RAND();
- mpfr_random(x);
- MPFR_SET_SIGN(x, sign);
- rnd = RND_RAND();
- mpfr_abs(y, x, (mp_rnd_t) rnd);
- MPFR_SET_POS(x);
- if (mpfr_cmp(x,y))
+ mp_rnd_t rnd;
+ int sign = SIGN_RAND ();
+
+ mpfr_random (x);
+ MPFR_SET_SIGN (x, sign);
+ rnd = RND_RAND ();
+ mpfr_abs (y, x, rnd);
+ MPFR_SET_POS (x);
+ if (mpfr_cmp (x, y))
{
printf ("Mismatch for sign=%d and x=", sign);
- mpfr_print_binary(x);
+ mpfr_print_binary (x);
printf ("\nResults=");
- mpfr_print_binary(y);
+ mpfr_print_binary (y);
putchar ('\n');
exit (1);
}
diff --git a/tests/tadd.c b/tests/tadd.c
index 4d5e06d71..0a3d1e887 100644
--- a/tests/tadd.c
+++ b/tests/tadd.c
@@ -532,7 +532,7 @@ check_inexact (void)
abs(EXP(x)-EXP(u)) + max(prec(x), prec(u)) + 1 */
pz = pz + MAX(MPFR_PREC(x), MPFR_PREC(u)) + 1;
mpfr_set_prec (z, pz);
- rnd = (mp_rnd_t) RND_RAND();
+ rnd = RND_RAND ();
if (test_add (z, x, u, rnd))
{
printf ("z <- x + u should be exact\n");
@@ -542,7 +542,7 @@ check_inexact (void)
exit (1);
}
{
- rnd = (mp_rnd_t) RND_RAND();
+ rnd = RND_RAND ();
inexact = test_add (y, x, u, rnd);
cmp = mpfr_cmp (y, z);
if (((inexact == 0) && (cmp != 0)) ||
@@ -718,7 +718,7 @@ check_1111 (void)
test_add (c, c, one, GMP_RNDN);
diff = (randlimb () % (2*m)) - m;
mpfr_mul_2si (c, c, diff, GMP_RNDN);
- rnd_mode = (mp_rnd_t) RND_RAND ();
+ rnd_mode = RND_RAND ();
inex_a = test_add (a, b, c, rnd_mode);
mpfr_init2 (s, MPFR_PREC_MIN + 2*m);
inex_s = test_add (s, b, c, GMP_RNDN); /* exact */
diff --git a/tests/tconst_log2.c b/tests/tconst_log2.c
index 6e3ddeb08..02f22adce 100644
--- a/tests/tconst_log2.c
+++ b/tests/tconst_log2.c
@@ -45,7 +45,7 @@ check (mp_prec_t p0, mp_prec_t p1)
mpfr_set_prec (x, p0);
mpfr_set_prec (y, p0);
{
- rnd = (mp_rnd_t) RND_RAND ();
+ rnd = RND_RAND ();
mpfr_const_log2 (x, rnd);
mpfr_set (y, z, rnd);
if ((dif = mpfr_cmp (x, y))
diff --git a/tests/tcos.c b/tests/tcos.c
index e56db53fb..0043d40c8 100644
--- a/tests/tcos.c
+++ b/tests/tcos.c
@@ -184,13 +184,13 @@ overflowed_cos0 (void)
{
mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN);
mpfr_clear_flags ();
- inex = mpfr_cos (x, x, rnd);
+ inex = mpfr_cos (x, x, (mp_rnd_t) rnd);
if ((i == 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) &&
! mpfr_overflow_p ())
{
printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n"
" The overflow flag is not set.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
@@ -199,13 +199,13 @@ overflowed_cos0 (void)
{
printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n"
" The inexact value must be negative.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! mpfr_equal_p (x, y))
{
printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n"
- " Got ", i, mpfr_print_rnd_mode (rnd));
+ " Got ", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of 0.11111111E%d.\n", emax);
err = 1;
@@ -217,13 +217,13 @@ overflowed_cos0 (void)
{
printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n"
" The inexact value must be positive.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0))
{
printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n"
- " Got ", i, mpfr_print_rnd_mode (rnd));
+ " Got ", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of +Inf.\n");
err = 1;
diff --git a/tests/tcot.c b/tests/tcot.c
index 7720cbdc5..8ac37e4a2 100644
--- a/tests/tcot.c
+++ b/tests/tcot.c
@@ -102,18 +102,18 @@ two2emin (mp_exp_t e)
RND_LOOP (rnd)
{
mpfr_set_si (y, i, GMP_RNDN);
- mpfr_ui_div (y, 1, y, rnd); /* no overflow/underflow */
+ mpfr_ui_div (y, 1, y, (mp_rnd_t) rnd); /* no overflow/underflow */
mpfr_set_si_2exp (x, i, -e, GMP_RNDN);
if (ABS (i) != 3) /* not a power of 2 (not 0 either) */
- mpfr_sub (y, y, x, rnd); /* no overflow/underflow */
+ mpfr_sub (y, y, x, (mp_rnd_t) rnd); /* no overflow/underflow */
mpfr_set_ui_2exp (x, 1, -e, GMP_RNDN);
- mpfr_div (y, y, x, rnd); /* 1/x - SIGN(x).epsilon */
+ mpfr_div (y, y, x, (mp_rnd_t) rnd); /* 1/x - SIGN(x).epsilon */
mpfr_set_si_2exp (x, i, -e, GMP_RNDN);
- mpfr_cot (x, x, rnd);
+ mpfr_cot (x, x, (mp_rnd_t) rnd);
if (! mpfr_equal_p (x, y))
{
printf ("Error in two2emin for i = %d and rnd = %s\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
printf ("Got ");
mpfr_dump (x);
printf ("instead of ");
diff --git a/tests/tcoth.c b/tests/tcoth.c
index 22f517637..999eb41ff 100644
--- a/tests/tcoth.c
+++ b/tests/tcoth.c
@@ -149,13 +149,13 @@ underflowed_cothinf (void)
mpfr_set_inf (x, i);
mpfr_clear_flags ();
set_emin (2); /* 1 is not representable. */
- inex = mpfr_coth (x, x, rnd);
+ inex = mpfr_coth (x, x, (mp_rnd_t) rnd);
set_emin (old_emin);
if (! mpfr_underflow_p ())
{
printf ("Error in underflowed_cothinf (i = %d, rnd = %s):\n"
" The underflow flag is not set.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
mpfr_set_si (y, (i < 0 && rnd == GMP_RNDD) ||
@@ -166,7 +166,7 @@ underflowed_cothinf (void)
MPFR_MULT_SIGN (MPFR_SIGN (x), MPFR_SIGN (y)) > 0))
{
printf ("Error in underflowed_cothinf (i = %d, rnd = %s):\n"
- " Got ", i, mpfr_print_rnd_mode (rnd));
+ " Got ", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of ");
mpfr_print_binary (y);
@@ -178,7 +178,7 @@ underflowed_cothinf (void)
{
printf ("Error in underflowed_cothinf (i = %d, rnd = %s):\n"
" The inexact value must be negative.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if ((rnd == GMP_RNDU ||
@@ -186,7 +186,7 @@ underflowed_cothinf (void)
{
printf ("Error in underflowed_cothinf (i = %d, rnd = %s):\n"
" The inexact value must be positive.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
}
diff --git a/tests/tdiv.c b/tests/tdiv.c
index 05437d16f..6cf099ac9 100644
--- a/tests/tdiv.c
+++ b/tests/tdiv.c
@@ -589,7 +589,7 @@ check_inexact (void)
mpfr_set_prec (y, py);
mpfr_set_prec (z, py + pu);
{
- rnd = (mp_rnd_t) RND_RAND ();
+ rnd = RND_RAND ();
inexact = test_div (y, x, u, rnd);
if (mpfr_mul (z, y, u, rnd))
{
@@ -744,7 +744,7 @@ consistency (void)
mp_prec_t px, py, pz, p;
int inex1, inex2;
- rnd = (mp_rnd_t) RND_RAND ();
+ rnd = RND_RAND ();
px = (randlimb () % 256) + 2;
py = (randlimb () % 128) + 2;
pz = (randlimb () % 256) + 2;
diff --git a/tests/tests.c b/tests/tests.c
index 7ba371d95..b61f7d3ac 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -507,7 +507,7 @@ tests_default_random (mpfr_ptr x, int pos, mp_exp_t emin, mp_exp_t emax)
As examples of use, see the calls to test4rm from the data_check and
bad_cases functions. */
static void
-test4rm (int (*fct) (), mpfr_srcptr x, mpfr_ptr y, mpfr_ptr z,
+test4rm (int (*fct) (FLIST), mpfr_srcptr x, mpfr_ptr y, mpfr_ptr z,
mp_rnd_t rnd, int test_one, char *name)
{
mp_prec_t yprec = MPFR_PREC (y);
@@ -585,7 +585,7 @@ test4rm (int (*fct) (), mpfr_srcptr x, mpfr_ptr y, mpfr_ptr z,
directed rounding mode.
*/
void
-data_check (char *f, int (*foo) (), char *name)
+data_check (char *f, int (*foo) (FLIST), char *name)
{
FILE *fp;
mp_prec_t xprec, yprec;
@@ -597,7 +597,7 @@ data_check (char *f, int (*foo) (), char *name)
fp = fopen (f, "r");
if (fp == NULL)
{
- char *v = MPFR_VERSION_STRING;
+ char *v = (char *) MPFR_VERSION_STRING;
/* In the '-dev' versions, assume that the data file exists and
return an error if the file cannot be opened to make sure
@@ -729,7 +729,7 @@ data_check (char *f, int (*foo) (), char *name)
* pos, emin, emax: arguments for tests_default_random.
*/
void
-bad_cases (int (*fct)(), int (*inv)(), char *name,
+bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name,
int pos, mp_exp_t emin, mp_exp_t emax,
mp_prec_t pymin, mp_prec_t pymax, mp_prec_t psup,
int n)
diff --git a/tests/texp.c b/tests/texp.c
index b7966f1fb..ee1e71d97 100644
--- a/tests/texp.c
+++ b/tests/texp.c
@@ -170,7 +170,7 @@ compare_exp2_exp3 (mp_prec_t p0, mp_prec_t p1)
mpfr_set_prec (y, prec);
mpfr_set_prec (z, prec);
mpfr_random (x);
- rnd = (mp_rnd_t) RND_RAND();
+ rnd = RND_RAND ();
mpfr_exp_2 (y, x, rnd);
mpfr_exp_3 (z, x, rnd);
if (mpfr_cmp (y,z))
@@ -531,13 +531,13 @@ overflowed_exp0 (void)
{
mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN);
mpfr_clear_flags ();
- inex = mpfr_exp (x, x, rnd);
+ inex = mpfr_exp (x, x, (mp_rnd_t) rnd);
if ((i >= 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) &&
! mpfr_overflow_p ())
{
printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n"
" The overflow flag is not set.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
@@ -546,13 +546,13 @@ overflowed_exp0 (void)
{
printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n"
" The inexact value must be negative.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! mpfr_equal_p (x, y))
{
printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n"
- " Got ", i, mpfr_print_rnd_mode (rnd));
+ " Got ", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of 0.11111111E%d.\n", emax);
err = 1;
@@ -564,13 +564,13 @@ overflowed_exp0 (void)
{
printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n"
" The inexact value must be positive.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0))
{
printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n"
- " Got ", i, mpfr_print_rnd_mode (rnd));
+ " Got ", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of +Inf.\n");
err = 1;
diff --git a/tests/texp10.c b/tests/texp10.c
index fb5a66bf3..4dd0120c6 100644
--- a/tests/texp10.c
+++ b/tests/texp10.c
@@ -137,13 +137,13 @@ overfl_exp10_0 (void)
{
mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN);
mpfr_clear_flags ();
- inex = mpfr_exp10 (x, x, rnd);
+ inex = mpfr_exp10 (x, x, (mp_rnd_t) rnd);
if ((i >= 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) &&
! mpfr_overflow_p ())
{
printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n"
" The overflow flag is not set.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
@@ -152,13 +152,13 @@ overfl_exp10_0 (void)
{
printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n"
" The inexact value must be negative.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! mpfr_equal_p (x, y))
{
printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n"
- " Got ", i, mpfr_print_rnd_mode (rnd));
+ " Got ", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of 0.11111111E%d.\n", emax);
err = 1;
@@ -170,13 +170,13 @@ overfl_exp10_0 (void)
{
printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n"
" The inexact value must be positive.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0))
{
printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n"
- " Got ", i, mpfr_print_rnd_mode (rnd));
+ " Got ", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of +Inf.\n");
err = 1;
diff --git a/tests/texp2.c b/tests/texp2.c
index 2c750c401..7b83ffb51 100644
--- a/tests/texp2.c
+++ b/tests/texp2.c
@@ -162,13 +162,13 @@ overflowed_exp2_0 (void)
{
mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN);
mpfr_clear_flags ();
- inex = mpfr_exp2 (x, x, rnd);
+ inex = mpfr_exp2 (x, x, (mp_rnd_t) rnd);
if ((i >= 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) &&
! mpfr_overflow_p ())
{
printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n"
" The overflow flag is not set.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
@@ -177,13 +177,13 @@ overflowed_exp2_0 (void)
{
printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n"
" The inexact value must be negative.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! mpfr_equal_p (x, y))
{
printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n"
- " Got ", i, mpfr_print_rnd_mode (rnd));
+ " Got ", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of 0.11111111E%d.\n", emax);
err = 1;
@@ -195,13 +195,13 @@ overflowed_exp2_0 (void)
{
printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n"
" The inexact value must be positive.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0))
{
printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n"
- " Got ", i, mpfr_print_rnd_mode (rnd));
+ " Got ", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of +Inf.\n");
err = 1;
diff --git a/tests/tfactorial.c b/tests/tfactorial.c
index a1d253da3..476b5c1e8 100644
--- a/tests/tfactorial.c
+++ b/tests/tfactorial.c
@@ -135,12 +135,12 @@ overflowed_fac0 (void)
RND_LOOP (rnd)
{
mpfr_clear_flags ();
- inex = mpfr_fac_ui (x, 0, rnd);
+ inex = mpfr_fac_ui (x, 0, (mp_rnd_t) rnd);
if (! mpfr_overflow_p ())
{
printf ("Error in overflowed_fac0 (rnd = %s):\n"
" The overflow flag is not set.\n",
- mpfr_print_rnd_mode (rnd));
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
@@ -149,13 +149,13 @@ overflowed_fac0 (void)
{
printf ("Error in overflowed_fac0 (rnd = %s):\n"
" The inexact value must be negative.\n",
- mpfr_print_rnd_mode (rnd));
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! mpfr_equal_p (x, y))
{
printf ("Error in overflowed_fac0 (rnd = %s):\n"
- " Got ", mpfr_print_rnd_mode (rnd));
+ " Got ", mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of 0.11111111E0.\n");
err = 1;
@@ -167,13 +167,13 @@ overflowed_fac0 (void)
{
printf ("Error in overflowed_fac0 (rnd = %s):\n"
" The inexact value must be positive.\n",
- mpfr_print_rnd_mode (rnd));
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0))
{
printf ("Error in overflowed_fac0 (rnd = %s):\n"
- " Got ", mpfr_print_rnd_mode (rnd));
+ " Got ", mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of +Inf.\n");
err = 1;
diff --git a/tests/tfma.c b/tests/tfma.c
index 8933902ab..5840167a4 100644
--- a/tests/tfma.c
+++ b/tests/tfma.c
@@ -46,14 +46,14 @@ test_exact (void)
if (mpfr_set_str (a, val[i], 10, GMP_RNDN) ||
mpfr_set_str (b, val[j], 10, GMP_RNDN) ||
mpfr_set_str (c, val[k], 10, GMP_RNDN) ||
- mpfr_mul (r1, a, b, rnd) ||
- mpfr_add (r1, r1, c, rnd))
+ mpfr_mul (r1, a, b, (mp_rnd_t) rnd) ||
+ mpfr_add (r1, r1, c, (mp_rnd_t) rnd))
{
printf ("test_exact internal error for (%d,%d,%d,%d)\n",
i, j, k, rnd);
exit (1);
}
- if (mpfr_fma (r2, a, b, c, rnd))
+ if (mpfr_fma (r2, a, b, c, (mp_rnd_t) rnd))
{
printf ("test_exact(%d,%d,%d,%d): mpfr_fma should be exact\n",
i, j, k, rnd);
@@ -139,36 +139,37 @@ test_overflow2 (void)
mpfr_clear_flags ();
/* One has: x * y = -1@emax exactly (but not representable). */
- inex = mpfr_fma (r, x, y, z, rnd);
+ inex = mpfr_fma (r, x, y, z, (mp_rnd_t) rnd);
if (overflow ^ (mpfr_overflow_p () != 0))
{
printf ("Error in test_overflow2 (i = %d, %s): wrong overflow"
- " flag (should be %d)\n", i, mpfr_print_rnd_mode (rnd),
- overflow);
+ " flag (should be %d)\n", i,
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd), overflow);
err = 1;
}
if (mpfr_nanflag_p ())
{
printf ("Error in test_overflow2 (i = %d, %s): NaN flag should"
- " not be set\n", i, mpfr_print_rnd_mode (rnd));
+ " not be set\n", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (mpfr_nan_p (r))
{
printf ("Error in test_overflow2 (i = %d, %s): got NaN\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
else if (MPFR_SIGN (r) >= 0)
{
printf ("Error in test_overflow2 (i = %d, %s): wrong sign "
- "(+ instead of -)\n", i, mpfr_print_rnd_mode (rnd));
+ "(+ instead of -)\n", i,
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
else if (inf && ! mpfr_inf_p (r))
{
printf ("Error in test_overflow2 (i = %d, %s): expected -Inf,"
- " got\n", i, mpfr_print_rnd_mode (rnd));
+ " got\n", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_dump (r);
err = 1;
}
@@ -176,14 +177,15 @@ test_overflow2 (void)
(mpfr_nextbelow (r), ! mpfr_inf_p (r))))
{
printf ("Error in test_overflow2 (i = %d, %s): expected -MAX,"
- " got\n", i, mpfr_print_rnd_mode (rnd));
+ " got\n", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_dump (r);
err = 1;
}
if (inf ? inex >= 0 : inex <= 0)
{
printf ("Error in test_overflow2 (i = %d, %s): wrong inexact"
- " flag (got %d)\n", i, mpfr_print_rnd_mode (rnd), inex);
+ " flag (got %d)\n", i,
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd), inex);
err = 1;
}
@@ -217,12 +219,12 @@ test_underflow1 (void)
mpfr_setmax (z, mpfr_get_emax ());
/* |z| = 1 or 2^emax - ulp */
mpfr_clear_flags ();
- inex = mpfr_fma (r, x, y, z, rnd);
+ inex = mpfr_fma (r, x, y, z, (mp_rnd_t) rnd);
#define ERRTU1 "Error in test_underflow1 (signy = %d, signz = %d, %s)\n "
if (mpfr_nanflag_p ())
{
printf (ERRTU1 "NaN flag is set\n", signy, signz,
- mpfr_print_rnd_mode (rnd));
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (signy < 0 && (rnd == GMP_RNDD ||
@@ -234,19 +236,19 @@ test_underflow1 (void)
if ((mpfr_overflow_p () != 0) ^ (mpfr_inf_p (z) != 0))
{
printf (ERRTU1 "wrong overflow flag\n", signy, signz,
- mpfr_print_rnd_mode (rnd));
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (mpfr_underflow_p ())
{
printf (ERRTU1 "underflow flag is set\n", signy, signz,
- mpfr_print_rnd_mode (rnd));
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! mpfr_equal_p (r, z))
{
printf (ERRTU1 "got ", signy, signz,
- mpfr_print_rnd_mode (rnd));
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (r);
printf (" instead of ");
mpfr_print_binary (z);
@@ -258,7 +260,8 @@ test_underflow1 (void)
(rnd == GMP_RNDN && signy > 0)))
{
printf (ERRTU1 "ternary value = %d instead of < 0\n",
- signy, signz, mpfr_print_rnd_mode (rnd), inex);
+ signy, signz, mpfr_print_rnd_mode ((mp_rnd_t) rnd),
+ inex);
err = 1;
}
if (inex <= 0 && (rnd == GMP_RNDU ||
@@ -266,7 +269,8 @@ test_underflow1 (void)
(rnd == GMP_RNDN && signy < 0)))
{
printf (ERRTU1 "ternary value = %d instead of > 0\n",
- signy, signz, mpfr_print_rnd_mode (rnd), inex);
+ signy, signz, mpfr_print_rnd_mode ((mp_rnd_t) rnd),
+ inex);
err = 1;
}
}
@@ -571,7 +575,7 @@ main (int argc, char *argv[])
if (randlimb () % 2)
mpfr_neg (z, z, GMP_RNDN);
- rnd = (mp_rnd_t) RND_RAND ();
+ rnd = RND_RAND ();
mpfr_set_prec (slong, 2 * prec);
if (mpfr_mul (slong, x, y, rnd))
{
diff --git a/tests/tfms.c b/tests/tfms.c
index 5dc82d671..8717e0584 100644
--- a/tests/tfms.c
+++ b/tests/tfms.c
@@ -46,14 +46,14 @@ test_exact (void)
if (mpfr_set_str (a, val[i], 10, GMP_RNDN) ||
mpfr_set_str (b, val[j], 10, GMP_RNDN) ||
mpfr_set_str (c, val[k], 10, GMP_RNDN) ||
- mpfr_mul (r1, a, b, rnd) ||
- mpfr_sub (r1, r1, c, rnd))
+ mpfr_mul (r1, a, b, (mp_rnd_t) rnd) ||
+ mpfr_sub (r1, r1, c, (mp_rnd_t) rnd))
{
printf ("test_exact internal error for (%d,%d,%d,%d)\n",
i, j, k, rnd);
exit (1);
}
- if (mpfr_fms (r2, a, b, c, rnd))
+ if (mpfr_fms (r2, a, b, c, (mp_rnd_t) rnd))
{
printf ("test_exact(%d,%d,%d,%d): mpfr_fms should be exact\n",
i, j, k, rnd);
@@ -139,36 +139,37 @@ test_overflow2 (void)
mpfr_clear_flags ();
/* One has: x * y = -1@emax exactly (but not representable). */
- inex = mpfr_fms (r, x, y, z, rnd);
+ inex = mpfr_fms (r, x, y, z, (mp_rnd_t) rnd);
if (overflow ^ (mpfr_overflow_p () != 0))
{
printf ("Error in test_overflow2 (i = %d, %s): wrong overflow"
- " flag (should be %d)\n", i, mpfr_print_rnd_mode (rnd),
- overflow);
+ " flag (should be %d)\n", i,
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd), overflow);
err = 1;
}
if (mpfr_nanflag_p ())
{
printf ("Error in test_overflow2 (i = %d, %s): NaN flag should"
- " not be set\n", i, mpfr_print_rnd_mode (rnd));
+ " not be set\n", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (mpfr_nan_p (r))
{
printf ("Error in test_overflow2 (i = %d, %s): got NaN\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
else if (MPFR_SIGN (r) >= 0)
{
printf ("Error in test_overflow2 (i = %d, %s): wrong sign "
- "(+ instead of -)\n", i, mpfr_print_rnd_mode (rnd));
+ "(+ instead of -)\n", i,
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
else if (inf && ! mpfr_inf_p (r))
{
printf ("Error in test_overflow2 (i = %d, %s): expected -Inf,"
- " got\n", i, mpfr_print_rnd_mode (rnd));
+ " got\n", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_dump (r);
err = 1;
}
@@ -176,14 +177,15 @@ test_overflow2 (void)
(mpfr_nextbelow (r), ! mpfr_inf_p (r))))
{
printf ("Error in test_overflow2 (i = %d, %s): expected -MAX,"
- " got\n", i, mpfr_print_rnd_mode (rnd));
+ " got\n", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_dump (r);
err = 1;
}
if (inf ? inex >= 0 : inex <= 0)
{
printf ("Error in test_overflow2 (i = %d, %s): wrong inexact"
- " flag (got %d)\n", i, mpfr_print_rnd_mode (rnd), inex);
+ " flag (got %d)\n", i,
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd), inex);
err = 1;
}
@@ -217,12 +219,12 @@ test_underflow1 (void)
mpfr_setmax (z, mpfr_get_emax ());
/* |z| = 1 or 2^emax - ulp */
mpfr_clear_flags ();
- inex = mpfr_fms (r, x, y, z, rnd);
+ inex = mpfr_fms (r, x, y, z, (mp_rnd_t) rnd);
#define ERRTU1 "Error in test_underflow1 (signy = %d, signz = %d, %s)\n "
if (mpfr_nanflag_p ())
{
printf (ERRTU1 "NaN flag is set\n", signy, signz,
- mpfr_print_rnd_mode (rnd));
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
mpfr_neg (z, z, GMP_RNDN);
@@ -235,19 +237,19 @@ test_underflow1 (void)
if ((mpfr_overflow_p () != 0) ^ (mpfr_inf_p (z) != 0))
{
printf (ERRTU1 "wrong overflow flag\n", signy, signz,
- mpfr_print_rnd_mode (rnd));
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (mpfr_underflow_p ())
{
printf (ERRTU1 "underflow flag is set\n", signy, signz,
- mpfr_print_rnd_mode (rnd));
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! mpfr_equal_p (r, z))
{
printf (ERRTU1 "got ", signy, signz,
- mpfr_print_rnd_mode (rnd));
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (r);
printf (" instead of ");
mpfr_print_binary (z);
@@ -259,7 +261,8 @@ test_underflow1 (void)
(rnd == GMP_RNDN && signy > 0)))
{
printf (ERRTU1 "ternary value = %d instead of < 0\n",
- signy, signz, mpfr_print_rnd_mode (rnd), inex);
+ signy, signz, mpfr_print_rnd_mode ((mp_rnd_t) rnd),
+ inex);
err = 1;
}
if (inex <= 0 && (rnd == GMP_RNDU ||
@@ -267,7 +270,8 @@ test_underflow1 (void)
(rnd == GMP_RNDN && signy < 0)))
{
printf (ERRTU1 "ternary value = %d instead of > 0\n",
- signy, signz, mpfr_print_rnd_mode (rnd), inex);
+ signy, signz, mpfr_print_rnd_mode ((mp_rnd_t) rnd),
+ inex);
err = 1;
}
}
@@ -574,7 +578,7 @@ main (int argc, char *argv[])
if (randlimb () % 2)
mpfr_neg (z, z, GMP_RNDN);
- rnd = (mp_rnd_t) RND_RAND ();
+ rnd = RND_RAND ();
mpfr_set_prec (slong, 2 * prec);
if (mpfr_mul (slong, x, y, rnd))
{
diff --git a/tests/tgeneric.c b/tests/tgeneric.c
index 00d8982bc..ff6e6d56b 100644
--- a/tests/tgeneric.c
+++ b/tests/tgeneric.c
@@ -197,7 +197,7 @@ test_generic (mp_prec_t p0, mp_prec_t p1, unsigned int N)
#endif
}
- rnd = (mp_rnd_t) RND_RAND ();
+ rnd = RND_RAND ();
mpfr_clear_flags ();
#ifdef DEBUG_TGENERIC
TGENERIC_INFO (TEST_FUNCTION, MPFR_PREC (y));
diff --git a/tests/tgeneric_ui.c b/tests/tgeneric_ui.c
index 8266dc986..f479cae0a 100644
--- a/tests/tgeneric_ui.c
+++ b/tests/tgeneric_ui.c
@@ -65,7 +65,7 @@ test_generic_ui (mp_prec_t p0, mp_prec_t p1, unsigned int N)
mpfr_set_exp (x, mpfr_get_emin ());
}
u = INT_RAND_FUNCTION ();
- rnd = (mp_rnd_t) RND_RAND ();
+ rnd = RND_RAND ();
mpfr_set_prec (y, yprec);
compare = TEST_FUNCTION (y, x, u, rnd);
if (mpfr_can_round (y, yprec, rnd, rnd, prec))
diff --git a/tests/tget_str.c b/tests/tget_str.c
index 20dfcdfe8..f8e84b392 100644
--- a/tests/tget_str.c
+++ b/tests/tget_str.c
@@ -1154,7 +1154,7 @@ main (int argc, char *argv[])
mpfr_set_exp (x, (e == -10) ? mpfr_get_emin () :
((e == 10) ? mpfr_get_emax () : e));
b = 2 + (randlimb () % 35);
- r = (mp_rnd_t) RND_RAND();
+ r = RND_RAND ();
mpfr_get_str (s, &f, b, m, x, r);
}
mpfr_clear (x);
diff --git a/tests/tgmpop.c b/tests/tgmpop.c
index 8e97ad07c..e136a406a 100644
--- a/tests/tgmpop.c
+++ b/tests/tgmpop.c
@@ -144,7 +144,7 @@ check_for_zero ()
mpq_set_ui (q, 0, 1);
MPFR_SET_ZERO (x);
- for(r = 0 ; r < GMP_RND_MAX ; r++)
+ RND_LOOP (r)
{
for (i = MPFR_SIGN_NEG ; i <= MPFR_SIGN_POS ;
i+=MPFR_SIGN_POS-MPFR_SIGN_NEG)
@@ -414,7 +414,7 @@ test_genericz (mp_prec_t p0, mp_prec_t p1, unsigned int N,
{
mpfr_urandomb (arg1, RANDS);
mpz_urandomb (arg2, RANDS, 1024);
- rnd = (mp_rnd_t) RND_RAND ();
+ rnd = RND_RAND ();
mpfr_set_prec (dst_big, 2*prec);
compare = func(dst_big, arg1, arg2, rnd);
if (mpfr_can_round (dst_big, 2*prec, rnd, rnd, prec))
@@ -492,7 +492,7 @@ test_genericq (mp_prec_t p0, mp_prec_t p1, unsigned int N,
mpfr_urandomb (arg1, RANDS);
mpq_set_ui (arg2, randlimb (), randlimb() );
mpq_canonicalize (arg2);
- rnd = (mp_rnd_t) RND_RAND ();
+ rnd = RND_RAND ();
mpfr_set_prec (dst_big, prec+10);
compare = func(dst_big, arg1, arg2, rnd);
if (mpfr_can_round (dst_big, prec+10, rnd, rnd, prec))
diff --git a/tests/thypot.c b/tests/thypot.c
index 7bfd6194b..de691f5ad 100644
--- a/tests/thypot.c
+++ b/tests/thypot.c
@@ -170,11 +170,11 @@ check_overflow (void)
RND_LOOP(r)
{
mpfr_clear_overflow ();
- inex = mpfr_hypot (y, x, x, r);
+ inex = mpfr_hypot (y, x, x, (mp_rnd_t) r);
if (!mpfr_overflow_p ())
{
printf ("No overflow in check_overflow for %s\n",
- mpfr_print_rnd_mode (r));
+ mpfr_print_rnd_mode ((mp_rnd_t) r));
exit (1);
}
MPFR_ASSERTN (MPFR_IS_POS (y));
diff --git a/tests/tinternals.c b/tests/tinternals.c
index b040b2b16..821f2765b 100644
--- a/tests/tinternals.c
+++ b/tests/tinternals.c
@@ -62,9 +62,9 @@ test_round_near_x (void)
mpfr_neg (x, x, GMP_RNDN), p++, neg++)
for (err = 2; err <= 6; err++)
for (dir = 0; dir <= 1; dir++)
- for (r = 0; r < GMP_RND_MAX; r++)
+ RND_LOOP(r)
{
- inex = mpfr_round_near_x (y, x, err, dir, r);
+ inex = mpfr_round_near_x (y, x, err, dir, (mp_rnd_t) r);
if (inex == 0 && err < 6)
{
@@ -73,7 +73,8 @@ test_round_near_x (void)
continue;
}
- inex2 = ((dir ^ neg) ? mpfr_add : mpfr_sub) (z, x, eps, r);
+ inex2 = ((dir ^ neg) ? mpfr_add : mpfr_sub)
+ (z, x, eps, (mp_rnd_t) r);
if (inex * inex2 <= 0)
printf ("Bad return value (%d instead of %d) for:\n",
inex, inex2);
@@ -94,7 +95,7 @@ test_round_near_x (void)
printf ("x = %c%c%c%c.%c%c, ", neg ? '-' : '+',
p[0], p[1], p[2], p[3], p[4]);
printf ("err = %d, dir = %d, r = %s --> inex = %2d",
- err, dir, mpfr_print_rnd_mode (r), inex);
+ err, dir, mpfr_print_rnd_mode ((mp_rnd_t) r), inex);
if (inex != 0)
{
printf (", y = ");
diff --git a/tests/tlgamma.c b/tests/tlgamma.c
index 69449e415..649466c1a 100644
--- a/tests/tlgamma.c
+++ b/tests/tlgamma.c
@@ -381,7 +381,7 @@ special (void)
}
static int
-mpfr_lgamma1 (mpfr_t y, mpfr_t x, mp_rnd_t r)
+mpfr_lgamma1 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t r)
{
int sign;
diff --git a/tests/tmul.c b/tests/tmul.c
index d1013c664..efa82aac2 100644
--- a/tests/tmul.c
+++ b/tests/tmul.c
@@ -243,7 +243,7 @@ check_exact (void)
{
mpfr_random (a);
mpfr_random (b);
- rnd = (mp_rnd_t) RND_RAND ();
+ rnd = RND_RAND ();
inexact = test_mul (c, a, b, rnd);
if (test_mul (d, a, b, rnd)) /* should be always exact */
{
@@ -643,7 +643,7 @@ check_regression (void)
/* multiplies x by 53-bit approximation of Pi */
static int
-mpfr_mulpi (mpfr_t y, mpfr_t x, mp_rnd_t r)
+mpfr_mulpi (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t r)
{
mpfr_t z;
int inex;
diff --git a/tests/tout_str.c b/tests/tout_str.c
index cda8d7f23..6033c129c 100644
--- a/tests/tout_str.c
+++ b/tests/tout_str.c
@@ -71,7 +71,8 @@ special (void)
int
main (int argc, char *argv[])
{
- int i, N=10000, r, p;
+ int i, N=10000, p;
+ mp_rnd_t rnd;
double d;
tests_start_mpfr ();
@@ -128,9 +129,9 @@ main (int argc, char *argv[])
#else
while (ABS(d) < DBL_MIN);
#endif
- r = RND_RAND ();
+ rnd = RND_RAND ();
p = 2 + randlimb () % 35;
- check (d, (mp_rnd_t) r, p);
+ check (d, rnd, p);
}
fclose (fout);
diff --git a/tests/tpow.c b/tests/tpow.c
index dc844a7bd..d34228340 100644
--- a/tests/tpow.c
+++ b/tests/tpow.c
@@ -1037,7 +1037,7 @@ x_near_one (void)
}
static int
-mpfr_pow275 (mpfr_t y, mpfr_t x, mp_rnd_t r)
+mpfr_pow275 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t r)
{
mpfr_t z;
int inex;
diff --git a/tests/tpow3.c b/tests/tpow3.c
index 0de6468c8..642f5eb23 100644
--- a/tests/tpow3.c
+++ b/tests/tpow3.c
@@ -65,7 +65,7 @@ main (int argc, char *argv[])
mpfr_random (s);
if (randlimb () % 2)
mpfr_neg (s, s, GMP_RNDN);
- rnd = (mp_rnd_t) RND_RAND ();
+ rnd = RND_RAND ();
mpfr_set_prec (y, yprec);
compare = mpfr_pow (y, x, s, rnd);
err = (rnd == GMP_RNDN) ? yprec + 1 : yprec;
diff --git a/tests/tpow_z.c b/tests/tpow_z.c
index e5886ef53..0e9b1d9c5 100644
--- a/tests/tpow_z.c
+++ b/tests/tpow_z.c
@@ -161,7 +161,7 @@ check_integer (mp_prec_t begin, mp_prec_t end, unsigned long max)
mpz_neg (z, z);
mpfr_random (x);
mpfr_mul_2ui (x, x, 1, GMP_RNDN); /* 0 <= x < 2 */
- rnd = (mp_rnd_t) RND_RAND ();
+ rnd = RND_RAND ();
if (mpz_fits_slong_p (z))
{
n = mpz_get_si (z);
diff --git a/tests/tprintf.c b/tests/tprintf.c
index a88357a79..ce97566d2 100644
--- a/tests/tprintf.c
+++ b/tests/tprintf.c
@@ -260,7 +260,7 @@ check_random (int nb_tests)
char *ptr = fmt;
tests_default_random (x, 256, MPFR_EMIN_MIN, MPFR_EMAX_MAX);
- rnd = RND_RAND ();
+ rnd = (mp_rnd_t) RND_RAND ();
spec = (int) (randlimb () % 5);
jmax = (spec == 3 || spec == 4) ? 6 : 5; /* ' flag only with %f or %g */
diff --git a/tests/tsec.c b/tests/tsec.c
index af4d87b6d..a3a2f40c6 100644
--- a/tests/tsec.c
+++ b/tests/tsec.c
@@ -103,12 +103,12 @@ overflowed_sec0 (void)
{
mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN);
mpfr_clear_flags ();
- inex = mpfr_sec (x, x, rnd);
+ inex = mpfr_sec (x, x, (mp_rnd_t) rnd);
if (! mpfr_overflow_p ())
{
printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n"
" The overflow flag is not set.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
@@ -117,13 +117,13 @@ overflowed_sec0 (void)
{
printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n"
" The inexact value must be negative.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! mpfr_equal_p (x, y))
{
printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n"
- " Got ", i, mpfr_print_rnd_mode (rnd));
+ " Got ", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of 0.11111111E%d.\n", emax);
err = 1;
@@ -135,13 +135,13 @@ overflowed_sec0 (void)
{
printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n"
" The inexact value must be positive.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0))
{
printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n"
- " Got ", i, mpfr_print_rnd_mode (rnd));
+ " Got ", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of +Inf.\n");
err = 1;
diff --git a/tests/tsech.c b/tests/tsech.c
index f3a4595eb..b4d170356 100644
--- a/tests/tsech.c
+++ b/tests/tsech.c
@@ -121,13 +121,13 @@ overflowed_sech0 (void)
{
mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN);
mpfr_clear_flags ();
- inex = mpfr_sech (x, x, rnd);
+ inex = mpfr_sech (x, x, (mp_rnd_t) rnd);
if ((i == 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) &&
! mpfr_overflow_p ())
{
printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n"
" The overflow flag is not set.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (rnd == GMP_RNDZ || rnd == GMP_RNDD)
@@ -136,13 +136,13 @@ overflowed_sech0 (void)
{
printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n"
" The inexact value must be negative.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! mpfr_equal_p (x, y))
{
printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n"
- " Got ", i, mpfr_print_rnd_mode (rnd));
+ " Got ", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of 0.11111111E%d.\n", emax);
err = 1;
@@ -154,13 +154,13 @@ overflowed_sech0 (void)
{
printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n"
" The inexact value must be positive.\n",
- i, mpfr_print_rnd_mode (rnd));
+ i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0))
{
printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n"
- " Got ", i, mpfr_print_rnd_mode (rnd));
+ " Got ", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of +Inf.\n");
err = 1;
diff --git a/tests/tset_f.c b/tests/tset_f.c
index 88e22aeda..e4ddc21db 100644
--- a/tests/tset_f.c
+++ b/tests/tset_f.c
@@ -48,7 +48,7 @@ main (void)
mpfr_set_f (x, y, GMP_RNDN);
mpf_urandomb (y, RANDS, 10 * GMP_NUMB_BITS);
- mpfr_set_f (x, y, (mp_rnd_t) RND_RAND());
+ mpfr_set_f (x, y, RND_RAND ());
/* bug found by Jean-Pierre Merlet */
mpfr_set_prec (x, 256);
diff --git a/tests/tset_si.c b/tests/tset_si.c
index d511b789e..a24e5ec1a 100644
--- a/tests/tset_si.c
+++ b/tests/tset_si.c
@@ -98,12 +98,12 @@ test_macros (void)
{
mpfr_t x[3];
mpfr_ptr p;
- mpfr_rnd_t r;
+ int r;
mpfr_inits (x[0], x[1], x[2], (mpfr_ptr) 0);
p = x[0];
r = 0;
- mpfr_set_ui (p++, 0, r++);
+ mpfr_set_ui (p++, 0, (mp_rnd_t) r++);
if (p != x[1] || r != 1)
{
printf ("Error in mpfr_set_ui macro: p - x[0] = %d (expecting 1), "
@@ -112,7 +112,7 @@ test_macros (void)
}
p = x[0];
r = 0;
- mpfr_set_si (p++, 0, r++);
+ mpfr_set_si (p++, 0, (mp_rnd_t) r++);
if (p != x[1] || r != 1)
{
printf ("Error in mpfr_set_si macro: p - x[0] = %d (expecting 1), "
diff --git a/tests/tset_str.c b/tests/tset_str.c
index 7e6ca427a..30c97f6c8 100644
--- a/tests/tset_str.c
+++ b/tests/tset_str.c
@@ -201,8 +201,10 @@ main (int argc, char *argv[])
mpfr_set_prec (y, prec);
for (i=0;i<N;i++)
{
+ mp_rnd_t rnd;
+
mpfr_random (x);
- k = RND_RAND ();
+ rnd = RND_RAND ();
logbase = (randlimb () % 5) + 1;
base = 1 << logbase;
/* Warning: the number of bits needed to print exactly a number of
@@ -213,13 +215,13 @@ main (int argc, char *argv[])
baseprec = prec;
else
baseprec = 1 + (prec - 2 + logbase) / logbase;
- str = mpfr_get_str (NULL, &e, base, baseprec, x, (mp_rnd_t) k);
- mpfr_set_str (y, str, base, (mp_rnd_t) k);
+ str = mpfr_get_str (NULL, &e, base, baseprec, x, rnd);
+ mpfr_set_str (y, str, base, rnd);
MPFR_EXP(y) += logbase * (e - strlen (str));
if (mpfr_cmp (x, y))
{
printf ("mpfr_set_str o mpfr_get_str <> id for rnd_mode=%s\n",
- mpfr_print_rnd_mode ((mp_rnd_t) k));
+ mpfr_print_rnd_mode (rnd));
printf ("x=");
mpfr_print_binary (x);
puts ("");
diff --git a/tests/tset_z.c b/tests/tset_z.c
index 962e70b0e..375678256 100644
--- a/tests/tset_z.c
+++ b/tests/tset_z.c
@@ -133,7 +133,7 @@ main (int argc, char *argv[])
check_large ();
check (0, GMP_RNDN);
for (j = 0; j < 200000; j++)
- check (randlimb () & LONG_MAX, (mp_rnd_t) RND_RAND ());
+ check (randlimb () & LONG_MAX, RND_RAND ());
check0 ();
tests_end_mpfr ();
diff --git a/tests/tsin.c b/tests/tsin.c
index 6b71fb59d..6b5348a10 100644
--- a/tests/tsin.c
+++ b/tests/tsin.c
@@ -343,7 +343,7 @@ main (int argc, char *argv[])
mpfr_set_str_binary (x, "1.1001001000011111101101010100010001000010110100010011");
test_sin (x, x, GMP_RNDZ);
- if (mpfr_cmp_str (x, "1.1111111111111111111111111111111111111111111111111111e-1", 2, 0))
+ if (mpfr_cmp_str (x, "1.1111111111111111111111111111111111111111111111111111e-1", 2, GMP_RNDN))
{
printf ("Error for x= 1.1001001000011111101101010100010001000010110100010011\nGot ");
mpfr_dump (x);
diff --git a/tests/tsin_cos.c b/tests/tsin_cos.c
index 424011908..cc39cb1c7 100644
--- a/tests/tsin_cos.c
+++ b/tests/tsin_cos.c
@@ -189,18 +189,18 @@ overflowed_sin_cos0 (void)
mpfr_set_si (x, 0, GMP_RNDN);
mpfr_neg (x, x, GMP_RNDN);
mpfr_clear_flags ();
- inex = mpfr_sin_cos (x, y, x, rnd);
+ inex = mpfr_sin_cos (x, y, x, (mp_rnd_t) rnd);
if (! mpfr_overflow_p ())
{
printf ("Error in overflowed_sin_cos0 (rnd = %s):\n"
" The overflow flag is not set.\n",
- mpfr_print_rnd_mode (rnd));
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! (mpfr_zero_p (x) && MPFR_SIGN (x) < 0))
{
printf ("Error in overflowed_sin_cos0 (rnd = %s):\n"
- " Got sin = ", mpfr_print_rnd_mode (rnd));
+ " Got sin = ", mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (x);
printf (" instead of -0.\n");
err = 1;
@@ -211,13 +211,14 @@ overflowed_sin_cos0 (void)
{
printf ("Error in overflowed_sin_cos0 (rnd = %s):\n"
" The inexact value must be non-zero.\n",
- mpfr_print_rnd_mode (rnd));
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! mpfr_equal_p (y, z))
{
printf ("Error in overflowed_sin_cos0 (rnd = %s):\n"
- " Got cos = ", mpfr_print_rnd_mode (rnd));
+ " Got cos = ",
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (y);
printf (" instead of 0.11111111E%d.\n", emax);
err = 1;
@@ -229,13 +230,14 @@ overflowed_sin_cos0 (void)
{
printf ("Error in overflowed_sin_cos0 (rnd = %s):\n"
" The inexact value must be non-zero.\n",
- mpfr_print_rnd_mode (rnd));
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
err = 1;
}
if (! (mpfr_inf_p (y) && MPFR_SIGN (y) > 0))
{
printf ("Error in overflowed_sin_cos0 (rnd = %s):\n"
- " Got cos = ", mpfr_print_rnd_mode (rnd));
+ " Got cos = ",
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
mpfr_print_binary (y);
printf (" instead of +Inf.\n");
err = 1;
diff --git a/tests/tsqrt.c b/tests/tsqrt.c
index 5eb53312b..2ed51d6d5 100644
--- a/tests/tsqrt.c
+++ b/tests/tsqrt.c
@@ -424,7 +424,7 @@ check_inexact (mp_prec_t p)
mpfr_init2 (y, p);
mpfr_init2 (z, 2*p);
mpfr_random (x);
- rnd = (mp_rnd_t) RND_RAND();
+ rnd = RND_RAND ();
inexact = test_sqrt (y, x, rnd);
if (mpfr_mul (z, y, y, rnd)) /* exact since prec(z) = 2*prec(y) */
{
diff --git a/tests/tstckintc.c b/tests/tstckintc.c
index df75de744..55056c60e 100644
--- a/tests/tstckintc.c
+++ b/tests/tstckintc.c
@@ -37,7 +37,7 @@ mp_prec_t p = PREC_TESTED;
#define ALIGNED(s) (((s) + sizeof (long) - 1) / sizeof (long) * sizeof (long))
static void *
-new (size_t s)
+new_st (size_t s)
{
void *p = (void *) stack;
stack += ALIGNED (s);
@@ -53,8 +53,8 @@ new (size_t s)
static mpfr_ptr
new_mpfr (mp_prec_t p)
{
- mpfr_ptr x = (mpfr_ptr) new (sizeof (mpfr_t));
- void *mantissa = new (mpfr_custom_get_size (p));
+ mpfr_ptr x = (mpfr_ptr) new_st (sizeof (mpfr_t));
+ void *mantissa = new_st (mpfr_custom_get_size (p));
mpfr_custom_init (mantissa, p);
mpfr_custom_init_set (x, 0, 0, p, mantissa);
return x;
@@ -104,7 +104,8 @@ dummy_new (void)
{
long *r;
- r = new (ALIGNED (2*sizeof (long)) + ALIGNED (mpfr_custom_get_size (p)));
+ r = (long *) new_st (ALIGNED (2 * sizeof (long)) +
+ ALIGNED (mpfr_custom_get_size (p)));
MPFR_ASSERTN (r != NULL);
(mpfr_custom_init) (&r[2], p);
r[0] = (int) MPFR_NAN_KIND;
diff --git a/tests/tsub.c b/tests/tsub.c
index cca9b8080..ec3849758 100644
--- a/tests/tsub.c
+++ b/tests/tsub.c
@@ -437,14 +437,14 @@ check_inexact (void)
: MPFR_EXP(u) - MPFR_EXP(x);
pz = pz + MAX(MPFR_PREC(x), MPFR_PREC(u));
mpfr_set_prec (z, pz);
- rnd = (mp_rnd_t) RND_RAND();
+ rnd = RND_RAND ();
if (test_sub (z, x, u, rnd))
{
printf ("z <- x - u should be exact\n");
exit (1);
}
{
- rnd = (mp_rnd_t) RND_RAND ();
+ rnd = RND_RAND ();
inexact = test_sub (y, x, u, rnd);
cmp = mpfr_cmp (y, z);
if (((inexact == 0) && (cmp != 0)) ||
diff --git a/tests/tsubnormal.c b/tests/tsubnormal.c
index 5c6838026..ca1c8d3fd 100644
--- a/tests/tsubnormal.c
+++ b/tests/tsubnormal.c
@@ -84,7 +84,7 @@ check1 (void)
mpfr_neg (x, x, GMP_RNDN);
if (mpfr_cmp_str (x, tab[i].out, 2, GMP_RNDN) != 0)
{
- char *sgn = s ? "-" : "";
+ const char *sgn = s ? "-" : "";
printf ("Error for i = %d (old_inex = %d), k = %d, x = %s%s\n"
"Expected: %s%s\nGot: ", i, old_inex, k,
sgn, tab[i].in, sgn, tab[i].out);
diff --git a/tests/tui_div.c b/tests/tui_div.c
index d6b2bb494..e64f72041 100644
--- a/tests/tui_div.c
+++ b/tests/tui_div.c
@@ -161,7 +161,7 @@ check_nan (void)
}
static int
-mpfr_inv (mpfr_t y, mpfr_t x, mp_rnd_t r)
+mpfr_inv (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t r)
{
return mpfr_ui_div (y, 1, x, r);
}
diff --git a/tests/tui_pow.c b/tests/tui_pow.c
index 5abe2cdea..7f87f0a1f 100644
--- a/tests/tui_pow.c
+++ b/tests/tui_pow.c
@@ -248,7 +248,7 @@ main (int argc, char *argv[])
int nt;
nt = randlimb () & INT_MAX;
mpfr_random (x);
- rnd = (mp_rnd_t) RND_RAND ();
+ rnd = RND_RAND ();
check1 (x, prec, nt, rnd);
}
}
diff --git a/tests/tzeta_ui.c b/tests/tzeta_ui.c
index da581383f..abffeb42d 100644
--- a/tests/tzeta_ui.c
+++ b/tests/tzeta_ui.c
@@ -47,7 +47,8 @@ main (int argc, char *argv[])
if (argc >= 3) /* tzeta_ui n prec [rnd] */
{
mpfr_set_prec (x, atoi (argv[2]));
- mpfr_zeta_ui (x, atoi (argv[1]), (argc > 3) ? atoi (argv[3]) : GMP_RNDN);
+ mpfr_zeta_ui (x, atoi (argv[1]),
+ argc > 3 ? (mp_rnd_t) atoi (argv[3]) : GMP_RNDN);
mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
printf ("\n");
goto clear_and_exit;