From f5f7883fc7cf47d38ed493a882fd7109bdd589bb Mon Sep 17 00:00:00 2001 From: zimmerma Date: Tue, 3 Mar 2009 16:51:07 +0000 Subject: GMP_RNDX -> MPFR_RNDX git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6053 280ebfd0-de03-0410-8827-d642c229c3f4 --- tests/mpfr-test.h | 8 +- tests/reuse.c | 8 +- tests/rnd_mode.c | 8 +- tests/tabs.c | 24 +-- tests/tacos.c | 38 ++--- tests/tacosh.c | 40 ++--- tests/tadd.c | 352 ++++++++++++++++++++--------------------- tests/tadd1sp.c | 10 +- tests/tadd_d.c | 28 ++-- tests/tadd_ui.c | 18 +-- tests/tagm.c | 88 +++++------ tests/tasin.c | 60 +++---- tests/tasinh.c | 32 ++-- tests/tatan.c | 166 ++++++++++---------- tests/tatanh.c | 44 +++--- tests/taway.c | 32 ++-- tests/tcan_round.c | 14 +- tests/tcbrt.c | 46 +++--- tests/tcheck.c | 8 +- tests/tcmp.c | 16 +- tests/tcmp2.c | 40 ++--- tests/tcmp_d.c | 18 +-- tests/tcmp_ld.c | 18 +-- tests/tcmp_ui.c | 28 ++-- tests/tcmpabs.c | 8 +- tests/tcomparisons.c | 14 +- tests/tconst_catalan.c | 6 +- tests/tconst_euler.c | 16 +- tests/tconst_log2.c | 36 ++--- tests/tconst_pi.c | 20 +-- tests/tcopysign.c | 28 ++-- tests/tcos.c | 78 +++++----- tests/tcosh.c | 34 ++-- tests/tcot.c | 22 +-- tests/tcoth.c | 48 +++--- tests/tcsc.c | 14 +- tests/tcsch.c | 22 +-- tests/td_div.c | 22 +-- tests/td_sub.c | 18 +-- tests/tdim.c | 26 ++-- tests/tdiv.c | 312 ++++++++++++++++++------------------- tests/tdiv_d.c | 22 +-- tests/tdiv_ui.c | 58 +++---- tests/teint.c | 60 +++---- tests/teq.c | 36 ++--- tests/terf.c | 176 ++++++++++----------- tests/tests.c | 76 ++++----- tests/texceptions.c | 100 ++++++------ tests/texp.c | 298 +++++++++++++++++------------------ tests/texp10.c | 56 +++---- tests/texp2.c | 82 +++++----- tests/texpm1.c | 34 ++-- tests/tfactorial.c | 24 +-- tests/tfits.c | 188 +++++++++++----------- tests/tfma.c | 128 +++++++-------- tests/tfmod.c | 58 +++---- tests/tfms.c | 134 ++++++++-------- tests/tfprintf.c | 4 +- tests/tfrac.c | 64 ++++---- tests/tgamma.c | 120 +++++++------- tests/tgeneric.c | 26 ++-- tests/tgeneric_ui.c | 8 +- tests/tget_d.c | 34 ++-- tests/tget_d_2exp.c | 18 +-- tests/tget_f.c | 68 ++++---- tests/tget_ld_2exp.c | 18 +-- tests/tget_set_d64.c | 144 ++++++++--------- tests/tget_sj.c | 82 +++++----- tests/tget_str.c | 300 +++++++++++++++++------------------ tests/tget_z.c | 12 +- tests/tgmpop.c | 68 ++++---- tests/thyperbolic.c | 50 +++--- tests/thypot.c | 84 +++++----- tests/tinp_str.c | 6 +- tests/tinternals.c | 12 +- tests/tisnan.c | 12 +- tests/tj0.c | 36 ++--- tests/tj1.c | 22 +-- tests/tjn.c | 148 +++++++++--------- tests/tl2b.c | 10 +- tests/tlgamma.c | 104 ++++++------- tests/tli2.c | 44 +++--- tests/tlngamma.c | 68 ++++---- tests/tlog.c | 270 ++++++++++++++++---------------- tests/tlog10.c | 32 ++-- tests/tlog1p.c | 36 ++--- tests/tlog2.c | 24 +-- tests/tminmax.c | 52 +++---- tests/tmodf.c | 26 ++-- tests/tmul.c | 250 ++++++++++++++--------------- tests/tmul_2exp.c | 42 ++--- tests/tmul_d.c | 20 +-- tests/tmul_ui.c | 64 ++++---- tests/tnext.c | 38 ++--- tests/tout_str.c | 46 +++--- tests/toutimpl.c | 18 +-- tests/tpow.c | 416 ++++++++++++++++++++++++------------------------- tests/tpow3.c | 14 +- tests/tpow_all.c | 102 ++++++------ tests/tpow_z.c | 64 ++++---- tests/tprintf.c | 4 +- tests/trandom.c | 2 +- tests/trec_sqrt.c | 36 ++--- tests/tremquo.c | 176 ++++++++++----------- tests/trint.c | 90 +++++------ tests/troot.c | 86 +++++----- tests/tround_prec.c | 46 +++--- tests/tsec.c | 20 +-- tests/tsech.c | 30 ++-- tests/tset.c | 36 ++--- tests/tset_d.c | 32 ++-- tests/tset_exp.c | 2 +- tests/tset_f.c | 52 +++---- tests/tset_ld.c | 40 ++--- tests/tset_q.c | 22 +-- tests/tset_si.c | 142 ++++++++--------- tests/tset_sj.c | 34 ++-- tests/tset_str.c | 190 +++++++++++----------- tests/tset_z.c | 16 +- tests/tsi_op.c | 34 ++-- tests/tsin.c | 106 ++++++------- tests/tsin_cos.c | 70 ++++----- tests/tsinh.c | 18 +-- tests/tsinh_cosh.c | 28 ++-- tests/tsprintf.c | 90 +++++------ tests/tsqr.c | 18 +-- tests/tsqrt.c | 308 ++++++++++++++++++------------------ tests/tsqrt_ui.c | 6 +- tests/tstckintc.c | 10 +- tests/tstrtofr.c | 304 ++++++++++++++++++------------------ tests/tsub.c | 98 ++++++------ tests/tsub1sp.c | 4 +- tests/tsub_d.c | 18 +-- tests/tsub_ui.c | 10 +- tests/tsubnormal.c | 70 ++++----- tests/tsum.c | 30 ++-- tests/tswap.c | 2 +- tests/ttan.c | 40 ++--- tests/ttanh.c | 20 +-- tests/ttrunc.c | 10 +- tests/tui_div.c | 42 ++--- tests/tui_pow.c | 58 +++---- tests/tui_sub.c | 62 ++++---- tests/ty0.c | 28 ++-- tests/ty1.c | 28 ++-- tests/tyn.c | 84 +++++----- tests/tzeta.c | 84 +++++----- tests/tzeta_ui.c | 16 +- 148 files changed, 4613 insertions(+), 4613 deletions(-) (limited to 'tests') diff --git a/tests/mpfr-test.h b/tests/mpfr-test.h index 2bf24499c..e01804368 100644 --- a/tests/mpfr-test.h +++ b/tests/mpfr-test.h @@ -35,13 +35,13 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #define MAXNORM 1.7976931348623157081e308 /* 2^(1023)*(2-2^(-52)) */ /* Generates a random rounding mode */ -#define RND_RAND() ((mp_rnd_t) (randlimb() % GMP_RND_MAX)) +#define RND_RAND() ((mp_rnd_t) (randlimb() % MPFR_RND_MAX)) /* Generates a random sign */ #define SIGN_RAND() ( (randlimb()%2) ? MPFR_SIGN_POS : MPFR_SIGN_NEG) /* Loop for all rounding modes */ -#define RND_LOOP(_r) for((_r) = 0 ; (_r) < GMP_RND_MAX ; (_r)++) +#define RND_LOOP(_r) for((_r) = 0 ; (_r) < MPFR_RND_MAX ; (_r)++) /* The MAX, MIN and ABS macros may already be defined if gmp-impl.h has been included. They have the same semantics as in gmp-impl.h, but the @@ -89,8 +89,8 @@ void bad_cases _MPFR_PROTO ((int (*)(FLIST), int (*)(FLIST), 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) -#define mpfr_set_str1(x,s) mpfr_set_str(x,s,10,GMP_RNDN) +#define mpfr_cmp_str1(x,s) mpfr_cmp_str(x,s,10,MPFR_RNDN) +#define mpfr_set_str1(x,s) mpfr_set_str(x,s,10,MPFR_RNDN) #define mpfr_cmp0(x,y) (MPFR_ASSERTN (!MPFR_IS_NAN (x) && !MPFR_IS_NAN (y)), mpfr_cmp (x,y)) diff --git a/tests/reuse.c b/tests/reuse.c index e3bf16465..8b41fb46e 100644 --- a/tests/reuse.c +++ b/tests/reuse.c @@ -25,7 +25,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-test.h" -#define DISP(s, t) {printf(s); mpfr_out_str(stdout, 2, 0, t, GMP_RNDN); } +#define DISP(s, t) {printf(s); mpfr_out_str(stdout, 2, 0, t, MPFR_RNDN); } #define DISP2(s,t) {DISP(s,t); putchar('\n');} #define SPECIAL_MAX 12 @@ -68,10 +68,10 @@ set_special (mpfr_ptr x, unsigned int select) mpfr_set_str_binary (x, "1e+1"); break; case 9: - mpfr_const_pi (x, GMP_RNDN); + mpfr_const_pi (x, MPFR_RNDN); break; case 10: - mpfr_const_pi (x, GMP_RNDN); + mpfr_const_pi (x, MPFR_RNDN); MPFR_SET_EXP (x, MPFR_GET_EXP (x)-1); break; default: @@ -435,7 +435,7 @@ test2a (int (*testfunc)(mpfr_ptr, mpfr_srcptr), testfunc (ref1, ref2); /* foo(a, a) */ - mpfr_set (res1, ref2, GMP_RNDN); /* exact operation */ + mpfr_set (res1, ref2, MPFR_RNDN); /* exact operation */ testfunc (res1, res1); if (mpfr_compare (res1, ref1)) { diff --git a/tests/rnd_mode.c b/tests/rnd_mode.c index 7b30bc55a..178e12226 100644 --- a/tests/rnd_mode.c +++ b/tests/rnd_mode.c @@ -32,7 +32,7 @@ mpfr_set_machine_rnd_mode (mp_rnd_t rnd_mode) { switch (rnd_mode) { - case GMP_RNDN: + case MPFR_RNDN: return #if defined (MPFR_HAVE_FESETROUND) && defined (FE_TONEAREST) fesetround(FE_TONEAREST) @@ -40,7 +40,7 @@ mpfr_set_machine_rnd_mode (mp_rnd_t rnd_mode) -1 #endif ; - case GMP_RNDZ: + case MPFR_RNDZ: return #if defined (MPFR_HAVE_FESETROUND) && defined (FE_TOWARDZERO) fesetround(FE_TOWARDZERO) @@ -48,7 +48,7 @@ mpfr_set_machine_rnd_mode (mp_rnd_t rnd_mode) -1 #endif ; - case GMP_RNDU: + case MPFR_RNDU: return #if defined (MPFR_HAVE_FESETROUND) && defined (FE_UPWARD) fesetround(FE_UPWARD) @@ -56,7 +56,7 @@ mpfr_set_machine_rnd_mode (mp_rnd_t rnd_mode) -1 #endif ; - case GMP_RNDD: + case MPFR_RNDD: return #if defined (MPFR_HAVE_FESETROUND) && defined (FE_DOWNWARD) fesetround(FE_DOWNWARD) diff --git a/tests/tabs.c b/tests/tabs.c index a36e9d8ef..8af0216fc 100644 --- a/tests/tabs.c +++ b/tests/tabs.c @@ -45,11 +45,11 @@ check_inexact (void) mpfr_urandomb (x, RANDS); if (randlimb () % 2) { - mpfr_set (absx, x, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); + mpfr_set (absx, x, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); } else - mpfr_set (absx, x, GMP_RNDN); + mpfr_set (absx, x, MPFR_RNDN); for (q=2; q<2*p; q++) { mpfr_set_prec (y, q); @@ -85,24 +85,24 @@ check_cmp (int argc, char *argv[]) mpfr_inits2 (53, x, y, (mpfr_ptr) 0); - mpfr_set_ui(x, 1, GMP_RNDN); - (mpfr_abs) (x, x, GMP_RNDN); + mpfr_set_ui(x, 1, MPFR_RNDN); + (mpfr_abs) (x, x, MPFR_RNDN); if (mpfr_cmp_ui (x, 1)) { printf ("Error in mpfr_abs(1.0)\n"); exit (1); } - mpfr_set_si(x, -1, GMP_RNDN); - mpfr_abs(x, x, GMP_RNDN); + mpfr_set_si(x, -1, MPFR_RNDN); + mpfr_abs(x, x, MPFR_RNDN); if (mpfr_cmp_ui (x, 1)) { printf ("Error in mpfr_abs(1.0)\n"); exit (1); } - mpfr_set_si(x, -1, GMP_RNDN); - mpfr_abs(x, x, GMP_RNDN); + mpfr_set_si(x, -1, MPFR_RNDN); + mpfr_abs(x, x, MPFR_RNDN); if (mpfr_cmp_ui (x, 1)) { printf ("Error in mpfr_abs(-1.0)\n"); @@ -110,14 +110,14 @@ check_cmp (int argc, char *argv[]) } mpfr_set_inf (x, 1); - mpfr_abs (x, x, GMP_RNDN); + mpfr_abs (x, x, MPFR_RNDN); if (!mpfr_inf_p(x) || (mpfr_sgn(x) <= 0)) { printf ("Error in mpfr_abs(Inf).\n"); exit (1); } mpfr_set_inf (x, -1); - mpfr_abs (x, x, GMP_RNDN); + mpfr_abs (x, x, MPFR_RNDN); if (!mpfr_inf_p(x) || (mpfr_sgn(x) <= 0)) { printf ("Error in mpfr_abs(-Inf).\n"); @@ -125,7 +125,7 @@ check_cmp (int argc, char *argv[]) } MPFR_SET_NAN(x); - mpfr_abs (x, x, GMP_RNDN); + mpfr_abs (x, x, MPFR_RNDN); if (!MPFR_IS_NAN(x)) { printf ("Error in mpfr_abs(NAN).\n"); diff --git a/tests/tacos.c b/tests/tacos.c index 95f8fd0b1..2eb99e742 100644 --- a/tests/tacos.c +++ b/tests/tacos.c @@ -38,7 +38,7 @@ special (void) mpfr_init2 (y, 32); mpfr_set_str_binary (x, "0.10001000001001011000100001E-6"); - mpfr_acos (y, x, GMP_RNDN); + mpfr_acos (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "1.10001111111111110001110110001"); if (mpfr_cmp (x, y)) { @@ -47,7 +47,7 @@ special (void) } mpfr_set_str_binary (x, "-0.01101011110111100111010011001011"); - mpfr_acos (y, x, GMP_RNDZ); + mpfr_acos (y, x, MPFR_RNDZ); mpfr_set_str_binary (x, "10.0000000101111000011101000101"); if (mpfr_cmp (x, y)) { @@ -57,9 +57,9 @@ special (void) } mpfr_set_prec (x, 2); - mpfr_set_ui (x, 0, GMP_RNDN); - inex1 = mpfr_acos (x, x, GMP_RNDN); /* Pi/2 */ - inex2 = mpfr_const_pi (x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + inex1 = mpfr_acos (x, x, MPFR_RNDN); /* Pi/2 */ + inex2 = mpfr_const_pi (x, MPFR_RNDN); if (inex1 != inex2) { printf ("Error in mpfr_acos (3) for prec=2\n"); @@ -84,9 +84,9 @@ special_overflow (void) mpfr_init2 (x, 24); mpfr_init2 (y, 48); mpfr_set_str_binary (x, "0.101100100000000000110100E0"); - mpfr_acos (y, x, GMP_RNDN); + mpfr_acos (y, x, MPFR_RNDN); if (mpfr_cmp_str (y, "0.110011010100101111000100111010111011010000001001E0", - 2, GMP_RNDN)) + 2, MPFR_RNDN)) { printf("Special Overflow error.\n"); mpfr_dump (y); @@ -113,23 +113,23 @@ main (void) mpfr_init (y); MPFR_SET_NAN(x); - mpfr_acos (y, x, GMP_RNDN); + mpfr_acos (y, x, MPFR_RNDN); if (mpfr_nan_p(y) == 0) { printf ("Error: acos(NaN) != NaN\n"); exit (1); } - mpfr_set_ui (x, 2, GMP_RNDN); - mpfr_acos (y, x, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); + mpfr_acos (y, x, MPFR_RNDN); if (mpfr_nan_p(y) == 0) { printf ("Error: acos(2) != NaN\n"); exit (1); } - mpfr_set_si (x, -2, GMP_RNDN); - mpfr_acos (y, x, GMP_RNDN); + mpfr_set_si (x, -2, MPFR_RNDN); + mpfr_acos (y, x, MPFR_RNDN); if (mpfr_nan_p(y) == 0) { printf ("Error: acos(-2) != NaN\n"); @@ -137,8 +137,8 @@ main (void) } /* acos (1) = 0 */ - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_acos (y, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_acos (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) { printf ("Error: acos(1) != +0.0\n"); @@ -146,12 +146,12 @@ main (void) } /* acos (0) = Pi/2 */ - for (r = 0; r < GMP_RND_MAX; r++) + for (r = 0; r < MPFR_RND_MAX; r++) { - mpfr_set_ui (x, 0, GMP_RNDN); /* exact */ + mpfr_set_ui (x, 0, MPFR_RNDN); /* exact */ mpfr_acos (y, x, (mp_rnd_t) r); mpfr_const_pi (x, (mp_rnd_t) r); - mpfr_div_2exp (x, x, 1, GMP_RNDN); /* exact */ + mpfr_div_2exp (x, x, 1, MPFR_RNDN); /* exact */ if (mpfr_cmp (x, y)) { printf ("Error: acos(0) != Pi/2 for rnd=%s\n", @@ -161,9 +161,9 @@ main (void) } /* acos (-1) = Pi */ - for (r = 0; r < GMP_RND_MAX; r++) + for (r = 0; r < MPFR_RND_MAX; r++) { - mpfr_set_si (x, -1, GMP_RNDN); /* exact */ + mpfr_set_si (x, -1, MPFR_RNDN); /* exact */ mpfr_acos (y, x, (mp_rnd_t) r); mpfr_const_pi (x, (mp_rnd_t) r); if (mpfr_cmp (x, y)) diff --git a/tests/tacosh.c b/tests/tacosh.c index bf9a0e5bc..31f8905a9 100644 --- a/tests/tacosh.c +++ b/tests/tacosh.c @@ -46,8 +46,8 @@ special (void) mpfr_init (y); MPFR_SET_INF(x); - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_acosh (x, y, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_acosh (x, y, MPFR_RNDN); if (MPFR_IS_INF(x) || MPFR_IS_NAN(x) ) { printf ("Inf flag not clears in acosh!\n"); @@ -60,23 +60,23 @@ special (void) } MPFR_SET_NAN(x); - mpfr_acosh (x, y, GMP_RNDN); + mpfr_acosh (x, y, MPFR_RNDN); if (MPFR_IS_NAN(x) || MPFR_IS_INF(x) ) { printf ("NAN flag not clears in acosh!\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_acosh (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_acosh (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_acosh(0) <> NaN\n"); exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_acosh (y, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_acosh (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_acosh(-1) <> NaN\n"); @@ -84,7 +84,7 @@ special (void) } MPFR_SET_NAN(x); - mpfr_acosh (y, x, GMP_RNDN); + mpfr_acosh (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_acosh(NaN) <> NaN\n"); @@ -92,7 +92,7 @@ special (void) } mpfr_set_inf (x, 1); - mpfr_acosh (y, x, GMP_RNDN); + mpfr_acosh (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error: mpfr_acosh(+Inf) <> +Inf\n"); @@ -100,16 +100,16 @@ special (void) } mpfr_set_inf (x, -1); - mpfr_acosh (y, x, GMP_RNDN); + mpfr_acosh (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_acosh(-Inf) <> NaN\n"); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_div_2exp (x, x, 1, GMP_RNDN); - mpfr_acosh (y, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_div_2exp (x, x, 1, MPFR_RNDN); + mpfr_acosh (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_acosh(1/2) <> NaN\n"); @@ -119,7 +119,7 @@ special (void) mpfr_set_prec (x, 32); mpfr_set_prec (y, 32); mpfr_set_str_binary (x, "1.000001101011101111001011"); - mpfr_acosh (y, x, GMP_RNDN); + mpfr_acosh (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.111010100101101001010001101001E-2"); if (mpfr_cmp (x, y)) { @@ -142,10 +142,10 @@ bug20070831 (void) mpfr_init2 (y, 32); mpfr_init2 (z, 32); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_nextabove (x); - inex = mpfr_acosh (y, x, GMP_RNDZ); - mpfr_set_ui_2exp (z, 1, -127, GMP_RNDN); + inex = mpfr_acosh (y, x, MPFR_RNDZ); + mpfr_set_ui_2exp (z, 1, -127, MPFR_RNDN); mpfr_nextbelow (z); if (!mpfr_equal_p (y, z)) { @@ -159,7 +159,7 @@ bug20070831 (void) mpfr_nextabove (x); mpfr_set_prec (y, 29); - inex = mpfr_acosh (y, x, GMP_RNDN); + inex = mpfr_acosh (y, x, MPFR_RNDN); mpfr_set_str_binary (z, "1.011010100000100111100110011E-127"); if (!mpfr_equal_p (y, z)) { @@ -182,8 +182,8 @@ huge (void) /* TODO: extend the exponent range and use mpfr_get_emax (). */ mpfr_inits2 (32, x, y, z, (mpfr_ptr) 0); - mpfr_set_ui_2exp (x, 1, 1073741822, GMP_RNDN); - inex = mpfr_acosh (y, x, GMP_RNDN); + mpfr_set_ui_2exp (x, 1, 1073741822, MPFR_RNDN); + inex = mpfr_acosh (y, x, MPFR_RNDN); mpfr_set_str_binary (z, "0.10110001011100100001011111110101E30"); if (!mpfr_equal_p (y, z)) { diff --git a/tests/tadd.c b/tests/tadd.c index fee6eebe4..f1efb7a9a 100644 --- a/tests/tadd.c +++ b/tests/tadd.c @@ -38,7 +38,7 @@ test_add (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) { int res; #ifdef CHECK_EXTERNAL - int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_number_p (c); + int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c); if (ok) { mpfr_print_raw (b); @@ -94,7 +94,7 @@ pcheck (const char *xs, const char *ys, const char *zs, mp_rnd_t rnd_mode, if (mpfr_cmp_str1 (zz, zs) ) { printf ("expected sum is %s, got ", zs); - mpfr_out_str(stdout, 10, 0, zz, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN); printf ("mpfr_add failed for x=%s y=%s with rnd_mode=%s\n", xs, ys, mpfr_print_rnd_mode (rnd_mode)); exit (1); @@ -114,12 +114,12 @@ check2b (const char *xs, int px, mpfr_set_str_binary (xx, xs); mpfr_set_str_binary (yy, ys); test_add (zz, xx, yy, rnd_mode); - if (mpfr_cmp_str (zz, rs, 2, GMP_RNDN)) + if (mpfr_cmp_str (zz, rs, 2, MPFR_RNDN)) { printf ("(2) x=%s,%d y=%s,%d pz=%d,rnd=%s\n", xs, px, ys, py, pz, mpfr_print_rnd_mode (rnd_mode)); printf ("got "); mpfr_print_binary(zz); puts (""); - mpfr_set_str(zz, rs, 2, GMP_RNDN); + mpfr_set_str(zz, rs, 2, MPFR_RNDN); printf ("instead of "); mpfr_print_binary(zz); puts (""); exit (1); } @@ -140,14 +140,14 @@ check64 (void) mpfr_set_prec (t, 58); mpfr_set_str_binary (t, "0.11100010011111001001100110010111110110011000000100101E-1"); mpfr_set_prec (u, 29); - test_add (u, x, t, GMP_RNDD); + test_add (u, x, t, MPFR_RNDD); mpfr_set_str_binary (t, "1.0101011100001000011100111110e-1"); if (mpfr_cmp (u, t)) { printf ("mpfr_add(u, x, t) failed for prec(x)=29, prec(t)=58\n"); - printf ("expected "); mpfr_out_str (stdout, 2, 29, t, GMP_RNDN); + printf ("expected "); mpfr_out_str (stdout, 2, 29, t, MPFR_RNDN); puts (""); - printf ("got "); mpfr_out_str (stdout, 2, 29, u, GMP_RNDN); + printf ("got "); mpfr_out_str (stdout, 2, 29, u, MPFR_RNDN); puts (""); exit(1); } @@ -157,7 +157,7 @@ check64 (void) mpfr_set_prec (t, 2); mpfr_set_str_binary (t, "-1.1e-2"); mpfr_set_prec (u, 2); - test_add (u, x, t, GMP_RNDN); + test_add (u, x, t, MPFR_RNDN); if (MPFR_MANT(u)[0] << 2) { printf ("result not normalized for prec=2\n"); @@ -169,7 +169,7 @@ check64 (void) { printf ("mpfr_add(u, x, t) failed for prec(x)=4, prec(t)=2\n"); printf ("expected -1.0e-1\n"); - printf ("got "); mpfr_out_str (stdout, 2, 4, u, GMP_RNDN); + printf ("got "); mpfr_out_str (stdout, 2, 4, u, MPFR_RNDN); puts (""); exit (1); } @@ -179,12 +179,12 @@ check64 (void) mpfr_set_prec (t, 4); mpfr_set_str_binary (t, "-1.110e-5"); /* -7/128 */ mpfr_set_prec (u, 4); - test_add (u, x, t, GMP_RNDN); /* should give -5/8 */ + test_add (u, x, t, MPFR_RNDN); /* should give -5/8 */ mpfr_set_str_binary (t, "-1.010e-1"); if (mpfr_cmp (u, t)) { printf ("mpfr_add(u, x, t) failed for prec(x)=8, prec(t)=4\n"); printf ("expected -1.010e-1\n"); - printf ("got "); mpfr_out_str (stdout, 2, 4, u, GMP_RNDN); + printf ("got "); mpfr_out_str (stdout, 2, 4, u, MPFR_RNDN); puts (""); exit (1); } @@ -192,7 +192,7 @@ check64 (void) mpfr_set_prec (x, 112); mpfr_set_prec (t, 98); mpfr_set_prec (u, 54); mpfr_set_str_binary (x, "-0.11111100100000000011000011100000101101010001000111E-401"); mpfr_set_str_binary (t, "0.10110000100100000101101100011111111011101000111000101E-464"); - test_add (u, x, t, GMP_RNDN); + test_add (u, x, t, MPFR_RNDN); if (mpfr_cmp (u, x)) { printf ("mpfr_add(u, x, t) failed for prec(x)=112, prec(t)=98\n"); @@ -200,9 +200,9 @@ check64 (void) } mpfr_set_prec (x, 92); mpfr_set_prec (t, 86); mpfr_set_prec (u, 53); - mpfr_set_str (x, "-5.03525136761487735093e-74", 10, GMP_RNDN); - mpfr_set_str (t, "8.51539046314262304109e-91", 10, GMP_RNDN); - test_add (u, x, t, GMP_RNDN); + mpfr_set_str (x, "-5.03525136761487735093e-74", 10, MPFR_RNDN); + mpfr_set_str (t, "8.51539046314262304109e-91", 10, MPFR_RNDN); + test_add (u, x, t, MPFR_RNDN); if (mpfr_cmp_str1 (u, "-5.0352513676148773509283672e-74") ) { printf ("mpfr_add(u, x, t) failed for prec(x)=92, prec(t)=86\n"); @@ -212,7 +212,7 @@ check64 (void) mpfr_set_prec(x, 53); mpfr_set_prec(t, 76); mpfr_set_prec(u, 76); mpfr_set_str_binary(x, "-0.10010010001001011011110000000000001010011011011110001E-32"); mpfr_set_str_binary(t, "-0.1011000101110010000101111111011111010001110011110111100110101011110010011111"); - mpfr_sub(u, x, t, GMP_RNDU); + mpfr_sub(u, x, t, MPFR_RNDU); mpfr_set_str_binary(t, "0.1011000101110010000101111111011100111111101010011011110110101011101000000100"); if (mpfr_cmp(u,t)) { @@ -223,7 +223,7 @@ check64 (void) mpfr_set_prec(x, 53); mpfr_set_prec(t, 108); mpfr_set_prec(u, 108); mpfr_set_str_binary(x, "-0.10010010001001011011110000000000001010011011011110001E-32"); mpfr_set_str_binary(t, "-0.101100010111001000010111111101111101000111001111011110011010101111001001111000111011001110011000000000111111"); - mpfr_sub(u, x, t, GMP_RNDU); + mpfr_sub(u, x, t, MPFR_RNDU); mpfr_set_str_binary(t, "0.101100010111001000010111111101110011111110101001101111011010101110100000001011000010101110011000000000111111"); if (mpfr_cmp(u,t)) { @@ -233,8 +233,8 @@ check64 (void) } mpfr_set_prec(x, 97); mpfr_set_prec(t, 97); mpfr_set_prec(u, 97); mpfr_set_str_binary(x, "0.1111101100001000000001011000110111101000001011111000100001000101010100011111110010000000000000000E-39"); - mpfr_set_ui(t, 1, GMP_RNDN); - test_add (u, x, t, GMP_RNDN); + mpfr_set_ui(t, 1, MPFR_RNDN); + test_add (u, x, t, MPFR_RNDN); mpfr_set_str_binary(x, "0.1000000000000000000000000000000000000000111110110000100000000101100011011110100000101111100010001E1"); if (mpfr_cmp(u,x)) { @@ -243,17 +243,17 @@ check64 (void) } mpfr_set_prec(x, 128); mpfr_set_prec(t, 128); mpfr_set_prec(u, 128); mpfr_set_str_binary(x, "0.10101011111001001010111011001000101100111101000000111111111011010100001100011101010001010111111101111010100110111111100101100010E-4"); - mpfr_set(t, x, GMP_RNDN); - mpfr_sub(u, x, t, GMP_RNDN); + mpfr_set(t, x, MPFR_RNDN); + mpfr_sub(u, x, t, MPFR_RNDN); mpfr_set_prec(x, 96); mpfr_set_prec(t, 96); mpfr_set_prec(u, 96); mpfr_set_str_binary(x, "0.111000000001110100111100110101101001001010010011010011100111100011010100011001010011011011000010E-4"); - mpfr_set(t, x, GMP_RNDN); - mpfr_sub(u, x, t, GMP_RNDN); + mpfr_set(t, x, MPFR_RNDN); + mpfr_sub(u, x, t, MPFR_RNDN); mpfr_set_prec(x, 85); mpfr_set_prec(t, 85); mpfr_set_prec(u, 85); mpfr_set_str_binary(x, "0.1111101110100110110110100010101011101001100010100011110110110010010011101100101111100E-4"); mpfr_set_str_binary(t, "0.1111101110100110110110100010101001001000011000111000011101100101110100001110101010110E-4"); - mpfr_sub(u, x, t, GMP_RNDU); - mpfr_sub(x, x, t, GMP_RNDU); + mpfr_sub(u, x, t, MPFR_RNDU); + mpfr_sub(x, x, t, MPFR_RNDU); if (mpfr_cmp(x, u) != 0) { printf ("Error in mpfr_sub: u=x-t and x=x-t give different results\n"); @@ -268,7 +268,7 @@ check64 (void) mpfr_set_prec(x, 65); mpfr_set_prec(t, 65); mpfr_set_prec(u, 65); mpfr_set_str_binary(x, "0.10011010101000110101010000000011001001001110001011101011111011101E623"); mpfr_set_str_binary(t, "0.10011010101000110101010000000011001001001110001011101011111011100E623"); - mpfr_sub(u, x, t, GMP_RNDU); + mpfr_sub(u, x, t, MPFR_RNDU); if (mpfr_cmp_ui_2exp(u, 1, 558)) { /* 2^558 */ printf ("Error (1) in mpfr_sub\n"); @@ -278,10 +278,10 @@ check64 (void) mpfr_set_prec(x, 64); mpfr_set_prec(t, 64); mpfr_set_prec(u, 64); mpfr_set_str_binary(x, "0.1000011110101111011110111111000011101011101111101101101100000100E-220"); mpfr_set_str_binary(t, "0.1000011110101111011110111111000011101011101111101101010011111101E-220"); - test_add (u, x, t, GMP_RNDU); + test_add (u, x, t, MPFR_RNDU); if ((MPFR_MANT(u)[0] & 1) != 1) { - printf ("error in mpfr_add with rnd_mode=GMP_RNDU\n"); + printf ("error in mpfr_add with rnd_mode=MPFR_RNDU\n"); printf ("b= "); mpfr_print_binary(x); puts (""); printf ("c= "); mpfr_print_binary(t); puts (""); printf ("b+c="); mpfr_print_binary(u); puts (""); @@ -292,31 +292,31 @@ check64 (void) mpfr_set_prec(x, 56); mpfr_set_prec(t, 83); mpfr_set_prec(u, 10); mpfr_set_str_binary(x, "0.10001001011011001111101100110100000101111010010111010111E-7"); mpfr_set_str_binary(t, "0.10001001011011001111101100110100000101111010010111010111000000000111110110110000100E-7"); - mpfr_sub(u, x, t, GMP_RNDU); + mpfr_sub(u, x, t, MPFR_RNDU); /* array bound write found by Norbert Mueller, 26 Sep 2000 */ mpfr_set_prec(x, 109); mpfr_set_prec(t, 153); mpfr_set_prec(u, 95); mpfr_set_str_binary(x,"0.1001010000101011101100111000110001111111111111111111111111111111111111111111111111111111111111100000000000000E33"); mpfr_set_str_binary(t,"-0.100101000010101110110011100011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100101101000000100100001100110111E33"); - test_add (u, x, t, GMP_RNDN); + test_add (u, x, t, MPFR_RNDN); /* array bound writes found by Norbert Mueller, 27 Sep 2000 */ mpfr_set_prec(x, 106); mpfr_set_prec(t, 53); mpfr_set_prec(u, 23); mpfr_set_str_binary(x, "-0.1000011110101111111001010001000100001011000000000000000000000000000000000000000000000000000000000000000000E-59"); mpfr_set_str_binary(t, "-0.10000111101011111110010100010001101100011100110100000E-59"); - mpfr_sub(u, x, t, GMP_RNDN); + mpfr_sub(u, x, t, MPFR_RNDN); mpfr_set_prec(x, 177); mpfr_set_prec(t, 217); mpfr_set_prec(u, 160); mpfr_set_str_binary(x, "-0.111010001011010000111001001010010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E35"); mpfr_set_str_binary(t, "0.1110100010110100001110010010100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111011010011100001111001E35"); - test_add (u, x, t, GMP_RNDN); + test_add (u, x, t, MPFR_RNDN); mpfr_set_prec(x, 214); mpfr_set_prec(t, 278); mpfr_set_prec(u, 207); mpfr_set_str_binary(x, "0.1000100110100110101101101101000000010000100111000001001110001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E66"); mpfr_set_str_binary(t, "-0.10001001101001101011011011010000000100001001110000010011100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111011111001001100011E66"); - test_add (u, x, t, GMP_RNDN); + test_add (u, x, t, MPFR_RNDN); mpfr_set_prec(x, 32); mpfr_set_prec(t, 247); mpfr_set_prec(u, 223); mpfr_set_str_binary(x, "0.10000000000000000000000000000000E1"); mpfr_set_str_binary(t, "0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100000100011110000101110110011101110100110110111111011010111100100000000000000000000000000E0"); - mpfr_sub(u, x, t, GMP_RNDN); + mpfr_sub(u, x, t, MPFR_RNDN); if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] & ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0) { @@ -330,7 +330,7 @@ check64 (void) mpfr_set_prec (u, 65); mpfr_set_str_binary (x, "0.11100100101101001100111011111111110001101001000011101001001010010E-35"); mpfr_set_str_binary (t, "0.10000000000000000000000000000000000001110010010110100110011110000E1"); - mpfr_sub (u, t, x, GMP_RNDU); + mpfr_sub (u, t, x, MPFR_RNDU); if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] & ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0) { @@ -344,7 +344,7 @@ check64 (void) mpfr_set_prec (u, 107); mpfr_set_str_binary (x, "0.10111001001111010010001000000010111111011011011101000001001000101000000000000000000000000000000000000000000E315"); mpfr_set_str_binary (t, "0.10000000000000000000000000000000000101110100100101110110000001100101011111001000011101111100100100111011000E350"); - mpfr_sub (u, x, t, GMP_RNDU); + mpfr_sub (u, x, t, MPFR_RNDU); if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] & ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0) { @@ -353,14 +353,14 @@ check64 (void) } /* checks that NaN flag is correctly reset */ - mpfr_set_ui (t, 1, GMP_RNDN); - mpfr_set_ui (u, 1, GMP_RNDN); + mpfr_set_ui (t, 1, MPFR_RNDN); + mpfr_set_ui (u, 1, MPFR_RNDN); mpfr_set_nan (x); - test_add (x, t, u, GMP_RNDN); + test_add (x, t, u, MPFR_RNDN); if (mpfr_cmp_ui (x, 2)) { printf ("Error in mpfr_add: 1+1 gives "); - mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); exit (1); } @@ -387,20 +387,20 @@ check_case_1b (void) dif = prec_b - prec_a; mpfr_set_prec (b, prec_b); /* b = 1 - 2^(-prec_a) + 2^(-prec_b) */ - mpfr_set_ui (b, 1, GMP_RNDN); - mpfr_div_2exp (b, b, dif, GMP_RNDN); - mpfr_sub_ui (b, b, 1, GMP_RNDN); - mpfr_div_2exp (b, b, prec_a, GMP_RNDN); - mpfr_add_ui (b, b, 1, GMP_RNDN); + mpfr_set_ui (b, 1, MPFR_RNDN); + mpfr_div_2exp (b, b, dif, MPFR_RNDN); + mpfr_sub_ui (b, b, 1, MPFR_RNDN); + mpfr_div_2exp (b, b, prec_a, MPFR_RNDN); + mpfr_add_ui (b, b, 1, MPFR_RNDN); for (prec_c = dif; prec_c <= 64; prec_c++) { /* c = 2^(-prec_a) - 2^(-prec_b) */ mpfr_set_prec (c, prec_c); - mpfr_set_si (c, -1, GMP_RNDN); - mpfr_div_2exp (c, c, dif, GMP_RNDN); - mpfr_add_ui (c, c, 1, GMP_RNDN); - mpfr_div_2exp (c, c, prec_a, GMP_RNDN); - test_add (a, b, c, GMP_RNDN); + mpfr_set_si (c, -1, MPFR_RNDN); + mpfr_div_2exp (c, c, dif, MPFR_RNDN); + mpfr_add_ui (c, c, 1, MPFR_RNDN); + mpfr_div_2exp (c, c, prec_a, MPFR_RNDN); + test_add (a, b, c, MPFR_RNDN); if (mpfr_cmp_ui (a, 1) != 0) { printf ("case (1b) failed for prec_a=%u, prec_b=%u," @@ -433,15 +433,15 @@ check_case_2 (void) mpfr_set_str_binary(a, "1E110"); /* a = 2^110 */ mpfr_set_str_binary(b, "1E900"); /* b = 2^900 */ mpfr_set_str_binary(c, "1E500"); /* c = 2^500 */ - test_add (c, c, a, GMP_RNDZ); /* c = 2^500 + 2^110 */ - mpfr_sub (d, b, c, GMP_RNDZ); /* d = 2^900 - 2^500 - 2^110 */ - test_add (b, b, c, GMP_RNDZ); /* b = 2^900 + 2^500 + 2^110 */ - test_add (a, b, d, GMP_RNDZ); /* a = 2^901 */ + test_add (c, c, a, MPFR_RNDZ); /* c = 2^500 + 2^110 */ + mpfr_sub (d, b, c, MPFR_RNDZ); /* d = 2^900 - 2^500 - 2^110 */ + test_add (b, b, c, MPFR_RNDZ); /* b = 2^900 + 2^500 + 2^110 */ + test_add (a, b, d, MPFR_RNDZ); /* a = 2^901 */ if (mpfr_cmp_ui_2exp (a, 1, 901)) { printf ("b + d fails for b=2^900+2^500+2^110, d=2^900-2^500-2^110\n"); printf ("expected 1.0e901, got "); - mpfr_out_str (stdout, 2, 0, a, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN); printf ("\n"); exit (1); } @@ -458,8 +458,8 @@ check_same (void) { mpfr_t x; - mpfr_init(x); mpfr_set_ui(x, 1, GMP_RNDZ); - test_add (x, x, x, GMP_RNDZ); + mpfr_init(x); mpfr_set_ui(x, 1, MPFR_RNDZ); + test_add (x, x, x, MPFR_RNDZ); if (mpfr_cmp_ui (x, 2)) { printf ("Error when all 3 operands are equal\n"); @@ -490,7 +490,7 @@ check_inexact (void) mpfr_set_prec (u, 33); mpfr_set_str_binary (u, "0.101110100101101100000000111100000E-1"); mpfr_set_prec (y, 31); - if ((inexact = test_add (y, x, u, GMP_RNDN))) + if ((inexact = test_add (y, x, u, MPFR_RNDN))) { printf ("Wrong inexact flag (2): expected 0, got %d\n", inexact); exit (1); @@ -501,7 +501,7 @@ check_inexact (void) mpfr_set_prec (u, 33); mpfr_set_str_binary (u, "0.101110100101101100000000111100000E-1"); mpfr_set_prec (y, 28); - if ((inexact = test_add (y, x, u, GMP_RNDN))) + if ((inexact = test_add (y, x, u, MPFR_RNDN))) { printf ("Wrong inexact flag (1): expected 0, got %d\n", inexact); exit (1); @@ -581,34 +581,34 @@ check_nans (void) /* +inf + -inf == nan */ mpfr_set_inf (x, 1); mpfr_set_inf (y, -1); - test_add (s, x, y, GMP_RNDN); + test_add (s, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (s)); /* +inf + 1 == +inf */ mpfr_set_inf (x, 1); - mpfr_set_ui (y, 1L, GMP_RNDN); - test_add (s, x, y, GMP_RNDN); + mpfr_set_ui (y, 1L, MPFR_RNDN); + test_add (s, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (s)); MPFR_ASSERTN (mpfr_sgn (s) > 0); /* -inf + 1 == -inf */ mpfr_set_inf (x, -1); - mpfr_set_ui (y, 1L, GMP_RNDN); - test_add (s, x, y, GMP_RNDN); + mpfr_set_ui (y, 1L, MPFR_RNDN); + test_add (s, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (s)); MPFR_ASSERTN (mpfr_sgn (s) < 0); /* 1 + +inf == +inf */ - mpfr_set_ui (x, 1L, GMP_RNDN); + mpfr_set_ui (x, 1L, MPFR_RNDN); mpfr_set_inf (y, 1); - test_add (s, x, y, GMP_RNDN); + test_add (s, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (s)); MPFR_ASSERTN (mpfr_sgn (s) > 0); /* 1 + -inf == -inf */ - mpfr_set_ui (x, 1L, GMP_RNDN); + mpfr_set_ui (x, 1L, MPFR_RNDN); mpfr_set_inf (y, -1); - test_add (s, x, y, GMP_RNDN); + test_add (s, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (s)); MPFR_ASSERTN (mpfr_sgn (s) < 0); @@ -624,11 +624,11 @@ check_alloc (void) mpfr_init2 (a, 10000); mpfr_set_prec (a, 53); - mpfr_set_ui (a, 15236, GMP_RNDN); - test_add (a, a, a, GMP_RNDN); - mpfr_mul (a, a, a, GMP_RNDN); - mpfr_div (a, a, a, GMP_RNDN); - mpfr_sub (a, a, a, GMP_RNDN); + mpfr_set_ui (a, 15236, MPFR_RNDN); + test_add (a, a, a, MPFR_RNDN); + mpfr_mul (a, a, a, MPFR_RNDN); + mpfr_div (a, a, a, MPFR_RNDN); + mpfr_sub (a, a, a, MPFR_RNDN); mpfr_clear (a); } @@ -643,9 +643,9 @@ check_overflow (void) mpfr_init2 (b, 256); mpfr_init2 (c, 256); - mpfr_set_ui (b, 1, GMP_RNDN); + mpfr_set_ui (b, 1, MPFR_RNDN); mpfr_setmax (b, mpfr_get_emax ()); - mpfr_set_ui (c, 1, GMP_RNDN); + mpfr_set_ui (c, 1, MPFR_RNDN); mpfr_set_exp (c, mpfr_get_emax () - 192); RND_LOOP(r) for (prec_a = 128; prec_a < 512; prec_a += 64) @@ -663,7 +663,7 @@ check_overflow (void) mpfr_set_exp (c, mpfr_get_emax () - 512); mpfr_set_prec (a, 256); mpfr_clear_overflow (); - test_add (a, b, c, GMP_RNDU); + test_add (a, b, c, MPFR_RNDU); if (!mpfr_overflow_p ()) { printf ("No overflow in check_overflow\n"); @@ -682,7 +682,7 @@ check_1111 (void) long n; mpfr_init2 (one, MPFR_PREC_MIN); - mpfr_set_ui (one, 1, GMP_RNDN); + mpfr_set_ui (one, 1, MPFR_RNDN); for (n = 0; n < NUM; n++) { mp_prec_t prec_a, prec_b, prec_c; @@ -703,25 +703,25 @@ check_1111 (void) if (sb != 0) { tb = 1 + (randlimb () % (prec_b - (sb != 2))); - mpfr_div_2ui (b, one, tb, GMP_RNDN); + mpfr_div_2ui (b, one, tb, MPFR_RNDN); if (sb == 2) - mpfr_neg (b, b, GMP_RNDN); - test_add (b, b, one, GMP_RNDN); + mpfr_neg (b, b, MPFR_RNDN); + test_add (b, b, one, MPFR_RNDN); } else - mpfr_set (b, one, GMP_RNDN); + mpfr_set (b, one, MPFR_RNDN); tc = 1 + (randlimb () % (prec_c - 1)); - mpfr_div_2ui (c, one, tc, GMP_RNDN); + mpfr_div_2ui (c, one, tc, MPFR_RNDN); sc = randlimb () % 2; if (sc) - mpfr_neg (c, c, GMP_RNDN); - test_add (c, c, one, GMP_RNDN); + mpfr_neg (c, c, MPFR_RNDN); + test_add (c, c, one, MPFR_RNDN); diff = (randlimb () % (2*m)) - m; - mpfr_mul_2si (c, c, diff, GMP_RNDN); + mpfr_mul_2si (c, c, diff, MPFR_RNDN); 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 */ + inex_s = test_add (s, b, c, MPFR_RNDN); /* exact */ if (inex_s) { printf ("check_1111: result should have been exact.\n"); @@ -778,21 +778,21 @@ check_1minuseps (void) mpfr_init2 (a, prec_a[ia]); mpfr_init2 (b, prec_b); - mpfr_set_ui (c, 1, GMP_RNDN); - mpfr_div_ui (b, c, prec_a[ia], GMP_RNDN); - mpfr_sub (b, c, b, GMP_RNDN); /* b = 1 - 2^(-prec_a) */ + mpfr_set_ui (c, 1, MPFR_RNDN); + mpfr_div_ui (b, c, prec_a[ia], MPFR_RNDN); + mpfr_sub (b, c, b, MPFR_RNDN); /* b = 1 - 2^(-prec_a) */ for (ic = 0; ic < numberof(supp_b); ic++) - for (rnd_mode = 0; rnd_mode < GMP_RND_MAX; rnd_mode++) + for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX; rnd_mode++) { mpfr_t s; int inex_a, inex_s; - mpfr_set_ui (c, 1, GMP_RNDN); - mpfr_div_ui (c, c, prec_a[ia] + supp_b[ic], GMP_RNDN); + mpfr_set_ui (c, 1, MPFR_RNDN); + mpfr_div_ui (c, c, prec_a[ia] + supp_b[ic], MPFR_RNDN); inex_a = test_add (a, b, c, (mp_rnd_t) rnd_mode); mpfr_init2 (s, 256); - inex_s = test_add (s, b, c, GMP_RNDN); /* exact */ + inex_s = test_add (s, b, c, MPFR_RNDN); /* exact */ if (inex_s) { printf ("check_1minuseps: result should have been exact " @@ -829,239 +829,239 @@ tests (void) check_case_2 (); check64(); - check("293607738.0", "1.9967571564050541e-5", GMP_RNDU, 64, 53, 53, + check("293607738.0", "1.9967571564050541e-5", MPFR_RNDU, 64, 53, 53, "2.9360773800002003e8"); - check("880524.0", "-2.0769715792901673e-5", GMP_RNDN, 64, 53, 53, + check("880524.0", "-2.0769715792901673e-5", MPFR_RNDN, 64, 53, 53, "8.8052399997923023e5"); - check("1196426492.0", "-1.4218093058435347e-3", GMP_RNDN, 64, 53, 53, + check("1196426492.0", "-1.4218093058435347e-3", MPFR_RNDN, 64, 53, 53, "1.1964264919985781e9"); - check("982013018.0", "-8.941829477291838e-7", GMP_RNDN, 64, 53, 53, + check("982013018.0", "-8.941829477291838e-7", MPFR_RNDN, 64, 53, 53, "9.8201301799999905e8"); - check("1092583421.0", "1.0880649218158844e9", GMP_RNDN, 64, 53, 53, + check("1092583421.0", "1.0880649218158844e9", MPFR_RNDN, 64, 53, 53, "2.1806483428158846e9"); - check("1.8476886419022969e-6", "961494401.0", GMP_RNDN, 53, 64, 53, + check("1.8476886419022969e-6", "961494401.0", MPFR_RNDN, 53, 64, 53, "9.6149440100000179e8"); - check("-2.3222118418069868e5", "1229318102.0", GMP_RNDN, 53, 64, 53, + check("-2.3222118418069868e5", "1229318102.0", MPFR_RNDN, 53, 64, 53, "1.2290858808158193e9"); - check("-3.0399171300395734e-6", "874924868.0", GMP_RNDN, 53, 64, 53, + check("-3.0399171300395734e-6", "874924868.0", MPFR_RNDN, 53, 64, 53, "8.749248679999969e8"); - check("9.064246624706179e1", "663787413.0", GMP_RNDN, 53, 64, 53, + check("9.064246624706179e1", "663787413.0", MPFR_RNDN, 53, 64, 53, "6.6378750364246619e8"); - check("-1.0954322421551264e2", "281806592.0", GMP_RNDD, 53, 64, 53, + check("-1.0954322421551264e2", "281806592.0", MPFR_RNDD, 53, 64, 53, "2.8180648245677572e8"); - check("5.9836930386056659e-8", "1016217213.0", GMP_RNDN, 53, 64, 53, + check("5.9836930386056659e-8", "1016217213.0", MPFR_RNDN, 53, 64, 53, "1.0162172130000001e9"); - check("-1.2772161928500301e-7", "1237734238.0", GMP_RNDN, 53, 64, 53, + check("-1.2772161928500301e-7", "1237734238.0", MPFR_RNDN, 53, 64, 53, "1.2377342379999998e9"); - check("-4.567291988483277e8", "1262857194.0", GMP_RNDN, 53, 64, 53, + check("-4.567291988483277e8", "1262857194.0", MPFR_RNDN, 53, 64, 53, "8.0612799515167236e8"); - check("4.7719471752925262e7", "196089880.0", GMP_RNDN, 53, 53, 53, + check("4.7719471752925262e7", "196089880.0", MPFR_RNDN, 53, 53, 53, "2.4380935175292528e8"); - check("4.7719471752925262e7", "196089880.0", GMP_RNDN, 53, 64, 53, + check("4.7719471752925262e7", "196089880.0", MPFR_RNDN, 53, 64, 53, "2.4380935175292528e8"); - check("-1.716113812768534e-140", "1271212614.0", GMP_RNDZ, 53, 64, 53, + check("-1.716113812768534e-140", "1271212614.0", MPFR_RNDZ, 53, 64, 53, "1.2712126139999998e9"); - check("-1.2927455200185474e-50", "1675676122.0", GMP_RNDD, 53, 64, 53, + check("-1.2927455200185474e-50", "1675676122.0", MPFR_RNDD, 53, 64, 53, "1.6756761219999998e9"); - check53("1.22191250737771397120e+20", "948002822.0", GMP_RNDN, + check53("1.22191250737771397120e+20", "948002822.0", MPFR_RNDN, "122191250738719408128.0"); - check53("9966027674114492.0", "1780341389094537.0", GMP_RNDN, + check53("9966027674114492.0", "1780341389094537.0", MPFR_RNDN, "11746369063209028.0"); check53("2.99280481918991653800e+272", "5.34637717585790933424e+271", - GMP_RNDN, "3.5274425367757071711e272"); + MPFR_RNDN, "3.5274425367757071711e272"); check_same(); check53("6.14384195492641560499e-02", "-6.14384195401037683237e-02", - GMP_RNDU, "9.1603877261370314499e-12"); + MPFR_RNDU, "9.1603877261370314499e-12"); check53("1.16809465359248765399e+196", "7.92883212101990665259e+196", - GMP_RNDU, "9.0969267746123943065e196"); - check53("3.14553393112021279444e-67", "3.14553401015952024126e-67", GMP_RNDU, + MPFR_RNDU, "9.0969267746123943065e196"); + check53("3.14553393112021279444e-67", "3.14553401015952024126e-67", MPFR_RNDU, "6.2910679412797336946e-67"); - check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",GMP_RNDN, + check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",MPFR_RNDN, "5.4388530464436950905e185"); - check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",GMP_RNDZ, + check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",MPFR_RNDZ, "5.4388530464436944867e185"); - check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",GMP_RNDU, + check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",MPFR_RNDU, "5.4388530464436950905e185"); - check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",GMP_RNDD, + check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",MPFR_RNDD, "5.4388530464436944867e185"); check2b("1.001010101110011000000010100101110010111001010000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e358",187, "-1.11100111001101100010001111111110101101110001000000000000000000000000000000000000000000e160",87, "1.001010101110011000000010100101110010111001010000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111e358",178, - GMP_RNDD); + MPFR_RNDD); check2b("-1.111100100011100111010101010101001010100100000111001000000000000000000e481",70, "1.1111000110100011110101111110110010010000000110101000000000000000e481",65, "-1.001010111111101011010000001100011101100101000000000000000000e472",61, - GMP_RNDD); + MPFR_RNDD); check2b("1.0100010111010000100101000000111110011100011001011010000000000000000000000000000000e516",83, "-1.1001111000100001011100000001001100110011110010111111000000e541",59, "-1.1001111000100001011011110111000001001011100000011110100000110001110011010011000000000000000000000000000000000000000000000000e541",125, - GMP_RNDZ); + MPFR_RNDZ); check2b("-1.0010111100000100110001011011010000000011000111101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e261",155, "-1.00111110100011e239",15, "-1.00101111000001001100101010101110001100110001111010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e261",159, - GMP_RNDD); + MPFR_RNDD); check2b("-1.110111000011111011000000001001111101101001010100111000000000000000000000000e880",76, "-1.1010010e-634",8, "-1.11011100001111101100000000100111110110100101010011100000000000000000000000e880",75, - GMP_RNDZ); + MPFR_RNDZ); check2b("1.00100100110110101001010010101111000001011100100101010000000000000000000000000000e-530",81, "-1.101101111100000111000011001010110011001011101001110100000e-908",58, "1.00100100110110101001010010101111000001011100100101010e-530",54, - GMP_RNDN); + MPFR_RNDN); check2b("1.0101100010010111101000000001000010010010011000111011000000000000000000000000000000000000000000000000000000000000000000e374",119, "1.11100101100101e358",15, "1.01011000100110011000010110100100100100100110001110110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e374",150, - GMP_RNDZ); + MPFR_RNDZ); check2b("-1.10011001000010100000010100100110110010011111101111000000000000000000000000000000000000000000000000000000000000000000e-172",117, "1.111011100000101010110000100100110100100001001000011100000000e-173",61, "-1.0100010000001001010110011011101001001011101011110001000000000000000e-173",68, - GMP_RNDZ); + MPFR_RNDZ); check2b("-1.011110000111101011100001100110100011100101000011011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-189",175, "1.1e631",2, "1.011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111e631",115, - GMP_RNDZ); + MPFR_RNDZ); check2b("-1.101011101001011101100011001000001100010100001101011000000000000000000000000000000000000000000e-449",94, "-1.01111101010111000011000110011101000111001100110111100000000000000e-429",66, "-1.01111101010111000100110010000110100100101111111111101100010100001101011000000000000000000000000000000000000000e-429",111, - GMP_RNDU); + MPFR_RNDU); check2b("-1.101011101001011101100011001000001100010100001101011000000000000000000000000000000000000000000e-449",94, "-1.01111101010111000011000110011101000111001100110111100000000000000e-429",66, "-1.01111101010111000100110010000110100100101111111111101100010100001101011000000000000000000000000000000000000000e-429",111, - GMP_RNDD); + MPFR_RNDD); check2b("-1.1001000011101000110000111110010100100101110101111100000000000000000000000000000000000000000000000000000000e-72",107, "-1.001100011101100100010101101010101011010010111111010000000000000000000000000000e521",79, "-1.00110001110110010001010110101010101101001011111101000000000000000000000000000000000000000000000001e521",99, - GMP_RNDD); + MPFR_RNDD); check2b("-1.01010001111000000101010100100100110101011011100001110000000000e498",63, "1.010000011010101111000100111100011100010101011110010100000000000e243",64, "-1.010100011110000001010101001001001101010110111000011100000000000e498",64, - GMP_RNDN); + MPFR_RNDN); check2b("1.00101100010101000011010000011000111111011110010111000000000000000000000000000000000000000000000000000000000e178",108, "-1.10101101010101000110011011111001001101111111110000100000000e160",60, "1.00101100010100111100100011000011111001000010011101110010000000001111100000000000000000000000000000000000e178",105, - GMP_RNDN); + MPFR_RNDN); check2b("1.00110011010100111110011010110100111101110101100100110000000000000000000000000000000000000000000000e559",99, "-1.011010110100111011100110100110011100000000111010011000000000000000e559",67, "-1.101111111101011111111111001001100100011100001001100000000000000000000000000000000000000000000e556",94, - GMP_RNDU); + MPFR_RNDU); check2b("-1.100000111100101001100111011100011011000001101001111100000000000000000000000000e843",79, "-1.1101101010110000001001000100001100110011000110110111000000000000000000000000000000000000000000e414",95, "-1.1000001111001010011001110111000110110000011010100000e843",53, - GMP_RNDD); + MPFR_RNDD); check2b("-1.110110010110100010100011000110111001010000010111110000000000e-415",61, "-1.0000100101100001111100110011111111110100011101101011000000000000000000e751",71, "-1.00001001011000011111001100111111111101000111011010110e751",54, - GMP_RNDN); + MPFR_RNDN); check2b("-1.1011011011110001001101010101001000010100010110111101000000000000000000000e258",74, "-1.00011100010110110101001011000100100000100010101000010000000000000000000000000000000000000000000000e268",99, "-1.0001110011001001000011110001000111010110101011110010011011110100000000000000000000000000000000000000e268",101, - GMP_RNDD); + MPFR_RNDD); check2b("-1.1011101010011101011000000100100110101101101110000001000000000e629",62, "1.111111100000011100100011100000011101100110111110111000000000000000000000000000000000000000000e525",94, "-1.101110101001110101100000010010011010110110111000000011111111111111111111111111111111111111111111111111101e629",106, - GMP_RNDD); + MPFR_RNDD); check2b("1.111001000010001100010000001100000110001011110111011000000000000000000000000000000000000e152",88, "1.111110111001100100000100111111010111000100111111001000000000000000e152",67, "1.1110111111011110000010101001011011101010000110110100e153",53, - GMP_RNDN); + MPFR_RNDN); check2b("1.000001100011110010110000110100001010101101111011110100e696",55, "-1.1011001111011100100001011110100101010101110111010101000000000000000000000000000000000000000000000000000000000000e730",113, "-1.1011001111011100100001011110100100010100010011100010e730",53, - GMP_RNDN); + MPFR_RNDN); check2b("-1.11010111100001001111000001110101010010001111111001100000000000000000000000000000000000000000000000000000000000e530",111, "1.01110100010010000000010110111101011101000001111101100000000000000000000000000000000000000000000000e530",99, "-1.1000110011110011101010101101111101010011011111000000000000000e528",62, - GMP_RNDD); + MPFR_RNDD); check2b("-1.0001100010010100111101101011101000100100010011100011000000000000000000000000000000000000000000000000000000000e733",110, "-1.001000000111110010100101010100110111001111011011001000000000000000000000000000000000000000000000000000000000e710",109, "-1.000110001001010011111000111110110001110110011000110110e733",55, - GMP_RNDN); + MPFR_RNDN); check2b("-1.1101011110000100111100000111010101001000111111100110000000000000000000000e530",74, "1.01110100010010000000010110111101011101000001111101100000000000000000000000000000000000000000000000000000000000e530",111, "-1.10001100111100111010101011011111010100110111110000000000000000000000000000e528",75, - GMP_RNDU); + MPFR_RNDU); check2b("1.00110011010100111110011010110100111101110101100100110000000000000000000000000000000000000000000000e559",99, "-1.011010110100111011100110100110011100000000111010011000000000000000e559",67, "-1.101111111101011111111111001001100100011100001001100000000000000000000000000000000000000000000e556",94, - GMP_RNDU); + MPFR_RNDU); check2b("-1.100101111110110000000110111111011010011101101111100100000000000000e-624",67, "1.10111010101110100000010110101000000000010011100000100000000e-587",60, "1.1011101010111010000001011010011111110100011110001011111111001000000100101100010010000011100000000000000000000e-587",110, - GMP_RNDU); + MPFR_RNDU); check2b("-1.10011001000010100000010100100110110010011111101111000000000000000000000000000000000000000000000000000000000000000000e-172",117, "1.111011100000101010110000100100110100100001001000011100000000e-173",61, "-1.0100010000001001010110011011101001001011101011110001000000000000000e-173",68, - GMP_RNDZ); + MPFR_RNDZ); check2b("1.1000111000110010101001010011010011101100010110001001000000000000000000000000000000000000000000000000e167",101, "1.0011110010000110000000101100100111000001110110110000000000000000000000000e167",74, "1.01100101010111000101001111111111010101110001100111001000000000000000000000000000000000000000000000000000e168",105, - GMP_RNDZ); + MPFR_RNDZ); check2b("1.100101111111110010100101110111100001110000100001010000000000000000000000000000000000000000000000e808",97, "-1.1110011001100000100000111111110000110010100111001011000000000000000000000000000000e807",83, "1.01001001100110001100011111000000000001011010010111010000000000000000000000000000000000000000000e807",96, - GMP_RNDN); + MPFR_RNDN); check2b("1e128",128, "1e0",128, "100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e0",256, - GMP_RNDN); + MPFR_RNDN); /* Checking double precision (53 bits) */ - check53("-8.22183238641455905806e-19", "7.42227178769761587878e-19",GMP_RNDD, + check53("-8.22183238641455905806e-19", "7.42227178769761587878e-19",MPFR_RNDD, "-7.9956059871694317927e-20"); - check53("5.82106394662028628236e+234","-5.21514064202368477230e+89",GMP_RNDD, + check53("5.82106394662028628236e+234","-5.21514064202368477230e+89",MPFR_RNDD, "5.8210639466202855763e234"); check53("5.72931679569871602371e+122","-5.72886070363264321230e+122", - GMP_RNDN, "4.5609206607281141508e118"); + MPFR_RNDN, "4.5609206607281141508e118"); check53("-5.09937369394650450820e+238", "2.70203299854862982387e+250", - GMP_RNDD, "2.7020329985435301323e250"); - check53("-2.96695924472363684394e+27", "1.22842938251111500000e+16",GMP_RNDD, + MPFR_RNDD, "2.7020329985435301323e250"); + check53("-2.96695924472363684394e+27", "1.22842938251111500000e+16",MPFR_RNDD, "-2.96695924471135255027e27"); check53("1.74693641655743793422e-227", "-7.71776956366861843469e-229", - GMP_RNDN, "1.669758720920751867e-227"); + MPFR_RNDN, "1.669758720920751867e-227"); /* x = -7883040437021647.0; for (i=0; i<468; i++) x = x / 2.0;*/ check53("-1.03432206392780011159e-125", "1.30127034799251347548e-133", - GMP_RNDN, + MPFR_RNDN, "-1.0343220509150965661100887242027378881805094180354e-125"); - check53("1.05824655795525779205e+71", "-1.06022698059744327881e+71",GMP_RNDZ, + check53("1.05824655795525779205e+71", "-1.06022698059744327881e+71",MPFR_RNDZ, "-1.9804226421854867632e68"); check53("-5.84204911040921732219e+240", "7.26658169050749590763e+240", - GMP_RNDD, "1.4245325800982785854e240"); - check53("1.00944884131046636376e+221","2.33809162651471520268e+215",GMP_RNDN, + MPFR_RNDD, "1.4245325800982785854e240"); + check53("1.00944884131046636376e+221","2.33809162651471520268e+215",MPFR_RNDN, "1.0094511794020929787e221"); /*x = 7045852550057985.0; for (i=0; i<986; i++) x = x / 2.0;*/ check53("4.29232078932667367325e-278", "1.0773525047389793833221116707010783793203080117586e-281" - , GMP_RNDU, "4.2933981418314132787e-278"); - check53("5.27584773801377058681e-80", "8.91207657803547196421e-91", GMP_RNDN, + , MPFR_RNDU, "4.2933981418314132787e-278"); + check53("5.27584773801377058681e-80", "8.91207657803547196421e-91", MPFR_RNDN, "5.2758477381028917269e-80"); check53("2.99280481918991653800e+272", "5.34637717585790933424e+271", - GMP_RNDN, "3.5274425367757071711e272"); + MPFR_RNDN, "3.5274425367757071711e272"); check53("4.67302514390488041733e-184", "2.18321376145645689945e-190", - GMP_RNDN, "4.6730273271186420541e-184"); - check53("5.57294120336300389254e+71", "2.60596167942024924040e+65", GMP_RNDZ, + MPFR_RNDN, "4.6730273271186420541e-184"); + check53("5.57294120336300389254e+71", "2.60596167942024924040e+65", MPFR_RNDZ, "5.5729438093246831053e71"); - check53("6.6052588496951015469e24", "4938448004894539.0", GMP_RNDU, + check53("6.6052588496951015469e24", "4938448004894539.0", MPFR_RNDU, "6.6052588546335505068e24"); check53("1.23056185051606761523e-190", "1.64589756643433857138e-181", - GMP_RNDU, "1.6458975676649006598e-181"); + MPFR_RNDU, "1.6458975676649006598e-181"); check53("2.93231171510175981584e-280", "3.26266919161341483877e-273", - GMP_RNDU, "3.2626694848445867288e-273"); - check53("5.76707395945001907217e-58", "4.74752971449827687074e-51", GMP_RNDD, + MPFR_RNDU, "3.2626694848445867288e-273"); + check53("5.76707395945001907217e-58", "4.74752971449827687074e-51", MPFR_RNDD, "4.747530291205672325e-51"); - check53("277363943109.0", "11.0", GMP_RNDN, "277363943120.0"); + check53("277363943109.0", "11.0", MPFR_RNDN, "277363943120.0"); check53("1.44791789689198883921e-140", "-1.90982880222349071284e-121", - GMP_RNDN, "-1.90982880222349071e-121"); + MPFR_RNDN, "-1.90982880222349071e-121"); /* tests for particular cases (Vincent Lefevre, 22 Aug 2001) */ - check53("9007199254740992.0", "1.0", GMP_RNDN, "9007199254740992.0"); - check53("9007199254740994.0", "1.0", GMP_RNDN, "9007199254740996.0"); - check53("9007199254740992.0", "-1.0", GMP_RNDN, "9007199254740991.0"); - check53("9007199254740994.0", "-1.0", GMP_RNDN, "9007199254740992.0"); - check53("9007199254740996.0", "-1.0", GMP_RNDN, "9007199254740996.0"); + check53("9007199254740992.0", "1.0", MPFR_RNDN, "9007199254740992.0"); + check53("9007199254740994.0", "1.0", MPFR_RNDN, "9007199254740996.0"); + check53("9007199254740992.0", "-1.0", MPFR_RNDN, "9007199254740991.0"); + check53("9007199254740994.0", "-1.0", MPFR_RNDN, "9007199254740992.0"); + check53("9007199254740996.0", "-1.0", MPFR_RNDN, "9007199254740996.0"); check_overflow (); check_1111 (); diff --git a/tests/tadd1sp.c b/tests/tadd1sp.c index 0ff9ef2b8..60fa56367 100644 --- a/tests/tadd1sp.c +++ b/tests/tadd1sp.c @@ -44,8 +44,8 @@ check_overflow (void) mpfr_set_str1 (x, "8.00468257869324898448e+307"); mpfr_set_str1 (y, "7.44784712422708645156e+307"); - mpfr_add1sp (z1, x, y, GMP_RNDN); - mpfr_add1 (z2, x, y, GMP_RNDN); + mpfr_add1sp (z1, x, y, MPFR_RNDN); + mpfr_add1 (z2, x, y, MPFR_RNDN); if (mpfr_cmp (z1, z2)) { printf ("Overflow bug in add1sp.\n"); @@ -122,7 +122,7 @@ check_random (mp_prec_t p) if (MPFR_GET_EXP(b) < MPFR_GET_EXP(c)) mpfr_swap(b, c); if (MPFR_IS_PURE_FP(b) && MPFR_IS_PURE_FP(c)) - for (r = 0 ; r < GMP_RND_MAX ; r++) + for (r = 0 ; r < MPFR_RND_MAX ; r++) { inexact1 = mpfr_add1(a1, b, c, (mp_rnd_t) r); inexact2 = mpfr_add1sp(a2, b, c, (mp_rnd_t) r); @@ -147,7 +147,7 @@ check_special (void) mpfr_inits (a1, a2, b, c, (mpfr_ptr) 0); - for (r = 0 ; r < GMP_RND_MAX ; r++) + for (r = 0 ; r < MPFR_RND_MAX ; r++) { SET_PREC(53); mpfr_set_str1 (b, "1@100"); @@ -174,7 +174,7 @@ check_special (void) mpfr_set_str_binary (c, "1.0e1"); mpfr_set_str_binary (a2, "1.1e-1"); mpfr_set_str_binary (a1, "0.11E2"); - mpfr_add1sp (a2, c, a2, GMP_RNDN); + mpfr_add1sp (a2, c, a2, MPFR_RNDN); if (mpfr_cmp (a1, a2)) { printf ("Regression reuse test failed!\n"); diff --git a/tests/tadd_d.c b/tests/tadd_d.c index 7b8224c46..26e4dc61e 100644 --- a/tests/tadd_d.c +++ b/tests/tadd_d.c @@ -40,24 +40,24 @@ check_regulars (void) mpfr_init2 (y, IEEE_DBL_MANT_DIG); mpfr_init2 (z, IEEE_DBL_MANT_DIG); - mpfr_set_str (y, "4096", 10, GMP_RNDN); + mpfr_set_str (y, "4096", 10, MPFR_RNDN); d = 0.125; mpfr_clear_flags (); - inexact = mpfr_add_d (x, y, d, GMP_RNDN); + inexact = mpfr_add_d (x, y, d, MPFR_RNDN); if (inexact != 0) { printf ("Inexact flag error in mpfr_add_d (1)\n"); exit (1); } - mpfr_set_str (z, "4096.125", 10, GMP_RNDN); + mpfr_set_str (z, "4096.125", 10, MPFR_RNDN); if (mpfr_cmp (z, x)) { printf ("Error in mpfr_add_d ("); - mpfr_out_str (stdout, 10, 7, y, GMP_RNDN); + mpfr_out_str (stdout, 10, 7, y, MPFR_RNDN); printf (" + %.20g)\nexpected ", d); - mpfr_out_str (stdout, 10, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN); printf ("\ngot "); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } @@ -67,21 +67,21 @@ check_regulars (void) mpfr_set_prec (z, 2); mpfr_clear_flags (); - inexact = mpfr_add_d (x, y, d, GMP_RNDN); + inexact = mpfr_add_d (x, y, d, MPFR_RNDN); if (inexact == 0) { printf ("Inexact flag error in mpfr_add_d (2)\n"); exit (1); } - mpfr_set_str (z, "4096.125", 10, GMP_RNDN); + mpfr_set_str (z, "4096.125", 10, MPFR_RNDN); if (mpfr_cmp (z, x)) { printf ("Error in mpfr_add_d ("); - mpfr_out_str (stdout, 10, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN); printf (" + %.20g)\nexpected ", d); - mpfr_out_str (stdout, 10, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN); printf ("\ngot "); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } @@ -101,7 +101,7 @@ check_nans (void) /* nan + 1.0 is nan */ mpfr_set_nan (x); mpfr_clear_flags (); - inexact = mpfr_add_d (y, x, 1.0, GMP_RNDN); + inexact = mpfr_add_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); MPFR_ASSERTN (mpfr_nan_p (y)); @@ -109,7 +109,7 @@ check_nans (void) /* +inf + 1.0 == +inf */ mpfr_set_inf (x, 1); mpfr_clear_flags (); - inexact = mpfr_add_d (y, x, 1.0, GMP_RNDN); + inexact = mpfr_add_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_inf_p (y)); @@ -118,7 +118,7 @@ check_nans (void) /* -inf + 1.0 == -inf */ mpfr_set_inf (x, -1); mpfr_clear_flags (); - inexact = mpfr_add_d (y, x, 1.0, GMP_RNDN); + inexact = mpfr_add_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_inf_p (y)); diff --git a/tests/tadd_ui.c b/tests/tadd_ui.c index 6f16fb51b..28fafa906 100644 --- a/tests/tadd_ui.c +++ b/tests/tadd_ui.c @@ -38,7 +38,7 @@ check3 (const char *xs, unsigned long y, mp_rnd_t rnd_mode, const char *zs) if (mpfr_cmp_str1(zz, zs) ) { printf ("expected sum is %s, got ",zs); - mpfr_out_str(stdout, 10, 0, zz, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN); printf ("\nmpfr_add_ui failed for x=%s y=%lu with rnd_mode=%s\n", xs, y, mpfr_print_rnd_mode(rnd_mode)); exit (1); @@ -54,7 +54,7 @@ special (void) mpfr_init2 (x, 63); mpfr_init2 (y, 63); mpfr_set_str_binary (x, "0.110100000000000001110001110010111111000000000101100011100100011"); - mpfr_add_ui (y, x, 1, GMP_RNDD); + mpfr_add_ui (y, x, 1, MPFR_RNDD); mpfr_clear (x); mpfr_clear (y); } @@ -69,18 +69,18 @@ check_nans (void) /* nan + 2394875 == nan */ mpfr_set_nan (x); - mpfr_add_ui (y, x, 2394875L, GMP_RNDN); + mpfr_add_ui (y, x, 2394875L, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (y)); /* +inf + 2394875 == +inf */ mpfr_set_inf (x, 1); - mpfr_add_ui (y, x, 2394875L, GMP_RNDN); + mpfr_add_ui (y, x, 2394875L, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (y)); MPFR_ASSERTN (mpfr_sgn (y) > 0); /* -inf + 2394875 == -inf */ mpfr_set_inf (x, -1); - mpfr_add_ui (y, x, 2394875L, GMP_RNDN); + mpfr_add_ui (y, x, 2394875L, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (y)); MPFR_ASSERTN (mpfr_sgn (y) < 0); @@ -101,13 +101,13 @@ main (int argc, char *argv[]) check_nans (); special (); - check3 ("-1.716113812768534e-140", 1271212614, GMP_RNDZ, + check3 ("-1.716113812768534e-140", 1271212614, MPFR_RNDZ, "1.27121261399999976e9"); - check3 ("1.22191250737771397120e+20", 948002822, GMP_RNDN, + check3 ("1.22191250737771397120e+20", 948002822, MPFR_RNDN, "122191250738719408128.0"); - check3 ("-6.72658901114033715233e-165", 2000878121, GMP_RNDZ, + check3 ("-6.72658901114033715233e-165", 2000878121, MPFR_RNDZ, "2.0008781209999997615e9"); - check3 ("-2.0769715792901673e-5", 880524, GMP_RNDN, + check3 ("-2.0769715792901673e-5", 880524, MPFR_RNDN, "8.8052399997923023e5"); test_generic_ui (2, 1000, 100); diff --git a/tests/tagm.c b/tests/tagm.c index 1c1d65326..6d1d5aee6 100644 --- a/tests/tagm.c +++ b/tests/tagm.c @@ -43,7 +43,7 @@ check4 (const char *as, const char *bs, mp_rnd_t rnd_mode, const char *res) { printf ("mpfr_agm failed for a=%s, b=%s, rnd_mode=%d\n",as,bs,rnd_mode); printf ("expected result is %s, got ",res); - mpfr_out_str(stdout, 10, 0, tres, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, tres, MPFR_RNDN); putchar('\n'); exit (1); } @@ -60,9 +60,9 @@ check_large (void) mpfr_init2 (b, 82); mpfr_init2 (agm, 82); - mpfr_set_ui (a, 1, GMP_RNDN); + mpfr_set_ui (a, 1, MPFR_RNDN); mpfr_set_str_binary (b, "0.1111101100001000000001011000110111101000001011111000100001000101010100011111110010E-39"); - mpfr_agm (agm, a, b, GMP_RNDN); + mpfr_agm (agm, a, b, MPFR_RNDN); mpfr_set_str_binary (a, "0.1110001000111101101010101010101101001010001001001011100101111011110101111001111100E-4"); if (mpfr_cmp (agm, a)) { @@ -75,16 +75,16 @@ check_large (void) mpfr_set_prec (a, 268); mpfr_set_prec (b, 268); mpfr_set_prec (agm, 268); - mpfr_set_str (a, "703.93543315330225238487276503953366664991725089988315253092140138947103394917006", 10, GMP_RNDN); - mpfr_set_str (b, "703.93543315330225238487279020523738740563816490895994499256063816906728642622316", 10, GMP_RNDN); - mpfr_agm (agm, a, b, GMP_RNDN); + mpfr_set_str (a, "703.93543315330225238487276503953366664991725089988315253092140138947103394917006", 10, MPFR_RNDN); + mpfr_set_str (b, "703.93543315330225238487279020523738740563816490895994499256063816906728642622316", 10, MPFR_RNDN); + mpfr_agm (agm, a, b, MPFR_RNDN); mpfr_set_prec (a, 18); mpfr_set_prec (b, 70); mpfr_set_prec (agm, 67); mpfr_set_str_binary (a, "0.111001111100101000e8"); mpfr_set_str_binary (b, "0.1101110111100100010100110000010111011011011100110100111001010100100001e10"); - inex = mpfr_agm (agm, a, b, GMP_RNDN); + inex = mpfr_agm (agm, a, b, MPFR_RNDN); mpfr_set_str_binary (b, "0.1111110010011101101100010101011011010010010000001010100011000110011e9"); if (mpfr_cmp (agm, b)) { @@ -100,10 +100,10 @@ check_large (void) /* test worst case: 9 consecutive ones after the last bit */ mpfr_set_prec (a, 2); mpfr_set_prec (b, 2); - mpfr_set_ui (a, 1, GMP_RNDN); - mpfr_set_ui (b, 2, GMP_RNDN); + mpfr_set_ui (a, 1, MPFR_RNDN); + mpfr_set_ui (b, 2, MPFR_RNDN); mpfr_set_prec (agm, 904); - mpfr_agm (agm, a, b, GMP_RNDZ); + mpfr_agm (agm, a, b, MPFR_RNDZ); mpfr_clear (a); mpfr_clear (b); @@ -120,67 +120,67 @@ check_nans (void) mpfr_init2 (m, 123L); /* agm(1,nan) == nan */ - mpfr_set_ui (x, 1L, GMP_RNDN); + mpfr_set_ui (x, 1L, MPFR_RNDN); mpfr_set_nan (y); - mpfr_agm (m, x, y, GMP_RNDN); + mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (m)); /* agm(1,+inf) == +inf */ - mpfr_set_ui (x, 1L, GMP_RNDN); + mpfr_set_ui (x, 1L, MPFR_RNDN); mpfr_set_inf (y, 1); - mpfr_agm (m, x, y, GMP_RNDN); + mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (m)); MPFR_ASSERTN (mpfr_sgn (m) > 0); /* agm(+inf,+inf) == +inf */ mpfr_set_inf (x, 1); mpfr_set_inf (y, 1); - mpfr_agm (m, x, y, GMP_RNDN); + mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (m)); MPFR_ASSERTN (mpfr_sgn (m) > 0); /* agm(-inf,+inf) == nan */ mpfr_set_inf (x, -1); mpfr_set_inf (y, 1); - mpfr_agm (m, x, y, GMP_RNDN); + mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (m)); /* agm(+0,+inf) == nan */ - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_set_inf (y, 1); - mpfr_agm (m, x, y, GMP_RNDN); + mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (m)); /* agm(+0,1) == +0 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_agm (m, x, y, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m)); /* agm(-0,1) == +0 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_agm (m, x, y, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m)); /* agm(-0,+0) == +0 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - mpfr_set_ui (y, 0, GMP_RNDN); - mpfr_agm (m, x, y, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); + mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m)); /* agm(1,1) == 1 */ - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_agm (m, x, y, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (m ,1) == 0); /* agm(-1,-2) == NaN */ - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_set_si (y, -2, GMP_RNDN); - mpfr_agm (m, x, y, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_set_si (y, -2, MPFR_RNDN); + mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (m)); mpfr_clear (x); @@ -202,15 +202,15 @@ main (int argc, char* argv[]) check_nans (); check_large (); - check4 ("2.0", "1.0", GMP_RNDN, "1.45679103104690677029"); - check4 ("6.0", "4.0", GMP_RNDN, "4.94936087247260925182"); - check4 ("62.0", "61.0", GMP_RNDN, "6.14989837188450749750e+01"); - check4 ("0.5", "1.0", GMP_RNDN, "7.28395515523453385143e-01"); - check4 ("1.0", "2.0", GMP_RNDN, "1.45679103104690677029"); - check4 ("234375765.0", "234375000.0", GMP_RNDN, "2.3437538249984395504e8"); - check4 ("8.0", "1.0", GMP_RNDU, "3.615756177597362786"); - check4 ("1.0", "44.0", GMP_RNDU, "1.33658354512981247808e1"); - check4 ("1.0", "3.7252902984619140625e-9", GMP_RNDU, + check4 ("2.0", "1.0", MPFR_RNDN, "1.45679103104690677029"); + check4 ("6.0", "4.0", MPFR_RNDN, "4.94936087247260925182"); + check4 ("62.0", "61.0", MPFR_RNDN, "6.14989837188450749750e+01"); + check4 ("0.5", "1.0", MPFR_RNDN, "7.28395515523453385143e-01"); + check4 ("1.0", "2.0", MPFR_RNDN, "1.45679103104690677029"); + check4 ("234375765.0", "234375000.0", MPFR_RNDN, "2.3437538249984395504e8"); + check4 ("8.0", "1.0", MPFR_RNDU, "3.615756177597362786"); + check4 ("1.0", "44.0", MPFR_RNDU, "1.33658354512981247808e1"); + check4 ("1.0", "3.7252902984619140625e-9", MPFR_RNDU, "7.55393356971199025907e-02"); test_generic (2, 300, 17); diff --git a/tests/tasin.c b/tests/tasin.c index 1472978ed..b27b343a0 100644 --- a/tests/tasin.c +++ b/tests/tasin.c @@ -40,7 +40,7 @@ special (void) /* asin(NaN) = NaN */ mpfr_set_nan (x); - mpfr_asin (y, x, GMP_RNDN); + mpfr_asin (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_asin (NaN) <> NaN\n"); @@ -49,14 +49,14 @@ special (void) /* asin(+/-Inf) = NaN */ mpfr_set_inf (x, 1); - mpfr_asin (y, x, GMP_RNDN); + mpfr_asin (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_asin (+Inf) <> NaN\n"); exit (1); } mpfr_set_inf (x, -1); - mpfr_asin (y, x, GMP_RNDN); + mpfr_asin (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_asin (-Inf) <> NaN\n"); @@ -64,15 +64,15 @@ special (void) } /* asin(+/-2) = NaN */ - mpfr_set_ui (x, 2, GMP_RNDN); - mpfr_asin (y, x, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); + mpfr_asin (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_asin (+2) <> NaN\n"); exit (1); } - mpfr_set_si (x, -2, GMP_RNDN); - mpfr_asin (y, x, GMP_RNDN); + mpfr_set_si (x, -2, MPFR_RNDN); + mpfr_asin (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_asin (-2) <> NaN\n"); @@ -80,15 +80,15 @@ special (void) } /* asin(+/-0) = +/-0 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_asin (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_asin (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) { printf ("Error: mpfr_asin (+0) <> +0\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_asin (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_asin (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0) { printf ("Error: mpfr_asin (-0) <> -0\n"); @@ -96,12 +96,12 @@ special (void) } /* asin(1) = Pi/2 */ - for (r = 0; r < GMP_RND_MAX; r++) + for (r = 0; r < MPFR_RND_MAX; r++) { - mpfr_set_ui (x, 1, GMP_RNDN); /* exact */ + mpfr_set_ui (x, 1, MPFR_RNDN); /* exact */ mpfr_asin (y, x, (mp_rnd_t) r); mpfr_const_pi (x, (mp_rnd_t) r); - mpfr_div_2exp (x, x, 1, GMP_RNDN); /* exact */ + mpfr_div_2exp (x, x, 1, MPFR_RNDN); /* exact */ if (mpfr_cmp (x, y)) { printf ("Error: asin(1) != Pi/2 for rnd=%s\n", @@ -111,13 +111,13 @@ special (void) } /* asin(-1) = -Pi/2 */ - for (r = 0; r < GMP_RND_MAX; r++) + for (r = 0; r < MPFR_RND_MAX; r++) { - mpfr_set_si (x, -1, GMP_RNDN); /* exact */ + mpfr_set_si (x, -1, MPFR_RNDN); /* exact */ mpfr_asin (y, x, (mp_rnd_t) r); mpfr_const_pi (x, MPFR_INVERT_RND((mp_rnd_t) r)); - mpfr_neg (x, x, GMP_RNDN); /* exact */ - mpfr_div_2exp (x, x, 1, GMP_RNDN); /* exact */ + mpfr_neg (x, x, MPFR_RNDN); /* exact */ + mpfr_div_2exp (x, x, 1, MPFR_RNDN); /* exact */ if (mpfr_cmp (x, y)) { printf ("Error: asin(-1) != -Pi/2 for rnd=%s\n", @@ -130,7 +130,7 @@ special (void) mpfr_set_prec (y, 32); mpfr_set_str_binary (x, "0.1101110111111111001011101000101"); - mpfr_asin (x, x, GMP_RNDN); + mpfr_asin (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "1.00001100101011000001111100111"); if (mpfr_cmp (x, y)) { @@ -139,7 +139,7 @@ special (void) } mpfr_set_str_binary (x, "-0.01110111000011101010111100000101"); - mpfr_asin (x, x, GMP_RNDN); + mpfr_asin (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "-0.0111101111010100011111110101"); if (mpfr_cmp (x, y)) { @@ -152,7 +152,7 @@ special (void) mpfr_set_prec (x, 9); mpfr_set_prec (y, 19); mpfr_set_str_binary (x, "0.110000000E-6"); - mpfr_asin (y, x, GMP_RNDD); + mpfr_asin (y, x, MPFR_RNDD); mpfr_set_prec (x, 19); mpfr_set_str_binary (x, "0.1100000000000001001E-6"); if (mpfr_cmp (x, y)) @@ -181,9 +181,9 @@ special_overflow (void) mpfr_init2 (x, 24); mpfr_init2 (y, 48); mpfr_set_str_binary (x, "0.101100100000000000110100E0"); - mpfr_asin (y, x, GMP_RNDN); + mpfr_asin (y, x, MPFR_RNDN); if (mpfr_cmp_str (y, "0.110001001101001111110000010110001000111011001000E0", - 2, GMP_RNDN)) + 2, MPFR_RNDN)) { printf("Special Overflow error.\n"); mpfr_dump (y); @@ -204,15 +204,15 @@ test20071215 (void) mpfr_init (x); mpfr_init (y); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_asin (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_asin (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_zero_p (y) && MPFR_IS_NEG(y)); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_set_si (y, -1, GMP_RNDN); - mpfr_asin (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_set_si (y, -1, MPFR_RNDN); + mpfr_asin (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_zero_p (y) && MPFR_IS_POS(y)); mpfr_clear (x); diff --git a/tests/tasinh.c b/tests/tasinh.c index c10f6a927..1734c9aee 100644 --- a/tests/tasinh.c +++ b/tests/tasinh.c @@ -37,8 +37,8 @@ special (void) mpfr_init (y); MPFR_SET_INF(x); - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_asinh (x, y, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_asinh (x, y, MPFR_RNDN); if (MPFR_IS_INF(x) || MPFR_IS_NAN(x) ) { printf ("Inf flag not clears in asinh!\n"); @@ -46,7 +46,7 @@ special (void) } MPFR_SET_NAN(x); - mpfr_asinh (x, y, GMP_RNDN); + mpfr_asinh (x, y, MPFR_RNDN); if (MPFR_IS_NAN(x) || MPFR_IS_INF(x)) { printf ("NAN flag not clears in asinh!\n"); @@ -54,15 +54,15 @@ special (void) } /* asinh(+0) = +0, asinh(-0) = -0 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_asinh (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_asinh (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) { printf ("Error: mpfr_asinh(+0) <> +0\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_asinh (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_asinh (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0) { printf ("Error: mpfr_asinh(-0) <> -0\n"); @@ -70,7 +70,7 @@ special (void) } MPFR_SET_NAN(x); - mpfr_asinh (y, x, GMP_RNDN); + mpfr_asinh (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_asinh(NaN) <> NaN\n"); @@ -78,7 +78,7 @@ special (void) } mpfr_set_inf (x, 1); - mpfr_asinh (y, x, GMP_RNDN); + mpfr_asinh (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error: mpfr_asinh(+Inf) <> +Inf\n"); @@ -86,7 +86,7 @@ special (void) } mpfr_set_inf (x, -1); - mpfr_asinh (y, x, GMP_RNDN); + mpfr_asinh (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0) { printf ("Error: mpfr_asinh(-Inf) <> -Inf\n"); @@ -97,7 +97,7 @@ special (void) mpfr_set_prec (y, 32); mpfr_set_str_binary (x, "0.1010100100111011001111100101E-1"); - mpfr_asinh (x, x, GMP_RNDN); + mpfr_asinh (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "0.10100110010010101101010011011101E-1"); if (!mpfr_equal_p (x, y)) { @@ -106,7 +106,7 @@ special (void) } mpfr_set_str_binary (x, "-.10110011011010111110010001100001"); - mpfr_asinh (x, x, GMP_RNDN); + mpfr_asinh (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "-.10100111010000111001011100110011"); if (!mpfr_equal_p (x, y)) { @@ -117,7 +117,7 @@ special (void) mpfr_set_prec (x, 33); mpfr_set_prec (y, 43); mpfr_set_str_binary (x, "0.111001101100000110011001010000101"); - mpfr_asinh (y, x, GMP_RNDZ); + mpfr_asinh (y, x, MPFR_RNDZ); mpfr_init2 (z, 43); mpfr_set_str_binary (z, "0.1100111101010101101010101110000001000111001"); if (!mpfr_equal_p (y, z)) @@ -128,10 +128,10 @@ special (void) mpfr_set_prec (x, 53); mpfr_set_prec (y, 2); - mpfr_set_str (x, "1.8000000000009@-6", 16, GMP_RNDN); - mpfr_asinh (y, x, GMP_RNDZ); + mpfr_set_str (x, "1.8000000000009@-6", 16, MPFR_RNDN); + mpfr_asinh (y, x, MPFR_RNDZ); mpfr_set_prec (z, 2); - mpfr_set_str (z, "1.0@-6", 16, GMP_RNDN); + mpfr_set_str (z, "1.0@-6", 16, MPFR_RNDN); if (!mpfr_equal_p (y, z)) { printf ("Error: mpfr_asinh (4)\n"); diff --git a/tests/tatan.c b/tests/tatan.c index 9be20b2cc..93bb03f7b 100644 --- a/tests/tatan.c +++ b/tests/tatan.c @@ -38,22 +38,22 @@ special (void) mpfr_set_str_binary (x, "1.0000100110000001100111100011001110101110100111011101"); mpfr_set_str_binary (y, "1.1001101101110100101100110011011101101000011010111110e-1"); - mpfr_atan (z, x, GMP_RNDN); + mpfr_atan (z, x, MPFR_RNDN); if (mpfr_cmp (y, z)) { - printf ("Error in mpfr_atan for prec=53, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_atan for prec=53, rnd=MPFR_RNDN\n"); printf ("x="); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\nexpected "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\ngot "); - mpfr_out_str (stdout, 2, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); printf ("\n"); exit (1); } /* atan(+Inf) = Pi/2 */ - for (r = 0; r < GMP_RND_MAX ; r++) + for (r = 0; r < MPFR_RND_MAX ; r++) { mpfr_set_inf (x, 1); mpfr_atan (y, x, (mp_rnd_t) r); @@ -68,7 +68,7 @@ special (void) } /* atan(-Inf) = - Pi/2 */ - for (r = 0; r < GMP_RND_MAX ; r++) + for (r = 0; r < MPFR_RND_MAX ; r++) { mpfr_set_inf (x, -1); mpfr_atan (y, x, (mp_rnd_t) r); @@ -85,7 +85,7 @@ special (void) /* atan(NaN) = NaN */ mpfr_set_nan (x); - mpfr_atan (y, x, GMP_RNDN); + mpfr_atan (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_atan(NaN) <> NaN\n"); @@ -93,29 +93,29 @@ special (void) } /* atan(+/-0) = +/-0 */ - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); MPFR_SET_NEG (y); - mpfr_atan (y, x, GMP_RNDN); + mpfr_atan (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y)) { printf ("Error: mpfr_atan (+0) <> +0\n"); exit (1); } - mpfr_atan (x, x, GMP_RNDN); + mpfr_atan (x, x, MPFR_RNDN); if (mpfr_cmp_ui (x, 0) || MPFR_IS_NEG (x)) { printf ("Error: mpfr_atan (+0) <> +0 (in place)\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); MPFR_SET_POS (y); - mpfr_atan (y, x, GMP_RNDN); + mpfr_atan (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || MPFR_IS_POS (y)) { printf ("Error: mpfr_atan (-0) <> -0\n"); exit (1); } - mpfr_atan (x, x, GMP_RNDN); + mpfr_atan (x, x, MPFR_RNDN); if (mpfr_cmp_ui (x, 0) || MPFR_IS_POS (x)) { printf ("Error: mpfr_atan (-0) <> -0 (in place)\n"); @@ -127,7 +127,7 @@ special (void) /* test one random positive argument */ mpfr_set_str_binary (x, "0.10000100001100101001001001011001"); - mpfr_atan (x, x, GMP_RNDN); + mpfr_atan (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "0.1111010000001111001111000000011E-1"); if (mpfr_cmp (x, y)) { @@ -137,7 +137,7 @@ special (void) /* test one random negative argument */ mpfr_set_str_binary (x, "-0.1100001110110000010101011001011"); - mpfr_atan (x, x, GMP_RNDN); + mpfr_atan (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "-0.101001110001010010110001110001"); if (mpfr_cmp (x, y)) { @@ -151,7 +151,7 @@ special (void) mpfr_set_prec (y, 192); mpfr_set_prec (z, 192); mpfr_set_str_binary (x, "-0.100e1"); - mpfr_atan (z, x, GMP_RNDD); + mpfr_atan (z, x, MPFR_RNDD); mpfr_set_str_binary (y, "-0.110010010000111111011010101000100010000101101000110000100011010011000100110001100110001010001011100000001101110000011100110100010010100100000010010011100000100010001010011001111100110001110101"); if (mpfr_cmp (z, y)) { @@ -166,9 +166,9 @@ special (void) mpfr_set_prec (y, 51); mpfr_set_str_binary (x, "0.101100100000101111111010001111111000001000000000000E-11"); - i = mpfr_atan (y, x, GMP_RNDN); + i = mpfr_atan (y, x, MPFR_RNDN); if (mpfr_cmp_str (y, - "1.01100100000101111111001110011001010110100100000000e-12", 2, GMP_RNDN) + "1.01100100000101111111001110011001010110100100000000e-12", 2, MPFR_RNDN) || i >= 0) { printf ("Wrong Regression test (%d)\n", i); @@ -176,16 +176,16 @@ special (void) exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_atan (x, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_atan (x, x, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_NEG (x)); /* Test regression */ mpfr_set_prec (x, 48); mpfr_set_prec (y, 48); mpfr_set_str_binary (x, "1.11001110010000011111100000010000000000000000000e-19"); - mpfr_atan (y, x, GMP_RNDD); - if (mpfr_cmp_str (y, "0.111001110010000011111100000001111111110000010011E-18", 2, GMP_RNDN)) + mpfr_atan (y, x, MPFR_RNDD); + if (mpfr_cmp_str (y, "0.111001110010000011111100000001111111110000010011E-18", 2, MPFR_RNDN)) { printf ("Error in mpfr_atan (4)\n"); printf ("Input 1.11001110010000011111100000010000000000000000000e-19 [prec=48]\n"); @@ -201,7 +201,7 @@ special (void) #define TEST_FUNCTION mpfr_atan #define test_generic test_generic_atan -#define RAND_FUNCTION(x) (mpfr_urandomb (x, RANDS), mpfr_mul_2si (x, x, (randlimb () %1000-500), GMP_RNDN)) +#define RAND_FUNCTION(x) (mpfr_urandomb (x, RANDS), mpfr_mul_2si (x, x, (randlimb () %1000-500), MPFR_RNDN)) #include "tgeneric.c" #define TEST_FUNCTION mpfr_atan2 @@ -229,9 +229,9 @@ special_overflow (void) mpfr_init2 (x, 24); mpfr_init2 (y, 48); mpfr_set_str_binary (x, "0.101101010001001101111010E0"); - mpfr_atan (y, x, GMP_RNDN); + mpfr_atan (y, x, MPFR_RNDN); if (mpfr_cmp_str (y, "0.100111011001100111000010111101000111010101011110E0", - 2, GMP_RNDN)) + 2, MPFR_RNDN)) { printf("Special Overflow error.\n"); mpfr_dump (y); @@ -251,103 +251,103 @@ special_atan2 (void) mpfr_inits2 (4, x, y, z, (mpfr_ptr) 0); /* Anything with NAN should be set to NAN */ - mpfr_set_ui (y, 0, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); mpfr_set_nan (x); - mpfr_atan2 (z, y, x, GMP_RNDN); + mpfr_atan2 (z, y, x, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_NAN (z)); mpfr_swap (x, y); - mpfr_atan2 (z, y, x, GMP_RNDN); + mpfr_atan2 (z, y, x, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_NAN (z)); /* 0+ 0+ --> 0+ */ - mpfr_set_ui (y, 0, GMP_RNDN); - mpfr_atan2 (z, y, x, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); + mpfr_atan2 (z, y, x, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_POS (z)); /* 0- 0+ --> 0- */ MPFR_CHANGE_SIGN (y); - mpfr_atan2 (z, y, x, GMP_RNDN); + mpfr_atan2 (z, y, x, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_NEG (z)); /* 0- 0- --> -PI */ MPFR_CHANGE_SIGN (x); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, MPFR_RNDN) == 0); /* 0+ 0- --> +PI */ MPFR_CHANGE_SIGN (y); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, MPFR_RNDN) == 0); /* 0+ -1 --> PI */ - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, GMP_RNDN) == 0); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, MPFR_RNDN) == 0); /* 0- -1 --> -PI */ MPFR_CHANGE_SIGN (y); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, MPFR_RNDN) == 0); /* 0- +1 --> 0- */ - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_atan2 (z, y, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_atan2 (z, y, x, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_NEG (z)); /* 0+ +1 --> 0+ */ MPFR_CHANGE_SIGN (y); - mpfr_atan2 (z, y, x, GMP_RNDN); + mpfr_atan2 (z, y, x, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_POS (z)); /* +1 0+ --> PI/2 */ mpfr_swap (x, y); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, MPFR_RNDN) == 0); /* +1 0- --> PI/2 */ MPFR_CHANGE_SIGN (x); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, MPFR_RNDN) == 0); /* -1 0- --> -PI/2 */ MPFR_CHANGE_SIGN (y); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, MPFR_RNDN) == 0); /* -1 0+ --> -PI/2 */ MPFR_CHANGE_SIGN (x); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, MPFR_RNDN) == 0); /* -1 +INF --> -0 */ MPFR_SET_INF (x); - mpfr_atan2 (z, y, x, GMP_RNDN); + mpfr_atan2 (z, y, x, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_NEG (z)); /* +1 +INF --> +0 */ MPFR_CHANGE_SIGN (y); - mpfr_atan2 (z, y, x, GMP_RNDN); + mpfr_atan2 (z, y, x, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_POS (z)); /* +1 -INF --> +PI */ MPFR_CHANGE_SIGN (x); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, MPFR_RNDN) == 0); /* -1 -INF --> -PI */ MPFR_CHANGE_SIGN (y); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, MPFR_RNDN) == 0); /* -INF -1 --> -PI/2 */ mpfr_swap (x, y); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, MPFR_RNDN) == 0); /* +INF -1 --> PI/2 */ MPFR_CHANGE_SIGN (y); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, MPFR_RNDN) == 0); /* +INF -INF --> 3*PI/4 */ MPFR_SET_INF (x); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "2.356194490192344928", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "2.356194490192344928", 10, MPFR_RNDN) == 0); /* +INF +INF --> PI/4 */ MPFR_CHANGE_SIGN (x); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "0.785375", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "0.785375", 10, MPFR_RNDN) == 0); /* -INF +INF --> -PI/4 */ MPFR_CHANGE_SIGN (y); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "-0.785375", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "-0.785375", 10, MPFR_RNDN) == 0); /* -INF -INF --> -3*PI/4 */ MPFR_CHANGE_SIGN (x); - mpfr_atan2 (z, y, x, GMP_RNDN); - MPFR_ASSERTN (mpfr_cmp_str (z, "-2.356194490192344928", 10, GMP_RNDN) == 0); + mpfr_atan2 (z, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_str (z, "-2.356194490192344928", 10, MPFR_RNDN) == 0); mpfr_clears (x, y, z, (mpfr_ptr) 0); } @@ -360,15 +360,15 @@ smallvals_atan2 (void) mp_exp_t old_emin; mpfr_inits (a, x, y, (mpfr_ptr) 0); - mpfr_set_ui (y, 0, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); mpfr_nextbelow (y); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); /* y=-2^(-emin-1), x=1 */ - mpfr_atan2 (a, y, x, GMP_RNDD); + mpfr_atan2 (a, y, x, MPFR_RNDD); MPFR_ASSERTN (mpfr_equal_p (a, y)); - mpfr_atan2 (a, y, x, GMP_RNDU); + mpfr_atan2 (a, y, x, MPFR_RNDU); MPFR_ASSERTN (mpfr_zero_p (a) && MPFR_IS_NEG(a)); mpfr_set_prec (x, 8); @@ -377,27 +377,27 @@ smallvals_atan2 (void) old_emin = mpfr_get_emin (); mpfr_set_emin (MPFR_EMIN_MIN); - mpfr_set_si (y, 3, GMP_RNDN); + mpfr_set_si (y, 3, MPFR_RNDN); mpfr_set_exp (y, mpfr_get_emin ()); mpfr_set_str_binary (x, "1.1"); - mpfr_atan2 (a, y, x, GMP_RNDU); - mpfr_set_si (y, 1, GMP_RNDN); + mpfr_atan2 (a, y, x, MPFR_RNDU); + mpfr_set_si (y, 1, MPFR_RNDN); mpfr_set_exp (y, mpfr_get_emin ()); MPFR_ASSERTN (mpfr_equal_p (a, y)); /* From a bug reported by Christopher Creutzig on 2007-08-28. Added test in each rounding mode. Segmentation fault or assertion failure due to an infinite Ziv loop. */ - mpfr_set_si (y, 1, GMP_RNDN); + mpfr_set_si (y, 1, MPFR_RNDN); mpfr_set_exp (y, mpfr_get_emin ()); mpfr_set_str_binary (x, "1.01"); - mpfr_atan2 (a, y, x, GMP_RNDZ); + mpfr_atan2 (a, y, x, MPFR_RNDZ); MPFR_ASSERTN (mpfr_zero_p (a)); - mpfr_atan2 (a, y, x, GMP_RNDD); + mpfr_atan2 (a, y, x, MPFR_RNDD); MPFR_ASSERTN (mpfr_zero_p (a)); - mpfr_atan2 (a, y, x, GMP_RNDU); + mpfr_atan2 (a, y, x, MPFR_RNDU); MPFR_ASSERTN (mpfr_equal_p (a, y)); - mpfr_atan2 (a, y, x, GMP_RNDN); + mpfr_atan2 (a, y, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_equal_p (a, y)); mpfr_set_emin (old_emin); @@ -421,7 +421,7 @@ atan2_bug_20071003 (void) "0.10100101010110010100010010111000110110011110001011110E3"); mpfr_set_str_binary (z, "-0.11101111001101101100111011001101000010010111101110110E-1"); - mpfr_atan2 (a, y, x, GMP_RNDN); + mpfr_atan2 (a, y, x, MPFR_RNDN); if (! mpfr_equal_p (a, z)) { printf ("mpfr_atan2 fails on:\n"); diff --git a/tests/tatanh.c b/tests/tatanh.c index ea032bdc3..9dfffd960 100644 --- a/tests/tatanh.c +++ b/tests/tatanh.c @@ -39,8 +39,8 @@ special (void) mpfr_init (y); MPFR_SET_INF(x); - mpfr_set_ui (y, 0, GMP_RNDN); - mpfr_atanh (x, y, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); + mpfr_atanh (x, y, MPFR_RNDN); if (MPFR_IS_INF(x) || MPFR_IS_NAN(x) ) { printf ("Inf flag not clears in atanh!\n"); @@ -48,7 +48,7 @@ special (void) } MPFR_SET_NAN(x); - mpfr_atanh (x, y, GMP_RNDN); + mpfr_atanh (x, y, MPFR_RNDN); if (MPFR_IS_NAN(x) || MPFR_IS_INF(x)) { printf ("NAN flag not clears in atanh!\n"); @@ -58,16 +58,16 @@ special (void) /* atanh(+/-x) = NaN if x > 1 */ for (i = 3; i <= 6; i++) { - mpfr_set_si (x, i, GMP_RNDN); - mpfr_div_2ui (x, x, 1, GMP_RNDN); - mpfr_atanh (y, x, GMP_RNDN); + mpfr_set_si (x, i, MPFR_RNDN); + mpfr_div_2ui (x, x, 1, MPFR_RNDN); + mpfr_atanh (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_atanh(%d/2) <> NaN\n", i); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_atanh (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_atanh (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_atanh(-%d/2) <> NaN\n", i); @@ -76,15 +76,15 @@ special (void) } /* atanh(+0) = +0, atanh(-0) = -0 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_atanh (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_atanh (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) { printf ("Error: mpfr_atanh(+0) <> +0\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_atanh (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_atanh (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0) { printf ("Error: mpfr_atanh(-0) <> -0\n"); @@ -92,7 +92,7 @@ special (void) } MPFR_SET_NAN(x); - mpfr_atanh (y, x, GMP_RNDN); + mpfr_atanh (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_atanh(NaN) <> NaN\n"); @@ -100,7 +100,7 @@ special (void) } mpfr_set_inf (x, 1); - mpfr_atanh (y, x, GMP_RNDN); + mpfr_atanh (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_atanh(+Inf) <> NaN\n"); @@ -109,23 +109,23 @@ special (void) } mpfr_set_inf (x, -1); - mpfr_atanh (y, x, GMP_RNDN); + mpfr_atanh (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: mpfr_atanh(-Inf) <> NaN\n"); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_atanh (y, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_atanh (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error: mpfr_atanh(1) <> +Inf\n"); exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_atanh (y, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_atanh (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0) { printf ("Error: mpfr_atanh(-1) <> -Inf\n"); @@ -136,7 +136,7 @@ special (void) mpfr_set_prec (y, 32); mpfr_set_str_binary (x, "0.10001000001001011000100001E-6"); - mpfr_atanh (x, x, GMP_RNDN); + mpfr_atanh (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "0.10001000001001100101010110100001E-6"); if (mpfr_cmp (x, y)) { @@ -145,7 +145,7 @@ special (void) } mpfr_set_str_binary (x, "-0.1101011110111100111010011001011E-1"); - mpfr_atanh (x, x, GMP_RNDN); + mpfr_atanh (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "-0.11100110000100001111101100010111E-1"); if (mpfr_cmp (x, y)) { @@ -156,7 +156,7 @@ special (void) mpfr_set_prec (x, 33); mpfr_set_prec (y, 43); mpfr_set_str_binary (x, "0.111001101100000110011001010000101"); - mpfr_atanh (y, x, GMP_RNDZ); + mpfr_atanh (y, x, MPFR_RNDZ); mpfr_init2 (z, 43); mpfr_set_str_binary (z, "1.01111010110001101001000000101101011110101"); if (mpfr_cmp (y, z)) diff --git a/tests/taway.c b/tests/taway.c index 48e6d158f..ecadcf688 100644 --- a/tests/taway.c +++ b/tests/taway.c @@ -26,7 +26,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-test.h" -#define DISP(s, t) {printf(s); mpfr_out_str(stdout, 2, 0, t, GMP_RNDN); } +#define DISP(s, t) {printf(s); mpfr_out_str(stdout, 2, 0, t, MPFR_RNDN); } #define DISP2(s,t) {DISP(s,t); putchar('\n');} #define SPECIAL_MAX 12 @@ -69,10 +69,10 @@ set_special (mpfr_ptr x, unsigned int select) mpfr_set_str_binary (x, "1e+1"); break; case 9: - mpfr_const_pi (x, GMP_RNDN); + mpfr_const_pi (x, MPFR_RNDN); break; case 10: - mpfr_const_pi (x, GMP_RNDN); + mpfr_const_pi (x, MPFR_RNDN); MPFR_SET_EXP (x, MPFR_GET_EXP (x)-1); break; default: @@ -114,8 +114,8 @@ test3 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mp_rnd_t), set_special (ref2, i%SPECIAL_MAX); set_special (ref3, i/SPECIAL_MAX); - inexa = testfunc (res1, ref2, ref3, GMP_RNDA); - r = MPFR_SIGN(res1) > 0 ? GMP_RNDU : GMP_RNDD; + inexa = testfunc (res1, ref2, ref3, MPFR_RNDA); + r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); if (mpfr_compare (res1, ref1) || inexa != inexd) @@ -169,8 +169,8 @@ test4 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr, { set_special (op3, k); - inexa = testfunc (res, op1, op2, op3, GMP_RNDA); - r = MPFR_SIGN(res) > 0 ? GMP_RNDU : GMP_RNDD; + inexa = testfunc (res, op1, op2, op3, MPFR_RNDA); + r = MPFR_SIGN(res) > 0 ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref, op1, op2, op3, r); if (mpfr_compare (res, ref) || inexa != inexd) @@ -217,8 +217,8 @@ test2ui (int (*testfunc)(mpfr_ptr, mpfr_srcptr, unsigned long int, mp_rnd_t), set_special (ref2, i % SPECIAL_MAX); ref3 = i / SPECIAL_MAX == 0 ? 0 : randlimb (); - inexa = testfunc (res1, ref2, ref3, GMP_RNDA); - r = MPFR_SIGN(res1) > 0 ? GMP_RNDU : GMP_RNDD; + inexa = testfunc (res1, ref2, ref3, MPFR_RNDA); + r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); if (mpfr_compare (res1, ref1) || inexa != inexd) @@ -260,8 +260,8 @@ testui2 (int (*testfunc)(mpfr_ptr, unsigned long int, mpfr_srcptr, mp_rnd_t), set_special (ref3, i % SPECIAL_MAX); ref2 = i / SPECIAL_MAX == 0 ? 0 : randlimb (); - inexa = testfunc (res1, ref2, ref3, GMP_RNDA); - r = MPFR_SIGN(res1) > 0 ? GMP_RNDU : GMP_RNDD; + inexa = testfunc (res1, ref2, ref3, MPFR_RNDA); + r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); if (mpfr_compare (res1, ref1) || inexa != inexd) @@ -301,9 +301,9 @@ test2 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mp_rnd_t), char *foo) set_special (ref2, i); /* first round to away */ - inexa = testfunc (res1, ref2, GMP_RNDA); + inexa = testfunc (res1, ref2, MPFR_RNDA); - r = MPFR_SIGN(res1) > 0 ? GMP_RNDU : GMP_RNDD; + r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, r); if (mpfr_compare (res1, ref1) || inexa != inexd) { @@ -344,10 +344,10 @@ test3a (int (*testfunc)(mpfr_ptr, mpfr_ptr, mpfr_srcptr, mp_rnd_t), char *foo) { set_special (ref3, i); - inexa = testfunc (res1, res2, ref3, GMP_RNDA); + inexa = testfunc (res1, res2, ref3, MPFR_RNDA); /* first check wrt the first operand */ - r = MPFR_SIGN(res1) > 0 ? GMP_RNDU : GMP_RNDD; + r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); if (mpfr_compare (res1, ref1) || inexa != inexd) { @@ -360,7 +360,7 @@ test3a (int (*testfunc)(mpfr_ptr, mpfr_ptr, mpfr_srcptr, mp_rnd_t), char *foo) } /* now check wrt the second operand */ - r = MPFR_SIGN(res2) > 0 ? GMP_RNDU : GMP_RNDD; + r = MPFR_SIGN(res2) > 0 ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); if (mpfr_compare (res2, ref2) || inexa != inexd) { diff --git a/tests/tcan_round.c b/tests/tcan_round.c index 50840a13c..32bbfce95 100644 --- a/tests/tcan_round.c +++ b/tests/tcan_round.c @@ -45,7 +45,7 @@ check_round_p (void) err = p + randlimb () % BITS_PER_MP_LIMB; r1 = mpfr_round_p (buf, n, err, p); r2 = mpfr_can_round_raw (buf, n, MPFR_SIGN_POS, err, - GMP_RNDN, GMP_RNDZ, p); + MPFR_RNDN, MPFR_RNDZ, p); if (r1 != r2) { printf ("mpfr_round_p(%d) != mpfr_can_round(%d)!\n" @@ -69,14 +69,14 @@ main (void) bit to zero in case of equal distance */ mpfr_init2 (x, 59); mpfr_set_str_binary (x, "-0.10010001010111000011110010111010111110000000111101100111111E663"); - if (mpfr_can_round (x, 54, GMP_RNDZ, GMP_RNDZ, 53) != 0) + if (mpfr_can_round (x, 54, MPFR_RNDZ, MPFR_RNDZ, 53) != 0) { printf ("Error (1) in mpfr_can_round\n"); exit (1); } mpfr_set_str_binary (x, "-Inf"); - if (mpfr_can_round (x, 2000, GMP_RNDZ, GMP_RNDZ, 2000) != 0) + if (mpfr_can_round (x, 2000, MPFR_RNDZ, MPFR_RNDZ, 2000) != 0) { printf ("Error (2) in mpfr_can_round\n"); exit (1); @@ -84,20 +84,20 @@ main (void) mpfr_set_prec (x, 64); mpfr_set_str_binary (x, "0.1011001000011110000110000110001111101011000010001110011000000000"); - if (mpfr_can_round (x, 65, GMP_RNDN, GMP_RNDN, 54)) + if (mpfr_can_round (x, 65, MPFR_RNDN, MPFR_RNDN, 54)) { printf ("Error (3) in mpfr_can_round\n"); exit (1); } mpfr_set_prec (x, 62); - mpfr_set_str (x, "0.ff4ca619c76ba69", 16, GMP_RNDZ); + mpfr_set_str (x, "0.ff4ca619c76ba69", 16, MPFR_RNDZ); for (i = 30; i < 99; i++) for (j = 30; j < 99; j++) { int r1, r2; - for (r1 = 0; r1 < GMP_RND_MAX ; r1++) - for (r2 = 0; r2 < GMP_RND_MAX ; r2++) + for (r1 = 0; r1 < MPFR_RND_MAX ; r1++) + for (r2 = 0; r2 < MPFR_RND_MAX ; r2++) mpfr_can_round (x, i, (mp_rnd_t) r1, (mp_rnd_t) r2, j); /* test for assertions */ } diff --git a/tests/tcbrt.c b/tests/tcbrt.c index 2a75f9257..46b9af6c8 100644 --- a/tests/tcbrt.c +++ b/tests/tcbrt.c @@ -35,7 +35,7 @@ special (void) /* cbrt(NaN) = NaN */ mpfr_set_nan (x); - mpfr_cbrt (y, x, GMP_RNDN); + mpfr_cbrt (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: cbrt(NaN) <> NaN\n"); @@ -44,7 +44,7 @@ special (void) /* cbrt(+Inf) = +Inf */ mpfr_set_inf (x, 1); - mpfr_cbrt (y, x, GMP_RNDN); + mpfr_cbrt (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error: cbrt(+Inf) <> +Inf\n"); @@ -53,7 +53,7 @@ special (void) /* cbrt(-Inf) = -Inf */ mpfr_set_inf (x, -1); - mpfr_cbrt (y, x, GMP_RNDN); + mpfr_cbrt (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0) { printf ("Error: cbrt(-Inf) <> -Inf\n"); @@ -61,15 +61,15 @@ special (void) } /* cbrt(+/-0) = +/-0 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_cbrt (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_cbrt (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) { printf ("Error: cbrt(+0) <> +0\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_cbrt (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_cbrt (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0) { printf ("Error: cbrt(-0) <> -0\n"); @@ -77,8 +77,8 @@ special (void) } mpfr_set_prec (x, 53); - mpfr_set_str (x, "8.39005285514734966412e-01", 10, GMP_RNDN); - mpfr_cbrt (x, x, GMP_RNDN); + mpfr_set_str (x, "8.39005285514734966412e-01", 10, MPFR_RNDN); + mpfr_cbrt (x, x, MPFR_RNDN); if (mpfr_cmp_str1 (x, "9.43166207799662426048e-01")) { printf ("Error in crbrt (1)\n"); @@ -88,7 +88,7 @@ special (void) mpfr_set_prec (x, 32); mpfr_set_prec (y, 32); mpfr_set_str_binary (x, "0.10000100001100101001001001011001"); - mpfr_cbrt (x, x, GMP_RNDN); + mpfr_cbrt (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "0.11001101011000100111000111111001"); if (mpfr_cmp (x, y)) { @@ -99,7 +99,7 @@ special (void) mpfr_set_prec (x, 32); mpfr_set_prec (y, 32); mpfr_set_str_binary (x, "-0.1100001110110000010101011001011"); - mpfr_cbrt (x, x, GMP_RNDD); + mpfr_cbrt (x, x, MPFR_RNDD); mpfr_set_str_binary (y, "-0.11101010000100100101000101011001"); if (mpfr_cmp (x, y)) { @@ -110,7 +110,7 @@ special (void) mpfr_set_prec (x, 82); mpfr_set_prec (y, 27); mpfr_set_str_binary (x, "0.1010001111011101011011000111001011001101100011110110010011011011011010011001100101e-7"); - mpfr_cbrt (y, x, GMP_RNDD); + mpfr_cbrt (y, x, MPFR_RNDD); mpfr_set_str_binary (x, "0.101011110001110001000100011E-2"); if (mpfr_cmp (x, y)) { @@ -121,7 +121,7 @@ special (void) mpfr_set_prec (x, 204); mpfr_set_prec (y, 38); mpfr_set_str_binary (x, "0.101000000001101000000001100111111011111001110110100001111000100110100111001101100111110001110001011011010110010011100101111001111100001010010100111011101100000011011000101100010000000011000101001010001001E-5"); - mpfr_cbrt (y, x, GMP_RNDD); + mpfr_cbrt (y, x, MPFR_RNDD); mpfr_set_str_binary (x, "0.10001001111010011011101000010110110010E-1"); if (mpfr_cmp (x, y)) { @@ -133,7 +133,7 @@ special (void) mpfr_set_prec (x, 5); mpfr_set_prec (y, 5); mpfr_set_str_binary (x, "1.1000E-2"); - mpfr_cbrt (y, x, GMP_RNDN); + mpfr_cbrt (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "1.0111E-1"); if (mpfr_cmp (x, y)) { @@ -164,25 +164,25 @@ main (void) for (p=2; p<100; p++) { mpfr_set_prec (x, p); - for (r = 0; r < GMP_RND_MAX; r++) + for (r = 0; r < MPFR_RND_MAX; r++) { - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_cbrt (x, x, (mp_rnd_t) r); if (mpfr_cmp_ui (x, 1)) { printf ("Error in mpfr_cbrt for x=1, rnd=%s\ngot ", mpfr_print_rnd_mode ((mp_rnd_t) r)); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); mpfr_cbrt (x, x, (mp_rnd_t) r); if (mpfr_cmp_si (x, -1)) { printf ("Error in mpfr_cbrt for x=-1, rnd=%s\ngot ", mpfr_print_rnd_mode ((mp_rnd_t) r)); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } @@ -192,15 +192,15 @@ main (void) int i; for (i = -12; i <= 12; i++) { - mpfr_set_ui (x, 27, GMP_RNDN); - mpfr_mul_2si (x, x, 3*i, GMP_RNDN); - mpfr_cbrt (x, x, GMP_RNDN); + mpfr_set_ui (x, 27, MPFR_RNDN); + mpfr_mul_2si (x, x, 3*i, MPFR_RNDN); + mpfr_cbrt (x, x, MPFR_RNDN); if (mpfr_cmp_si_2exp (x, 3, i)) { printf ("Error in mpfr_cbrt for " "x = 27.0 * 2^(%d), rnd=%s\ngot ", 3*i, mpfr_print_rnd_mode ((mp_rnd_t) r)); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\ninstead of 3 * 2^(%d)\n", i); exit (1); } diff --git a/tests/tcheck.c b/tests/tcheck.c index 305be131f..f3441ff43 100644 --- a/tests/tcheck.c +++ b/tests/tcheck.c @@ -50,18 +50,18 @@ main (void) MPFR_SET_ZERO(a); if (!mpfr_check(a)) ERROR("for zero"); /* Check var */ - mpfr_set_ui(a, 2, GMP_RNDN); + mpfr_set_ui(a, 2, MPFR_RNDN); if (!mpfr_check(a)) ERROR("for set_ui"); mpfr_clear_overflow(); max = 1000; /* Allows max 2^1000 bits for the exponent */ while ((!mpfr_overflow_p()) && (max>0)) { - mpfr_mul(a, a, a, GMP_RNDN); + mpfr_mul(a, a, a, MPFR_RNDN); if (!mpfr_check(a)) ERROR("for mul"); max--; } if (max==0) ERROR("can't reach overflow"); - mpfr_set_ui(a, 2137, GMP_RNDN); + mpfr_set_ui(a, 2137, MPFR_RNDN); /* Corrupt a and check for it */ MPFR_SIGN(a) = 2; if (mpfr_check(a)) ERROR("sgn"); @@ -105,7 +105,7 @@ main (void) MPFR_MANT(a)[MPFR_LIMB_SIZE(a)-1] &= MPFR_LIMB_MASK (BITS_PER_MP_LIMB-1); if (mpfr_check(a)) ERROR("last bits non 0"); /* Final */ - mpfr_set_ui(a, 2137, GMP_RNDN); + mpfr_set_ui(a, 2137, MPFR_RNDN); if (!mpfr_check(a)) ERROR("after last set"); mpfr_clear (a); if (mpfr_check(a)) ERROR("after clear"); diff --git a/tests/tcmp.c b/tests/tcmp.c index b220649f2..53397fc1b 100644 --- a/tests/tcmp.c +++ b/tests/tcmp.c @@ -98,8 +98,8 @@ main (void) mpfr_set_prec (yy, 53); /* bug found by Gerardo Ballabio */ - mpfr_set_ui(xx, 0, GMP_RNDN); - mpfr_set_str (yy, "0.1", 10, GMP_RNDN); + mpfr_set_ui(xx, 0, MPFR_RNDN); + mpfr_set_str (yy, "0.1", 10, MPFR_RNDN); if ((c = mpfr_cmp (xx, yy)) >= 0) { printf ("Error in mpfr_cmp(0.0, 0.1), gives %d\n", c); @@ -107,7 +107,7 @@ main (void) } mpfr_set_inf (xx, 1); - mpfr_set_str (yy, "-23489745.0329", 10, GMP_RNDN); + mpfr_set_str (yy, "-23489745.0329", 10, MPFR_RNDN); if ((c = mpfr_cmp (xx, yy)) <= 0) { printf ("Error in mpfr_cmp(Infp, 23489745.0329), gives %d\n", c); @@ -147,15 +147,15 @@ main (void) } mpfr_set_inf (xx, -1); - mpfr_set_str (yy, "2346.09234", 10, GMP_RNDN); + mpfr_set_str (yy, "2346.09234", 10, MPFR_RNDN); if ((c = mpfr_cmp (xx, yy)) >= 0) { printf ("Error in mpfr_cmp(Infm, 2346.09234), gives %d\n", c); exit (1); } - mpfr_set_ui (xx, 0, GMP_RNDN); - mpfr_set_ui (yy, 1, GMP_RNDN); + mpfr_set_ui (xx, 0, MPFR_RNDN); + mpfr_set_ui (yy, 1, MPFR_RNDN); if ((c = mpfr_cmp3 (xx, yy, 1)) >= 0) { printf ("Error: mpfr_cmp3 (0, 1, 1) gives %d instead of" @@ -176,8 +176,8 @@ main (void) if (!Isnan(x) && !Isnan(y)) { i++; - mpfr_set_d (xx, x, GMP_RNDN); - mpfr_set_d (yy, y, GMP_RNDN); + mpfr_set_d (xx, x, MPFR_RNDN); + mpfr_set_d (yy, y, MPFR_RNDN); c = mpfr_cmp (xx,yy); if ((c>0 && x<=y) || (c==0 && x!=y) || (c<0 && x>=y)) { diff --git a/tests/tcmp2.c b/tests/tcmp2.c index d3cd28083..67ed39565 100644 --- a/tests/tcmp2.c +++ b/tests/tcmp2.c @@ -56,31 +56,31 @@ worst_cases (void) mpfr_init2 (x, 200); mpfr_init2 (y, 200); - mpfr_set_ui (y, 1, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); for (i = 1; i < MPFR_PREC(x); i++) { - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_div_2exp (y, y, 1, GMP_RNDN); /* y = 1/2^i */ + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_div_2exp (y, y, 1, MPFR_RNDN); /* y = 1/2^i */ l = 0; if (mpfr_cmp2 (x, y, &l) <= 0 || l != 1) { printf ("Error in mpfr_cmp2:\nx="); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\ny="); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\ngot %lu instead of 1\n", l); exit (1); } - mpfr_add (x, x, y, GMP_RNDN); /* x = 1 + 1/2^i */ + mpfr_add (x, x, y, MPFR_RNDN); /* x = 1 + 1/2^i */ l = 0; if (mpfr_cmp2 (x, y, &l) <= 0 || l != 0) { printf ("Error in mpfr_cmp2:\nx="); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\ny="); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\ngot %lu instead of 0\n", l); exit (1); } @@ -89,7 +89,7 @@ worst_cases (void) for (i = 0; i < 64; i++) /* |u| = i */ { mpfr_urandomb (x, RANDS); - mpfr_set (y, x, GMP_RNDN); + mpfr_set (y, x, MPFR_RNDN); set_bit (x, i + 1, 1); set_bit (y, i + 1, 0); for (j = 0; j < 64; j++) /* |v| = j */ @@ -110,9 +110,9 @@ worst_cases (void) if (l != expected) { printf ("Error in mpfr_cmp2:\nx="); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\ny="); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\ngot %lu instead of %u\n", l, expected); exit (1); } @@ -124,9 +124,9 @@ worst_cases (void) if (l != expected) { printf ("Error in mpfr_cmp2:\nx="); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\ny="); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\ngot %lu instead of %u\n", l, expected); exit (1); } @@ -152,17 +152,17 @@ tcmp2 (double x, double y, int i) i = (int) (__gmpfr_floor_log2 (x) - __gmpfr_floor_log2 (x - y)); } mpfr_init2(xx, 53); mpfr_init2(yy, 53); - mpfr_set_d (xx, x, GMP_RNDN); - mpfr_set_d (yy, y, GMP_RNDN); + mpfr_set_d (xx, x, MPFR_RNDN); + mpfr_set_d (yy, y, MPFR_RNDN); j = 0; if (mpfr_cmp2 (xx, yy, &j) == 0) { if (x != y) { printf ("Error in mpfr_cmp2 for\nx="); - mpfr_out_str (stdout, 2, 0, xx, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, xx, MPFR_RNDN); printf ("\ny="); - mpfr_out_str (stdout, 2, 0, yy, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, yy, MPFR_RNDN); printf ("\ngot sign 0 for x != y\n"); exit (1); } @@ -170,9 +170,9 @@ tcmp2 (double x, double y, int i) else if (j != (unsigned) i) { printf ("Error in mpfr_cmp2 for\nx="); - mpfr_out_str (stdout, 2, 0, xx, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, xx, MPFR_RNDN); printf ("\ny="); - mpfr_out_str (stdout, 2, 0, yy, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, yy, MPFR_RNDN); printf ("\ngot %lu instead of %d\n", j, i); exit (1); } @@ -248,7 +248,7 @@ special (void) /* bug found by Nathalie Revol, 2 Apr 2001 */ mpfr_set_prec (x, 65); mpfr_set_prec (y, 65); - mpfr_set_ui (x, 5, GMP_RNDN); + mpfr_set_ui (x, 5, MPFR_RNDN); mpfr_set_str_binary (y, "0.10011111111111111111111111111111111111111111111111111111111111101E3"); j = 0; if (mpfr_cmp2(x, y, &j) <= 0 || j != 63) diff --git a/tests/tcmp_d.c b/tests/tcmp_d.c index c3f05fd9c..af5bc9453 100644 --- a/tests/tcmp_d.c +++ b/tests/tcmp_d.c @@ -35,33 +35,33 @@ main (void) mpfr_init2(x, IEEE_DBL_MANT_DIG); - mpfr_set_d (x, 2.34763465, GMP_RNDN); + mpfr_set_d (x, 2.34763465, MPFR_RNDN); if (mpfr_cmp_d(x, 2.34763465)!=0) { printf("Error in mpfr_cmp_d 2.34763465 and "); - mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n'); + mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); exit(1); } if (mpfr_cmp_d(x, 2.345)<=0) { printf("Error in mpfr_cmp_d 2.345 and "); - mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n'); + mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); exit(1); } if (mpfr_cmp_d(x, 2.4)>=0) { printf("Error in mpfr_cmp_d 2.4 and "); - mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n'); + mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); exit(1); } - mpfr_set_ui (x, 0, GMP_RNDZ); - mpfr_neg (x, x, GMP_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_neg (x, x, MPFR_RNDZ); if (mpfr_cmp_d (x, 0.0)) { printf("Error in mpfr_cmp_d 0.0 and "); - mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n'); + mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); exit(1); } - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_ui_div (x, 1, x, GMP_RNDU); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_ui_div (x, 1, x, MPFR_RNDU); if (mpfr_cmp_d (x, 0.0) == 0) { printf ("Error in mpfr_cmp_d (Inf, 0)\n"); diff --git a/tests/tcmp_ld.c b/tests/tcmp_ld.c index e0869b9dc..78ed043f4 100644 --- a/tests/tcmp_ld.c +++ b/tests/tcmp_ld.c @@ -34,33 +34,33 @@ main (void) mpfr_init2(x, MPFR_LDBL_MANT_DIG); - mpfr_set_ld (x, 2.34763465, GMP_RNDN); + mpfr_set_ld (x, 2.34763465, MPFR_RNDN); if (mpfr_cmp_ld(x, 2.34763465)!=0) { printf("Error in mpfr_cmp_ld 2.34763465 and "); - mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n'); + mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); exit(1); } if (mpfr_cmp_ld(x, 2.345)<=0) { printf("Error in mpfr_cmp_ld 2.345 and "); - mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n'); + mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); exit(1); } if (mpfr_cmp_ld(x, 2.4)>=0) { printf("Error in mpfr_cmp_ld 2.4 and "); - mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n'); + mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); exit(1); } - mpfr_set_ui (x, 0, GMP_RNDZ); - mpfr_neg (x, x, GMP_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_neg (x, x, MPFR_RNDZ); if (mpfr_cmp_ld (x, 0.0)) { printf("Error in mpfr_cmp_ld 0.0 and "); - mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); putchar('\n'); + mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); exit(1); } - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_ui_div (x, 1, x, GMP_RNDU); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_ui_div (x, 1, x, MPFR_RNDU); if (mpfr_cmp_ld (x, 0.0) == 0) { printf ("Error in mpfr_cmp_ld (Inf, 0)\n"); diff --git a/tests/tcmp_ui.c b/tests/tcmp_ui.c index e50d302c4..9c569aa9a 100644 --- a/tests/tcmp_ui.c +++ b/tests/tcmp_ui.c @@ -100,7 +100,7 @@ main (void) mpfr_init(x); /* tests for cmp_ui */ - mpfr_set_ui (x, 3, GMP_RNDZ); + mpfr_set_ui (x, 3, MPFR_RNDZ); if ((mpfr_cmp_ui) (x, i = 3) != 0) { printf ("Error in mpfr_cmp_ui(3.0, 3)\n"); @@ -116,14 +116,14 @@ main (void) printf ("Error in mpfr_cmp_ui(3.0,4)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDZ); - mpfr_neg (x, x, GMP_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_neg (x, x, MPFR_RNDZ); if (mpfr_cmp_ui (x, i = 0)) { printf ("Error in mpfr_cmp_ui(0.0,0)\n"); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDZ); + mpfr_set_ui (x, 1, MPFR_RNDZ); if (mpfr_cmp_ui (x, i = 0) == 0) { printf ("Error in mpfr_cmp_ui(1.0,0)\n"); @@ -143,15 +143,15 @@ main (void) exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 1) < 0); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) < 0); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) > 0); /* tests for cmp_si */ - (mpfr_set_si) (x, -3, GMP_RNDZ); + (mpfr_set_si) (x, -3, MPFR_RNDZ); if ((mpfr_cmp_si) (x, s = -3) != 0) { printf ("Error in mpfr_cmp_si(-3.0,-3)\n"); @@ -182,19 +182,19 @@ main (void) } /* case b=0 */ - mpfr_set_ui (x, 0, GMP_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDZ); MPFR_ASSERTN(mpfr_cmp_si (x, 0) == 0); MPFR_ASSERTN(mpfr_cmp_si (x, 1) < 0); MPFR_ASSERTN(mpfr_cmp_si (x, -1) > 0); /* case i=0 */ - mpfr_set_ui (x, 1, GMP_RNDZ); + mpfr_set_ui (x, 1, MPFR_RNDZ); MPFR_ASSERTN(mpfr_cmp_si (x, 0) > 0); - mpfr_set_ui (x, 0, GMP_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDZ); MPFR_ASSERTN(mpfr_cmp_si (x, 0) == 0); - mpfr_neg (x, x, GMP_RNDZ); + mpfr_neg (x, x, MPFR_RNDZ); MPFR_ASSERTN(mpfr_cmp_si (x, 0) == 0); - mpfr_set_si (x, -1, GMP_RNDZ); + mpfr_set_si (x, -1, MPFR_RNDZ); MPFR_ASSERTN(mpfr_cmp_si (x, 0) < 0); /* case large x */ @@ -208,8 +208,8 @@ main (void) MPFR_ASSERTN(mpfr_cmp_si (x, -1) < 0); /* corner case */ - mpfr_set_ui (x, 1, GMP_RNDZ); - mpfr_mul_2exp (x, x, BITS_PER_MP_LIMB - 1, GMP_RNDZ); + mpfr_set_ui (x, 1, MPFR_RNDZ); + mpfr_mul_2exp (x, x, BITS_PER_MP_LIMB - 1, MPFR_RNDZ); /* now EXP(x)=BITS_PER_MP_LIMB */ MPFR_ASSERTN(mpfr_cmp_si (x, 1) > 0); diff --git a/tests/tcmpabs.c b/tests/tcmpabs.c index 2ca18009f..6485c80e3 100644 --- a/tests/tcmpabs.c +++ b/tests/tcmpabs.c @@ -84,13 +84,13 @@ main (void) ERROR ("Error in mpfr_cmpabs: not 1.0000000002 > 1.0\n"); mpfr_set_prec(yy, 53); - mpfr_set_ui(xx, 0, GMP_RNDN); - mpfr_set_str (yy, "-0.1", 10, GMP_RNDN); + mpfr_set_ui(xx, 0, MPFR_RNDN); + mpfr_set_str (yy, "-0.1", 10, MPFR_RNDN); if (mpfr_cmpabs(xx, yy) >= 0) ERROR ("Error in mpfr_cmpabs(0.0, 0.1)\n"); mpfr_set_inf (xx, -1); - mpfr_set_str (yy, "23489745.0329", 10, GMP_RNDN); + mpfr_set_str (yy, "23489745.0329", 10, MPFR_RNDN); if (mpfr_cmpabs(xx, yy) <= 0) ERROR ("Error in mpfr_cmp(-Inf, 23489745.0329)\n"); @@ -100,7 +100,7 @@ main (void) ERROR ("Error in mpfr_cmpabs(Inf, -Inf)\n"); mpfr_set_inf (yy, -1); - mpfr_set_str (xx, "2346.09234", 10, GMP_RNDN); + mpfr_set_str (xx, "2346.09234", 10, MPFR_RNDN); if (mpfr_cmpabs (xx, yy) >= 0) ERROR ("Error in mpfr_cmpabs(-Inf, 2346.09234)\n"); diff --git a/tests/tcomparisons.c b/tests/tcomparisons.c index 31c3fc967..455103b02 100644 --- a/tests/tcomparisons.c +++ b/tests/tcomparisons.c @@ -50,9 +50,9 @@ cmp_tests (void) signy = randlimb () % 256 ? signx : 1 - signx; /* signy = signx most of the time (most interesting case) */ if (signx) - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); if (signy) - mpfr_neg (y, y, GMP_RNDN); + mpfr_neg (y, y, MPFR_RNDN); if (i <= 1) mpfr_set_nan (x); if (i == 0 || i == 2) @@ -78,9 +78,9 @@ cmp_tests (void) (cmp > 0 && cmpbool != 0x13)))) { printf ("Error in cmp_tests for\nx = "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf (" and\ny = "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); exit (1); } @@ -104,15 +104,15 @@ eq_tests (void) mpfr_set_prec (y, precx + (randlimb () % 64)); mpfr_urandomb (x, RANDS); if (randlimb () & 1) - mpfr_neg (x, x, GMP_RNDN); - mpfr_set (y, x, GMP_RNDN); /* exact -> x = y */ + mpfr_neg (x, x, MPFR_RNDN); + mpfr_set (y, x, MPFR_RNDN); /* exact -> x = y */ if (mpfr_greater_p (x, y) || !mpfr_greaterequal_p (x, y) || mpfr_less_p (x, y) || !mpfr_lessequal_p (x, y) || mpfr_lessgreater_p (x, y) || !mpfr_equal_p (x, y) || mpfr_unordered_p (x, y)) { printf ("Error in eq_tests for x = "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } diff --git a/tests/tconst_catalan.c b/tests/tconst_catalan.c index 4c8d1e2e4..232aa7e79 100644 --- a/tests/tconst_catalan.c +++ b/tests/tconst_catalan.c @@ -31,7 +31,7 @@ my_const_catalan (mpfr_ptr x, mpfr_srcptr y, mp_rnd_t r) return mpfr_const_catalan (x, r); } -#define RAND_FUNCTION(x) mpfr_set_ui(x,0,GMP_RNDN) +#define RAND_FUNCTION(x) mpfr_set_ui(x,0,MPFR_RNDN) #define TEST_FUNCTION my_const_catalan #include "tgeneric.c" @@ -43,8 +43,8 @@ main (int argc, char *argv[]) tests_start_mpfr (); mpfr_init2 (x, 32); - (mpfr_const_catalan) (x, GMP_RNDN); - mpfr_mul_2exp (x, x, 32, GMP_RNDN); + (mpfr_const_catalan) (x, MPFR_RNDN); + mpfr_mul_2exp (x, x, 32, MPFR_RNDN); if (mpfr_cmp_ui (x, 3934042271UL)) { printf ("Error in const_catalan for prec=32\n"); diff --git a/tests/tconst_euler.c b/tests/tconst_euler.c index 89fc374dc..18d797fbe 100644 --- a/tests/tconst_euler.c +++ b/tests/tconst_euler.c @@ -32,7 +32,7 @@ my_const_euler (mpfr_ptr x, mpfr_srcptr y, mp_rnd_t r) return mpfr_const_euler (x, r); } -#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, GMP_RNDN) +#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, MPFR_RNDN) #define TEST_FUNCTION my_const_euler #include "tgeneric.c" @@ -50,8 +50,8 @@ main (int argc, char *argv[]) if (argc > 1) { mpfr_init2 (gamma, prec); - mpfr_const_euler (gamma, GMP_RNDN); - printf("gamma="); mpfr_out_str (stdout, 10, 0, gamma, GMP_RNDD); + mpfr_const_euler (gamma, MPFR_RNDN); + printf("gamma="); mpfr_out_str (stdout, 10, 0, gamma, MPFR_RNDD); puts (""); mpfr_clear (gamma); return 0; @@ -63,7 +63,7 @@ main (int argc, char *argv[]) mpfr_set_prec (y, 32); mpfr_set_prec (z, 32); - (mpfr_const_euler) (y, GMP_RNDN); + (mpfr_const_euler) (y, MPFR_RNDN); mpfr_set_str_binary (z, "0.10010011110001000110011111100011"); if (mpfr_cmp (y, z)) { @@ -77,11 +77,11 @@ main (int argc, char *argv[]) mpfr_set_prec (t, prec); yprec = prec + 10; - for (rnd = 0; rnd < GMP_RND_MAX; rnd++) + for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) { mpfr_set_prec (y, yprec); mpfr_const_euler (y, (mp_rnd_t) rnd); - err = (rnd == GMP_RNDN) ? yprec + 1 : yprec; + err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec; if (mpfr_can_round (y, err, (mp_rnd_t) rnd, (mp_rnd_t) rnd, prec)) { mpfr_set (t, y, (mp_rnd_t) rnd); @@ -91,10 +91,10 @@ main (int argc, char *argv[]) printf ("results differ for prec=%u rnd_mode=%s\n", prec, mpfr_print_rnd_mode ((mp_rnd_t) rnd)); printf (" got "); - mpfr_out_str (stdout, 2, prec, z, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); puts (""); printf (" expected "); - mpfr_out_str (stdout, 2, prec, t, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); puts (""); printf (" approximation was "); mpfr_print_binary (y); diff --git a/tests/tconst_log2.c b/tests/tconst_log2.c index 1dbbfa074..fcf4e06bd 100644 --- a/tests/tconst_log2.c +++ b/tests/tconst_log2.c @@ -37,7 +37,7 @@ check (mp_prec_t p0, mp_prec_t p1) mpfr_init (x); mpfr_init (y); mpfr_init2 (z, p1 + 10); - mpfr_const_log2 (z, GMP_RNDN); + mpfr_const_log2 (z, MPFR_RNDN); mpfr_clear_cache (__gmpfr_cache_const_log2); for (; p0<=p1; p0++) @@ -49,7 +49,7 @@ check (mp_prec_t p0, mp_prec_t p1) mpfr_const_log2 (x, rnd); mpfr_set (y, z, rnd); if ((dif = mpfr_cmp (x, y)) - && mpfr_can_round (z, mpfr_get_prec(z), GMP_RNDN, + && mpfr_can_round (z, mpfr_get_prec(z), MPFR_RNDN, rnd, p0)) { printf ("mpfr_const_log2 fails for prec=%u, rnd=%s Diff=%d\n", @@ -72,9 +72,9 @@ check_large (void) mpfr_t x, y; mpfr_init2 (x, 25000); mpfr_init2 (y, 26000); - (mpfr_const_log2) (x, GMP_RNDN); /* First one ! */ - (mpfr_const_log2) (y, GMP_RNDN); /* Then the other - cache - */ - mpfr_prec_round (y, 25000, GMP_RNDN); + (mpfr_const_log2) (x, MPFR_RNDN); /* First one ! */ + (mpfr_const_log2) (y, MPFR_RNDN); /* Then the other - cache - */ + mpfr_prec_round (y, 25000, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("const_log2: error for large prec\n"); @@ -84,7 +84,7 @@ check_large (void) /* worst-case with 15 successive ones after last bit, to exercise can_round loop */ mpfr_set_prec (x, 26249); - mpfr_const_log2 (x, GMP_RNDZ); + mpfr_const_log2 (x, MPFR_RNDZ); mpfr_clears (x, y, (mpfr_ptr) 0); } @@ -97,14 +97,14 @@ check_cache (void) mpfr_init2 (x, 195); mpfr_free_cache (); - i = mpfr_const_log2 (x, GMP_RNDN); + i = mpfr_const_log2 (x, MPFR_RNDN); if (i == 0) { printf("Error for log2. Invalid ternary value (1).\n"); exit (1); } mpfr_set_prec (x, 194); - i = mpfr_const_log2 (x, GMP_RNDN); + i = mpfr_const_log2 (x, MPFR_RNDN); if (i == 0) { printf("Error for log2. Invalid ternary value (2).\n"); @@ -113,10 +113,10 @@ check_cache (void) mpfr_free_cache (); mpfr_set_prec (x, 9); - mpfr_const_log2 (x, GMP_RNDN); + mpfr_const_log2 (x, MPFR_RNDN); mpfr_set_prec (x, 8); - mpfr_const_log2 (x, GMP_RNDN); - if (mpfr_cmp_str (x, "0.10110001E0", 2, GMP_RNDN)) + mpfr_const_log2 (x, MPFR_RNDN); + if (mpfr_cmp_str (x, "0.10110001E0", 2, MPFR_RNDN)) { printf("Error for log2. Wrong rounding.\n"); exit (1); @@ -132,7 +132,7 @@ my_const_log2 (mpfr_ptr x, mpfr_srcptr y, mp_rnd_t r) return mpfr_const_log2 (x, r); } -#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, GMP_RNDN) +#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, MPFR_RNDN) #define TEST_FUNCTION my_const_log2 #include "tgeneric.c" @@ -146,7 +146,7 @@ main (int argc, char *argv[]) tests_start_mpfr (); p = (argc>1) ? atoi(argv[1]) : 53; - rnd = (argc>2) ? (mp_rnd_t) atoi(argv[2]) : GMP_RNDZ; + rnd = (argc>2) ? (mp_rnd_t) atoi(argv[2]) : MPFR_RNDZ; mpfr_init (x); @@ -154,12 +154,12 @@ main (int argc, char *argv[]) /* check precision of 2 bits */ mpfr_set_prec (x, 2); - mpfr_const_log2 (x, GMP_RNDN); + mpfr_const_log2 (x, MPFR_RNDN); if (mpfr_cmp_ui_2exp(x, 3, -2)) /* 3*2^-2 */ { - printf ("mpfr_const_log2 failed for prec=2, rnd=GMP_RNDN\n" + printf ("mpfr_const_log2 failed for prec=2, rnd=MPFR_RNDN\n" "expected 0.75, got "); - mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); exit (1); } @@ -174,7 +174,7 @@ main (int argc, char *argv[]) } mpfr_set_prec (x, 53); - mpfr_const_log2 (x, GMP_RNDZ); + mpfr_const_log2 (x, MPFR_RNDZ); if (mpfr_cmp_str1 (x, "6.9314718055994530941e-1") ) { printf ("mpfr_const_log2 failed for prec=53\n"); @@ -182,7 +182,7 @@ main (int argc, char *argv[]) } mpfr_set_prec (x, 32); - mpfr_const_log2 (x, GMP_RNDN); + mpfr_const_log2 (x, MPFR_RNDN); if (mpfr_cmp_str1 (x, "0.69314718060195446")) { printf ("mpfr_const_log2 failed for prec=32\n"); diff --git a/tests/tconst_pi.c b/tests/tconst_pi.c index 120eabe14..b3eebfbc4 100644 --- a/tests/tconst_pi.c +++ b/tests/tconst_pi.c @@ -37,15 +37,15 @@ check_large (void) mpfr_init2 (z, 11791); /* The algo failed to round for p=11791. */ - (mpfr_const_pi) (z, GMP_RNDU); - mpfr_const_pi (x, GMP_RNDN); /* First one ! */ - mpfr_const_pi (y, GMP_RNDN); /* Then the other - cache - */ - mpfr_prec_round (y, 20000, GMP_RNDN); + (mpfr_const_pi) (z, MPFR_RNDU); + mpfr_const_pi (x, MPFR_RNDN); /* First one ! */ + mpfr_const_pi (y, MPFR_RNDN); /* Then the other - cache - */ + mpfr_prec_round (y, 20000, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("const_pi: error for large prec (%d)\n", 1); exit (1); } - mpfr_prec_round (y, 11791, GMP_RNDU); + mpfr_prec_round (y, 11791, MPFR_RNDU); if (mpfr_cmp (z, y)) { printf ("const_pi: error for large prec (%d)\n", 2); exit (1); @@ -54,7 +54,7 @@ check_large (void) /* a worst-case to exercise recomputation */ if (MPFR_PREC_MAX > 33440) { mpfr_set_prec (x, 33440); - mpfr_const_pi (x, GMP_RNDZ); + mpfr_const_pi (x, MPFR_RNDZ); } mpfr_clears (x, y, z, (mpfr_ptr) 0); @@ -67,7 +67,7 @@ my_const_pi (mpfr_ptr x, mpfr_srcptr y, mp_rnd_t r) return mpfr_const_pi (x, r); } -#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, GMP_RNDN) +#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, MPFR_RNDN) #define TEST_FUNCTION my_const_pi #include "tgeneric.c" @@ -88,7 +88,7 @@ main (int argc, char *argv[]) p = a; } - rnd = (argc > 2) ? (mp_rnd_t) atoi(argv[2]) : GMP_RNDZ; + rnd = (argc > 2) ? (mp_rnd_t) atoi(argv[2]) : MPFR_RNDZ; mpfr_init2 (x, p); mpfr_const_pi (x, rnd); @@ -104,12 +104,12 @@ main (int argc, char *argv[]) else if (mpfr_cmp_str1 (x, "3.141592653589793116") ) { printf ("mpfr_const_pi failed for prec=53\n"); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); exit (1); } mpfr_set_prec (x, 32); - mpfr_const_pi (x, GMP_RNDN); + mpfr_const_pi (x, MPFR_RNDN); if (mpfr_cmp_str1 (x, "3.141592653468251") ) { printf ("mpfr_const_pi failed for prec=32\n"); diff --git a/tests/tcopysign.c b/tests/tcopysign.c index c1693a880..91bbe918b 100644 --- a/tests/tcopysign.c +++ b/tests/tcopysign.c @@ -33,22 +33,22 @@ copysign_variant (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, switch (k) { case 0: - mpfr_copysign (z, x, y, GMP_RNDN); + mpfr_copysign (z, x, y, MPFR_RNDN); return; case 1: - (mpfr_copysign) (z, x, y, GMP_RNDN); + (mpfr_copysign) (z, x, y, MPFR_RNDN); return; case 2: - mpfr_setsign (z, x, mpfr_signbit (y), GMP_RNDN); + mpfr_setsign (z, x, mpfr_signbit (y), MPFR_RNDN); return; case 3: - mpfr_setsign (z, x, (mpfr_signbit) (y), GMP_RNDN); + mpfr_setsign (z, x, (mpfr_signbit) (y), MPFR_RNDN); return; case 4: - (mpfr_setsign) (z, x, mpfr_signbit (y), GMP_RNDN); + (mpfr_setsign) (z, x, mpfr_signbit (y), MPFR_RNDN); return; case 5: - (mpfr_setsign) (z, x, (mpfr_signbit) (y), GMP_RNDN); + (mpfr_setsign) (z, x, (mpfr_signbit) (y), MPFR_RNDN); return; } } @@ -73,7 +73,7 @@ main (void) i ? MPFR_SET_NEG (x) : MPFR_SET_POS (x); mpfr_set_nan (y); j ? MPFR_SET_NEG (y) : MPFR_SET_POS (y); - copysign_variant (z, x, y, GMP_RNDN, k); + copysign_variant (z, x, y, MPFR_RNDN, k); if (MPFR_SIGN (z) != MPFR_SIGN (y) || !mpfr_nanflag_p ()) { printf ("Error in mpfr_copysign (%cNaN, %cNaN)\n", @@ -81,12 +81,12 @@ main (void) exit (1); } - mpfr_set_si (x, i ? -1250 : 1250, GMP_RNDN); + mpfr_set_si (x, i ? -1250 : 1250, MPFR_RNDN); mpfr_set_nan (y); j ? MPFR_SET_NEG (y) : MPFR_SET_POS (y); - copysign_variant (z, x, y, GMP_RNDN, k); + copysign_variant (z, x, y, MPFR_RNDN, k); if (i != j) - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); if (! mpfr_equal_p (z, x) || mpfr_nanflag_p ()) { printf ("Error in mpfr_copysign (%c1250, %cNaN)\n", @@ -94,11 +94,11 @@ main (void) exit (1); } - mpfr_set_si (x, i ? -1250 : 1250, GMP_RNDN); - mpfr_set_si (y, j ? -1717 : 1717, GMP_RNDN); - copysign_variant (z, x, y, GMP_RNDN, k); + mpfr_set_si (x, i ? -1250 : 1250, MPFR_RNDN); + mpfr_set_si (y, j ? -1717 : 1717, MPFR_RNDN); + copysign_variant (z, x, y, MPFR_RNDN, k); if (i != j) - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); if (! mpfr_equal_p (z, x) || mpfr_nanflag_p ()) { printf ("Error in mpfr_copysign (%c1250, %c1717)\n", diff --git a/tests/tcos.c b/tests/tcos.c index 4cbef916d..eedc40b26 100644 --- a/tests/tcos.c +++ b/tests/tcos.c @@ -30,7 +30,7 @@ static int test_cos (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode) { int res; - int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53; + int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53; if (ok) { mpfr_print_raw (b); @@ -61,7 +61,7 @@ check53 (const char *xs, const char *cos_xs, mp_rnd_t rnd_mode) printf ("mpfr_cos failed for x=%s, rnd=%s\n", xs, mpfr_print_rnd_mode (rnd_mode)); printf ("mpfr_cos gives cos(x)="); - mpfr_out_str(stdout, 10, 0, c, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, c, MPFR_RNDN); printf(", expected %s\n", cos_xs); exit (1); } @@ -81,7 +81,7 @@ check_nans (void) mpfr_init2 (y, 123L); mpfr_set_nan (x); - test_cos (y, x, GMP_RNDN); + test_cos (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: cos(NaN) != NaN\n"); @@ -89,7 +89,7 @@ check_nans (void) } mpfr_set_inf (x, 1); - test_cos (y, x, GMP_RNDN); + test_cos (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: cos(Inf) != NaN\n"); @@ -97,7 +97,7 @@ check_nans (void) } mpfr_set_inf (x, -1); - test_cos (y, x, GMP_RNDN); + test_cos (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: cos(-Inf) != NaN\n"); @@ -105,15 +105,15 @@ check_nans (void) } /* cos(+/-0) = 1 */ - mpfr_set_ui (x, 0, GMP_RNDN); - test_cos (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + test_cos (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { printf ("Error: cos(+0) != 1\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - test_cos (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + test_cos (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { printf ("Error: cos(-0) != 1\n"); @@ -123,10 +123,10 @@ check_nans (void) /* Compute ~Pi/2 to check */ /* FIXME: Too slow! mpfr_set_prec (x, 20000); - mpfr_const_pi (x, GMP_RNDD); mpfr_div_2ui (x, x, 1, GMP_RNDN); + mpfr_const_pi (x, MPFR_RNDD); mpfr_div_2ui (x, x, 1, MPFR_RNDN); mpfr_set_prec (y, 24); - test_cos (y, x, GMP_RNDN); - if (mpfr_cmp_str (y, "0.111001010110100011000001E-20000", 2, GMP_RNDN)) + test_cos (y, x, MPFR_RNDN); + if (mpfr_cmp_str (y, "0.111001010110100011000001E-20000", 2, MPFR_RNDN)) { printf("Error computing cos(~Pi/2)\n"); mpfr_dump (y); @@ -153,7 +153,7 @@ special_overflow (void) set_emin (-125); set_emax (128); mpfr_set_str_binary (x, "0.111101010110110011101101E6"); - test_cos (y, x, GMP_RNDZ); + test_cos (y, x, MPFR_RNDZ); set_emin (emin); set_emax (emax); @@ -175,17 +175,17 @@ overflowed_cos0 (void) for (emax = -1; emax <= 0; emax++) { - mpfr_set_ui_2exp (y, 1, emax, GMP_RNDN); + mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN); mpfr_nextbelow (y); set_emax (emax); /* 1 is not representable. */ /* and if emax < 0, 1 - eps is not representable either. */ for (i = -1; i <= 1; i++) RND_LOOP (rnd) { - mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN); + mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN); mpfr_clear_flags (); inex = mpfr_cos (x, x, (mp_rnd_t) rnd); - if ((i == 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) && + if ((i == 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) && ! mpfr_overflow_p ()) { printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n" @@ -193,7 +193,7 @@ overflowed_cos0 (void) i, mpfr_print_rnd_mode ((mp_rnd_t) rnd)); err = 1; } - if (rnd == GMP_RNDZ || rnd == GMP_RNDD) + if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) { if (inex >= 0) { @@ -255,17 +255,17 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 53); mpfr_set_prec (y, 2); - mpfr_set_str (x, "9.81333845856942e-1", 10, GMP_RNDN); - test_cos (y, x, GMP_RNDN); + mpfr_set_str (x, "9.81333845856942e-1", 10, MPFR_RNDN); + test_cos (y, x, MPFR_RNDN); mpfr_set_prec (x, 30); mpfr_set_prec (y, 30); mpfr_set_str_binary (x, "1.00001010001101110010100010101e-1"); - test_cos (y, x, GMP_RNDU); + test_cos (y, x, MPFR_RNDU); mpfr_set_str_binary (x, "1.10111100010101011110101010100e-1"); if (mpfr_cmp (y, x)) { - printf ("Error for prec=30, rnd=GMP_RNDU\n"); + printf ("Error for prec=30, rnd=MPFR_RNDU\n"); printf ("expected "); mpfr_print_binary (x); puts (""); printf (" got "); mpfr_print_binary (y); puts (""); exit (1); @@ -274,11 +274,11 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 59); mpfr_set_prec (y, 59); mpfr_set_str_binary (x, "1.01101011101111010011111110111111111011011101100111100011e-3"); - test_cos (y, x, GMP_RNDU); + test_cos (y, x, MPFR_RNDU); mpfr_set_str_binary (x, "1.1111011111110010001001001011100111101110100010000010010011e-1"); if (mpfr_cmp (y, x)) { - printf ("Error for prec=59, rnd=GMP_RNDU\n"); + printf ("Error for prec=59, rnd=MPFR_RNDU\n"); printf ("expected "); mpfr_print_binary (x); puts (""); printf (" got "); mpfr_print_binary (y); puts (""); exit (1); @@ -287,11 +287,11 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 5); mpfr_set_prec (y, 5); mpfr_set_str_binary (x, "1.1100e-2"); - test_cos (y, x, GMP_RNDD); + test_cos (y, x, MPFR_RNDD); mpfr_set_str_binary (x, "1.1100e-1"); if (mpfr_cmp (y, x)) { - printf ("Error for x=1.1100e-2, rnd=GMP_RNDD\n"); + printf ("Error for x=1.1100e-2, rnd=MPFR_RNDD\n"); printf ("expected 1.1100e-1, got "); mpfr_print_binary (y); puts (""); exit (1); } @@ -301,7 +301,7 @@ main (int argc, char *argv[]) mpfr_set_str_binary (x, "0.10001000001001011000100001E-6"); mpfr_set_str_binary (y, "0.1111111111111101101111001100001"); - test_cos (x, x, GMP_RNDN); + test_cos (x, x, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("Error for prec=32 (1)\n"); @@ -310,7 +310,7 @@ main (int argc, char *argv[]) mpfr_set_str_binary (x, "-0.1101011110111100111010011001011E-1"); mpfr_set_str_binary (y, "0.11101001100110111011011010100011"); - test_cos (x, x, GMP_RNDN); + test_cos (x, x, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("Error for prec=32 (2)\n"); @@ -320,7 +320,7 @@ main (int argc, char *argv[]) /* huge argument reduction */ mpfr_set_str_binary (x, "0.10000010000001101011101111001011E40"); mpfr_set_str_binary (y, "0.10011000001111010000101011001011E-1"); - test_cos (x, x, GMP_RNDN); + test_cos (x, x, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("Error for prec=32 (3)\n"); @@ -330,20 +330,20 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 3); mpfr_set_prec (y, 3); mpfr_set_str_binary (x, "0.110E60"); - inex = mpfr_cos (y, x, GMP_RNDD); + inex = mpfr_cos (y, x, MPFR_RNDD); MPFR_ASSERTN(inex < 0); /* worst case from PhD thesis of Vincent Lefe`vre: x=8980155785351021/2^54 */ - check53 ("4.984987858808754279e-1", "8.783012931285841817e-1", GMP_RNDN); - check53 ("4.984987858808754279e-1", "8.783012931285840707e-1", GMP_RNDD); - check53 ("4.984987858808754279e-1", "8.783012931285840707e-1", GMP_RNDZ); - check53 ("4.984987858808754279e-1", "8.783012931285841817e-1", GMP_RNDU); - check53 ("1.00031274099908640274", "0.540039116973283217504", GMP_RNDN); - check53 ("1.00229256850978698523", "0.538371757797526551137", GMP_RNDZ); - check53 ("1.00288304857059840103", "0.537874062022526966409", GMP_RNDZ); - check53 ("1.00591265847407274059", "0.53531755997839769456", GMP_RNDN); + check53 ("4.984987858808754279e-1", "8.783012931285841817e-1", MPFR_RNDN); + check53 ("4.984987858808754279e-1", "8.783012931285840707e-1", MPFR_RNDD); + check53 ("4.984987858808754279e-1", "8.783012931285840707e-1", MPFR_RNDZ); + check53 ("4.984987858808754279e-1", "8.783012931285841817e-1", MPFR_RNDU); + check53 ("1.00031274099908640274", "0.540039116973283217504", MPFR_RNDN); + check53 ("1.00229256850978698523", "0.538371757797526551137", MPFR_RNDZ); + check53 ("1.00288304857059840103", "0.537874062022526966409", MPFR_RNDZ); + check53 ("1.00591265847407274059", "0.53531755997839769456", MPFR_RNDN); - check53 ("1.00591265847407274059", "0.53531755997839769456", GMP_RNDN); + check53 ("1.00591265847407274059", "0.53531755997839769456", MPFR_RNDN); overflowed_cos0 (); test_generic (2, 100, 15); @@ -352,7 +352,7 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 3); mpfr_set_prec (y, 13); mpfr_set_str_binary (x, "-0.100E196"); - inex = mpfr_cos (y, x, GMP_RNDU); + inex = mpfr_cos (y, x, MPFR_RNDU); mpfr_set_prec (x, 13); mpfr_set_str_binary (x, "0.1111111100101"); MPFR_ASSERTN (inex > 0 && mpfr_equal_p (x, y)); diff --git a/tests/tcosh.c b/tests/tcosh.c index 1326b2c7c..e6abe2098 100644 --- a/tests/tcosh.c +++ b/tests/tcosh.c @@ -40,7 +40,7 @@ special (void) mpfr_init (y); mpfr_set_nan (x); - mpfr_cosh (y, x, GMP_RNDN); + mpfr_cosh (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: cosh(NaN) != NaN\n"); @@ -48,7 +48,7 @@ special (void) } mpfr_set_inf (x, 1); - mpfr_cosh (y, x, GMP_RNDN); + mpfr_cosh (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error: cosh(+Inf) != +Inf\n"); @@ -56,7 +56,7 @@ special (void) } mpfr_set_inf (x, -1); - mpfr_cosh (y, x, GMP_RNDN); + mpfr_cosh (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error: cosh(-Inf) != +Inf\n"); @@ -64,15 +64,15 @@ special (void) } /* cosh(+/-0) = 1 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_cosh (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_cosh (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { printf ("Error: cosh(+0) != 1\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_cosh (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_cosh (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { printf ("Error: cosh(-0) != 1\n"); @@ -84,7 +84,7 @@ special (void) mpfr_set_str_binary (x, "0.1101110111111111001011101000101"); mpfr_set_str_binary (y, "1.0110011001110000101100011001001"); - mpfr_cosh (x, x, GMP_RNDN); + mpfr_cosh (x, x, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("Error: mpfr_cosh for prec=32 (1)\n"); @@ -93,7 +93,7 @@ special (void) mpfr_set_str_binary (x, "-0.1110111000011101010111100000101E-1"); mpfr_set_str_binary (y, "1.0001110000101111111111100110101"); - mpfr_cosh (x, x, GMP_RNDN); + mpfr_cosh (x, x, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("Error: mpfr_cosh for prec=32 (2)\n"); @@ -103,28 +103,28 @@ special (void) mpfr_set_prec (x, 2); mpfr_clear_flags (); mpfr_set_str_binary (x, "1E1000000000"); - i = mpfr_cosh (x, x, GMP_RNDN); + i = mpfr_cosh (x, x, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); - i = mpfr_cosh (x, x, GMP_RNDN); + i = mpfr_cosh (x, x, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); - i = mpfr_cosh (x, x, GMP_RNDD); + i = mpfr_cosh (x, x, MPFR_RNDD); MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == -1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); - i = mpfr_cosh (x, x, GMP_RNDU); + i = mpfr_cosh (x, x, MPFR_RNDU); MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == 1); @@ -153,8 +153,8 @@ special_overflow (void) mpfr_init2 (y, 24); mpfr_set_str_binary (x, "0.101100100000000000110100E7"); - mpfr_cosh (y, x, GMP_RNDN); - if (mpfr_cmp_str (y, "0.101010001111001010001110E128", 2, GMP_RNDN)) + mpfr_cosh (y, x, MPFR_RNDN); + if (mpfr_cmp_str (y, "0.101010001111001010001110E128", 2, MPFR_RNDN)) { printf("Special overflow error 1.\n"); mpfr_dump (y); @@ -162,7 +162,7 @@ special_overflow (void) } mpfr_set_str_binary (x, "0.101100100000000000110100E8"); - mpfr_cosh (y, x, GMP_RNDN); + mpfr_cosh (y, x, MPFR_RNDN); if (!mpfr_inf_p(y)) { printf("Special overflow error 2.\n"); @@ -174,7 +174,7 @@ special_overflow (void) set_emax (emax); mpfr_set_str_binary (x, "0.101100100000000000110100E1000000"); - mpfr_cosh (y, x, GMP_RNDN); + mpfr_cosh (y, x, MPFR_RNDN); if (!mpfr_inf_p(y)) { printf("Special overflow error 3.\n"); diff --git a/tests/tcot.c b/tests/tcot.c index 4062c436a..bb33c6acb 100644 --- a/tests/tcot.c +++ b/tests/tcot.c @@ -38,7 +38,7 @@ check_specials (void) mpfr_init2 (y, 123L); mpfr_set_nan (x); - mpfr_cot (y, x, GMP_RNDN); + mpfr_cot (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: cot(NaN) != NaN\n"); @@ -46,7 +46,7 @@ check_specials (void) } mpfr_set_inf (x, 1); - mpfr_cot (y, x, GMP_RNDN); + mpfr_cot (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: cot(Inf) != NaN\n"); @@ -54,7 +54,7 @@ check_specials (void) } mpfr_set_inf (x, -1); - mpfr_cot (y, x, GMP_RNDN); + mpfr_cot (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: cot(-Inf) != NaN\n"); @@ -62,15 +62,15 @@ check_specials (void) } /* cot(+/-0) = +/-Inf */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_cot (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_cot (y, x, MPFR_RNDN); if (! (mpfr_inf_p (y) && mpfr_sgn (y) > 0)) { printf ("Error: cot(+0) != +Inf\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_cot (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_cot (y, x, MPFR_RNDN); if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0)) { printf ("Error: cot(-0) != -Inf\n"); @@ -101,14 +101,14 @@ two2emin (mp_exp_t e) for (i = -4; i <= 4; i++) RND_LOOP (rnd) { - mpfr_set_si (y, i, GMP_RNDN); + mpfr_set_si (y, i, MPFR_RNDN); mpfr_ui_div (y, 1, y, (mp_rnd_t) rnd); /* no overflow/underflow */ - mpfr_set_si_2exp (x, i, -e, GMP_RNDN); + mpfr_set_si_2exp (x, i, -e, MPFR_RNDN); if (ABS (i) != 3) /* not a power of 2 (not 0 either) */ mpfr_sub (y, y, x, (mp_rnd_t) rnd); /* no overflow/underflow */ - mpfr_set_ui_2exp (x, 1, -e, GMP_RNDN); + mpfr_set_ui_2exp (x, 1, -e, MPFR_RNDN); mpfr_div (y, y, x, (mp_rnd_t) rnd); /* 1/x - SIGN(x).epsilon */ - mpfr_set_si_2exp (x, i, -e, GMP_RNDN); + mpfr_set_si_2exp (x, i, -e, MPFR_RNDN); mpfr_cot (x, x, (mp_rnd_t) rnd); if (! mpfr_equal_p (x, y)) { diff --git a/tests/tcoth.c b/tests/tcoth.c index be2373bd5..5ab4ee204 100644 --- a/tests/tcoth.c +++ b/tests/tcoth.c @@ -37,7 +37,7 @@ check_specials (void) mpfr_init2 (y, 123L); mpfr_set_nan (x); - mpfr_coth (y, x, GMP_RNDN); + mpfr_coth (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: coth(NaN) != NaN\n"); @@ -45,7 +45,7 @@ check_specials (void) } mpfr_set_inf (x, 1); - mpfr_coth (y, x, GMP_RNDN); + mpfr_coth (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { printf ("Error: coth(Inf) != 1\n"); @@ -53,7 +53,7 @@ check_specials (void) } mpfr_set_inf (x, -1); - mpfr_coth (y, x, GMP_RNDN); + mpfr_coth (y, x, MPFR_RNDN); if (mpfr_cmp_si (y, -1)) { printf ("Error: coth(-Inf) != -1\n"); @@ -61,15 +61,15 @@ check_specials (void) } /* cot(+/-0) = +/-0 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_coth (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_coth (y, x, MPFR_RNDN); if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0)) { printf ("Error: coth(+0) != +0\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_coth (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_coth (y, x, MPFR_RNDN); if (! (mpfr_zero_p (y) && MPFR_SIGN (y) < 0)) { printf ("Error: coth(-0) != -0\n"); @@ -89,9 +89,9 @@ check_bugs (void) mpfr_init (y); /* bug found by Rob (Sisyphus) on 16 Sep 2005 */ - mpfr_set_ui (x, 2, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); mpfr_set_prec (y, 2); - mpfr_coth (y, x, GMP_RNDN); + mpfr_coth (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { printf ("Error for coth(2), expected 1, got "); @@ -102,25 +102,25 @@ check_bugs (void) mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); - mpfr_set_str (x, "18.368400284838550", 10, GMP_RNDN); - mpfr_set_str (y, "1.0000000000000002", 10, GMP_RNDN); - mpfr_coth (x, x, GMP_RNDN); + mpfr_set_str (x, "18.368400284838550", 10, MPFR_RNDN); + mpfr_set_str (y, "1.0000000000000002", 10, MPFR_RNDN); + mpfr_coth (x, x, MPFR_RNDN); if (mpfr_cmp (x, y) != 0) { printf ("Error for coth(18.368400284838550)\n"); exit (1); } - mpfr_set_str (x, "18.714973875118520", 10, GMP_RNDN); - mpfr_coth (x, x, GMP_RNDN); + mpfr_set_str (x, "18.714973875118520", 10, MPFR_RNDN); + mpfr_coth (x, x, MPFR_RNDN); if (mpfr_cmp (x, y) != 0) { printf ("Error for coth(18.714973875118520)\n"); exit (1); } - mpfr_set_str (x, "18.714973875118524", 10, GMP_RNDN); - mpfr_coth (x, x, GMP_RNDN); + mpfr_set_str (x, "18.714973875118524", 10, MPFR_RNDN); + mpfr_coth (x, x, MPFR_RNDN); if (mpfr_cmp_ui (x, 1) != 0) { printf ("Error for coth(18.714973875118524)\n"); @@ -158,11 +158,11 @@ underflowed_cothinf (void) i, mpfr_print_rnd_mode ((mp_rnd_t) rnd)); err = 1; } - mpfr_set_si (y, (i < 0 && (rnd == GMP_RNDD || rnd == GMP_RNDA)) || - (i > 0 && (rnd == GMP_RNDU || rnd == GMP_RNDA)) - ? 2 : 0, GMP_RNDN); + mpfr_set_si (y, (i < 0 && (rnd == MPFR_RNDD || rnd == MPFR_RNDA)) || + (i > 0 && (rnd == MPFR_RNDU || rnd == MPFR_RNDA)) + ? 2 : 0, MPFR_RNDN); if (i < 0) - mpfr_neg (y, y, GMP_RNDN); + mpfr_neg (y, y, MPFR_RNDN); if (! (mpfr_equal_p (x, y) && MPFR_MULT_SIGN (MPFR_SIGN (x), MPFR_SIGN (y)) > 0)) { @@ -174,16 +174,16 @@ underflowed_cothinf (void) printf (".\n"); err = 1; } - if ((rnd == GMP_RNDD || - (i > 0 && (rnd == GMP_RNDN || rnd == GMP_RNDZ))) && inex >= 0) + if ((rnd == MPFR_RNDD || + (i > 0 && (rnd == MPFR_RNDN || rnd == MPFR_RNDZ))) && inex >= 0) { printf ("Error in underflowed_cothinf (i = %d, rnd = %s):\n" " The inexact value must be negative.\n", i, mpfr_print_rnd_mode ((mp_rnd_t) rnd)); err = 1; } - if ((rnd == GMP_RNDU || - (i < 0 && (rnd == GMP_RNDN || rnd == GMP_RNDZ))) && inex <= 0) + if ((rnd == MPFR_RNDU || + (i < 0 && (rnd == MPFR_RNDN || rnd == MPFR_RNDZ))) && inex <= 0) { printf ("Error in underflowed_cothinf (i = %d, rnd = %s):\n" " The inexact value must be positive.\n", diff --git a/tests/tcsc.c b/tests/tcsc.c index 136d7f3d4..088d7bb9c 100644 --- a/tests/tcsc.c +++ b/tests/tcsc.c @@ -38,7 +38,7 @@ check_specials (void) mpfr_init2 (y, 123L); mpfr_set_nan (x); - mpfr_csc (y, x, GMP_RNDN); + mpfr_csc (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: csc(NaN) != NaN\n"); @@ -46,7 +46,7 @@ check_specials (void) } mpfr_set_inf (x, 1); - mpfr_csc (y, x, GMP_RNDN); + mpfr_csc (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: csc(Inf) != NaN\n"); @@ -54,7 +54,7 @@ check_specials (void) } mpfr_set_inf (x, -1); - mpfr_csc (y, x, GMP_RNDN); + mpfr_csc (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: csc(-Inf) != NaN\n"); @@ -62,15 +62,15 @@ check_specials (void) } /* csc(+/-0) = +/-Inf */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_csc (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_csc (y, x, MPFR_RNDN); if (! (mpfr_inf_p (y) && mpfr_sgn (y) > 0)) { printf ("Error: csc(+0) != +Inf\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_csc (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_csc (y, x, MPFR_RNDN); if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0)) { printf ("Error: csc(-0) != -Inf\n"); diff --git a/tests/tcsch.c b/tests/tcsch.c index bf391516b..f48861a90 100644 --- a/tests/tcsch.c +++ b/tests/tcsch.c @@ -38,7 +38,7 @@ check_specials (void) mpfr_init2 (y, 123L); mpfr_set_nan (x); - mpfr_csch (y, x, GMP_RNDN); + mpfr_csch (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: csch(NaN) != NaN\n"); @@ -46,7 +46,7 @@ check_specials (void) } mpfr_set_inf (x, 1); - mpfr_csch (y, x, GMP_RNDN); + mpfr_csch (y, x, MPFR_RNDN); if (! (mpfr_zero_p (y) && MPFR_SIGN (y) >0)) { printf ("Error: csch(+Inf) != +0\n"); @@ -54,7 +54,7 @@ check_specials (void) } mpfr_set_inf (x, -1); - mpfr_csch (y, x, GMP_RNDN); + mpfr_csch (y, x, MPFR_RNDN); if (! (mpfr_zero_p (y) && MPFR_SIGN (y) <0)) { printf ("Error: csch(-0) != -0\n"); @@ -62,15 +62,15 @@ check_specials (void) } /* csc(+/-0) = +/-Inf */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_csch (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_csch (y, x, MPFR_RNDN); if (! (mpfr_inf_p (y) && mpfr_sgn (y) > 0)) { printf ("Error: csch(+0) != +Inf\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_csch (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_csch (y, x, MPFR_RNDN); if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0)) { printf ("Error: csch(-0) != -Inf\n"); @@ -78,15 +78,15 @@ check_specials (void) } /* check huge x */ - mpfr_set_str (x, "8e8", 10, GMP_RNDN); - mpfr_csch (y, x, GMP_RNDN); + mpfr_set_str (x, "8e8", 10, MPFR_RNDN); + mpfr_csch (y, x, MPFR_RNDN); if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0)) { printf ("Error: csch(8e8) != +0\n"); exit (1); } - mpfr_set_str (x, "-8e8", 10, GMP_RNDN); - mpfr_csch (y, x, GMP_RNDN); + mpfr_set_str (x, "-8e8", 10, MPFR_RNDN); + mpfr_csch (y, x, MPFR_RNDN); if (! (mpfr_zero_p (y) && MPFR_SIGN (y) < 0)) { printf ("Error: csch(-8e8) != -0\n"); diff --git a/tests/td_div.c b/tests/td_div.c index 4e6e895c1..f4c605992 100644 --- a/tests/td_div.c +++ b/tests/td_div.c @@ -40,7 +40,7 @@ check_nans (void) /* 1.0 / nan is nan */ mpfr_set_nan (x); mpfr_clear_flags (); - inexact = mpfr_d_div (y, 1.0, x, GMP_RNDN); + inexact = mpfr_d_div (y, 1.0, x, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); MPFR_ASSERTN (mpfr_nan_p (y)); @@ -48,7 +48,7 @@ check_nans (void) /* 1.0 / +inf == +0 */ mpfr_set_inf (x, 1); mpfr_clear_flags (); - inexact = mpfr_d_div (y, 1.0, x, GMP_RNDN); + inexact = mpfr_d_div (y, 1.0, x, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_zero_p (y)); @@ -57,16 +57,16 @@ check_nans (void) /* 1.0 / -inf == -0 */ mpfr_set_inf (x, -1); mpfr_clear_flags (); - inexact = mpfr_d_div (y, 1.0, x, GMP_RNDN); + inexact = mpfr_d_div (y, 1.0, x, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_zero_p (y)); MPFR_ASSERTN (MPFR_IS_NEG (y)); /* 1.0 / 0 == +inf */ - mpfr_set_d (x, 0.0, GMP_RNDN); + mpfr_set_d (x, 0.0, MPFR_RNDN); mpfr_clear_flags (); - inexact = mpfr_d_div (y, 1.0, x, GMP_RNDN); + inexact = mpfr_d_div (y, 1.0, x, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_inf_p (y)); @@ -95,24 +95,24 @@ main (void) mpfr_init2 (y, IEEE_DBL_MANT_DIG); mpfr_init2 (z, IEEE_DBL_MANT_DIG); - mpfr_set_str (y, "4096", 10, GMP_RNDN); + mpfr_set_str (y, "4096", 10, MPFR_RNDN); d = 0.125; mpfr_clear_flags (); - inexact = mpfr_d_div (x, d, y, GMP_RNDN); + inexact = mpfr_d_div (x, d, y, MPFR_RNDN); if (inexact != 0) { printf ("Inexact flag error in mpfr_d_div\n"); exit (1); } - mpfr_set_str (z, " 0.000030517578125", 10, GMP_RNDN); + mpfr_set_str (z, " 0.000030517578125", 10, MPFR_RNDN); if (mpfr_cmp (z, x)) { printf ("Error in mpfr_d_div ("); - mpfr_out_str (stdout, 10, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN); printf (" + %.20g)\nexpected ", d); - mpfr_out_str (stdout, 10, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN); printf ("\ngot "); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } diff --git a/tests/td_sub.c b/tests/td_sub.c index 745dfb886..ab0abd4a3 100644 --- a/tests/td_sub.c +++ b/tests/td_sub.c @@ -40,7 +40,7 @@ check_nans (void) /* 1.0 - nan is nan */ mpfr_set_nan (x); mpfr_clear_flags (); - inexact = mpfr_d_sub (y, 1.0, x, GMP_RNDN); + inexact = mpfr_d_sub (y, 1.0, x, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); MPFR_ASSERTN (mpfr_nan_p (y)); @@ -48,7 +48,7 @@ check_nans (void) /* 1.0 - +inf == -inf */ mpfr_set_inf (x, 1); mpfr_clear_flags (); - inexact = mpfr_d_sub (y, 1.0, x, GMP_RNDN); + inexact = mpfr_d_sub (y, 1.0, x, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_inf_p (y)); @@ -57,7 +57,7 @@ check_nans (void) /* 1.0 - -inf == +inf */ mpfr_set_inf (x, -1); mpfr_clear_flags (); - inexact = mpfr_d_sub (y, 1.0, x, GMP_RNDN); + inexact = mpfr_d_sub (y, 1.0, x, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_inf_p (y)); @@ -86,24 +86,24 @@ main (void) mpfr_init2 (y, IEEE_DBL_MANT_DIG); mpfr_init2 (z, IEEE_DBL_MANT_DIG); - mpfr_set_str (y, "4096", 10, GMP_RNDN); + mpfr_set_str (y, "4096", 10, MPFR_RNDN); d = 0.125; mpfr_clear_flags (); - inexact = mpfr_d_sub (x, d, y, GMP_RNDN); + inexact = mpfr_d_sub (x, d, y, MPFR_RNDN); if (inexact != 0) { printf ("Inexact flag error in mpfr_d_sub\n"); exit (1); } - mpfr_set_str (z, "-4095.875", 10, GMP_RNDN); + mpfr_set_str (z, "-4095.875", 10, MPFR_RNDN); if (mpfr_cmp (z, x)) { printf ("Error in mpfr_d_sub ("); - mpfr_out_str (stdout, 10, 7, y, GMP_RNDN); + mpfr_out_str (stdout, 10, 7, y, MPFR_RNDN); printf (" + %.20g)\nexpected ", d); - mpfr_out_str (stdout, 10, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN); printf ("\ngot "); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } diff --git a/tests/tdim.c b/tests/tdim.c index 3dfe6ed95..bab6a7bf8 100644 --- a/tests/tdim.c +++ b/tests/tdim.c @@ -45,8 +45,8 @@ main (void) /* case x=NaN */ mpfr_set_nan (x); - mpfr_set_ui (y, 0, GMP_RNDN); - mpfr_dim (z, x, y, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); + mpfr_dim (z, x, y, MPFR_RNDN); if (!mpfr_nan_p (z)) { printf ("Error in mpfr_dim (NaN, 0)\n"); @@ -55,8 +55,8 @@ main (void) /* case x=+Inf */ mpfr_set_inf (x, 1); - mpfr_set_ui (y, 0, GMP_RNDN); - mpfr_dim (z, x, y, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); + mpfr_dim (z, x, y, MPFR_RNDN); if (!mpfr_inf_p (z) || mpfr_sgn (z) < 0) { printf ("Error in mpfr_dim (+Inf, 0)\n"); @@ -65,8 +65,8 @@ main (void) /* case x=-Inf */ mpfr_set_inf (x, -1); - mpfr_set_ui (y, 0, GMP_RNDN); - mpfr_dim (z, x, y, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); + mpfr_dim (z, x, y, MPFR_RNDN); if (mpfr_cmp_ui (z, 0) || mpfr_sgn (z) < 0) { printf ("Error in mpfr_dim (-Inf, 0)\n"); @@ -76,7 +76,7 @@ main (void) /* case x=y=+Inf */ mpfr_set_inf (x, 1); mpfr_set_inf (y, 1); - mpfr_dim (z, x, y, GMP_RNDN); + mpfr_dim (z, x, y, MPFR_RNDN); if (mpfr_cmp_ui (z, 0) || mpfr_sgn (z) < 0) { printf ("Error in mpfr_dim (+Inf, +Inf)\n"); @@ -84,9 +84,9 @@ main (void) } /* case x > y */ - mpfr_set_ui (x, 2, GMP_RNDN); - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_dim (z, x, y, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_dim (z, x, y, MPFR_RNDN); if (mpfr_cmp_ui (z, 1)) { printf ("Error in mpfr_dim (2, 1)\n"); @@ -94,9 +94,9 @@ main (void) } /* case x < y */ - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_set_ui (y, 2, GMP_RNDN); - mpfr_dim (z, x, y, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_set_ui (y, 2, MPFR_RNDN); + mpfr_dim (z, x, y, MPFR_RNDN); if (mpfr_cmp_ui (z, 0)) { printf ("Error in mpfr_dim (1, 2)\n"); diff --git a/tests/tdiv.c b/tests/tdiv.c index 3f454af4b..043b214d2 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -30,7 +30,7 @@ static int test_div (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) { int res; - int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_number_p (c); + int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c); if (ok) { mpfr_print_raw (b); @@ -74,12 +74,12 @@ check4 (const char *Ns, const char *Ds, mp_rnd_t rnd_mode, int p, mpfr_set_str1 (n, Ns); mpfr_set_str1 (d, Ds); test_div(q, n, d, rnd_mode); - if (mpfr_cmp_str (q, Qs, ((p==53) ? 10 : 2), GMP_RNDN) ) + if (mpfr_cmp_str (q, Qs, ((p==53) ? 10 : 2), MPFR_RNDN) ) { printf ("mpfr_div failed for n=%s, d=%s, p=%d, rnd_mode=%s\n", Ns, Ds, p, mpfr_print_rnd_mode (rnd_mode)); printf ("got ");mpfr_print_binary(q); - mpfr_set_str (q, Qs, ((p==53) ? 10 : 2), GMP_RNDN); + mpfr_set_str (q, Qs, ((p==53) ? 10 : 2), MPFR_RNDN); printf("\nexpected "); mpfr_print_binary(q); putchar('\n'); exit (1); @@ -102,7 +102,7 @@ check24 (const char *Ns, const char *Ds, mp_rnd_t rnd_mode, const char *Qs) printf ("mpfr_div failed for n=%s, d=%s, prec=24, rnd_mode=%s\n", Ns, Ds, mpfr_print_rnd_mode(rnd_mode)); printf ("expected quotient is %s, got ", Qs); - mpfr_out_str(stdout,10,0,q, GMP_RNDN); putchar('\n'); + mpfr_out_str(stdout,10,0,q, MPFR_RNDN); putchar('\n'); exit (1); } mpfr_clears (q, n, d, (mpfr_ptr) 0); @@ -113,85 +113,85 @@ check24 (const char *Ns, const char *Ds, mp_rnd_t rnd_mode, const char *Qs) static void check_float(void) { - check24("70368760954880.0", "8388609.0", GMP_RNDN, "8.388609e6"); - check24("140737479966720.0", "16777213.0", GMP_RNDN, "8.388609e6"); - check24("70368777732096.0", "8388611.0", GMP_RNDN, "8.388609e6"); - check24("105553133043712.0", "12582911.0", GMP_RNDN, "8.38861e6"); + check24("70368760954880.0", "8388609.0", MPFR_RNDN, "8.388609e6"); + check24("140737479966720.0", "16777213.0", MPFR_RNDN, "8.388609e6"); + check24("70368777732096.0", "8388611.0", MPFR_RNDN, "8.388609e6"); + check24("105553133043712.0", "12582911.0", MPFR_RNDN, "8.38861e6"); /* the exponent for the following example was forgotten in the Arith'14 version of Parks' paper */ - check24 ("12582913.0", "12582910.0", GMP_RNDN, "1.000000238"); - check24 ("105553124655104.0", "12582910.0", GMP_RNDN, "8388610.0"); - check24("140737479966720.0", "8388609.0", GMP_RNDN, "1.6777213e7"); - check24("70368777732096.0", "8388609.0", GMP_RNDN, "8.388611e6"); - check24("105553133043712.0", "8388610.0", GMP_RNDN, "1.2582911e7"); - check24("105553124655104.0", "8388610.0", GMP_RNDN, "1.258291e7"); - - check24("70368760954880.0", "8388609.0", GMP_RNDZ, "8.388608e6"); - check24("140737479966720.0", "16777213.0", GMP_RNDZ, "8.388609e6"); - check24("70368777732096.0", "8388611.0", GMP_RNDZ, "8.388608e6"); - check24("105553133043712.0", "12582911.0", GMP_RNDZ, "8.38861e6"); - check24("12582913.0", "12582910.0", GMP_RNDZ, "1.000000238"); - check24 ("105553124655104.0", "12582910.0", GMP_RNDZ, "8388610.0"); - check24("140737479966720.0", "8388609.0", GMP_RNDZ, "1.6777213e7"); - check24("70368777732096.0", "8388609.0", GMP_RNDZ, "8.38861e6"); - check24("105553133043712.0", "8388610.0", GMP_RNDZ, "1.2582911e7"); - check24("105553124655104.0", "8388610.0", GMP_RNDZ, "1.258291e7"); - - check24("70368760954880.0", "8388609.0", GMP_RNDU, "8.388609e6"); - check24("140737479966720.0", "16777213.0", GMP_RNDU, "8.38861e6"); - check24("70368777732096.0", "8388611.0", GMP_RNDU, "8.388609e6"); - check24("105553133043712.0", "12582911.0", GMP_RNDU, "8.388611e6"); - check24("12582913.0", "12582910.0", GMP_RNDU, "1.000000357"); - check24 ("105553124655104.0", "12582910.0", GMP_RNDU, "8388611.0"); - check24("140737479966720.0", "8388609.0", GMP_RNDU, "1.6777214e7"); - check24("70368777732096.0", "8388609.0", GMP_RNDU, "8.388611e6"); - check24("105553133043712.0", "8388610.0", GMP_RNDU, "1.2582912e7"); - check24("105553124655104.0", "8388610.0", GMP_RNDU, "1.2582911e7"); - - check24("70368760954880.0", "8388609.0", GMP_RNDD, "8.388608e6"); - check24("140737479966720.0", "16777213.0", GMP_RNDD, "8.388609e6"); - check24("70368777732096.0", "8388611.0", GMP_RNDD, "8.388608e6"); - check24("105553133043712.0", "12582911.0", GMP_RNDD, "8.38861e6"); - check24("12582913.0", "12582910.0", GMP_RNDD, "1.000000238"); - check24 ("105553124655104.0", "12582910.0", GMP_RNDD, "8388610.0"); - check24("140737479966720.0", "8388609.0", GMP_RNDD, "1.6777213e7"); - check24("70368777732096.0", "8388609.0", GMP_RNDD, "8.38861e6"); - check24("105553133043712.0", "8388610.0", GMP_RNDD, "1.2582911e7"); - check24("105553124655104.0", "8388610.0", GMP_RNDD, "1.258291e7"); - - check24("70368760954880.0", "8388609.0", GMP_RNDA, "8.388609e6"); + check24 ("12582913.0", "12582910.0", MPFR_RNDN, "1.000000238"); + check24 ("105553124655104.0", "12582910.0", MPFR_RNDN, "8388610.0"); + check24("140737479966720.0", "8388609.0", MPFR_RNDN, "1.6777213e7"); + check24("70368777732096.0", "8388609.0", MPFR_RNDN, "8.388611e6"); + check24("105553133043712.0", "8388610.0", MPFR_RNDN, "1.2582911e7"); + check24("105553124655104.0", "8388610.0", MPFR_RNDN, "1.258291e7"); + + check24("70368760954880.0", "8388609.0", MPFR_RNDZ, "8.388608e6"); + check24("140737479966720.0", "16777213.0", MPFR_RNDZ, "8.388609e6"); + check24("70368777732096.0", "8388611.0", MPFR_RNDZ, "8.388608e6"); + check24("105553133043712.0", "12582911.0", MPFR_RNDZ, "8.38861e6"); + check24("12582913.0", "12582910.0", MPFR_RNDZ, "1.000000238"); + check24 ("105553124655104.0", "12582910.0", MPFR_RNDZ, "8388610.0"); + check24("140737479966720.0", "8388609.0", MPFR_RNDZ, "1.6777213e7"); + check24("70368777732096.0", "8388609.0", MPFR_RNDZ, "8.38861e6"); + check24("105553133043712.0", "8388610.0", MPFR_RNDZ, "1.2582911e7"); + check24("105553124655104.0", "8388610.0", MPFR_RNDZ, "1.258291e7"); + + check24("70368760954880.0", "8388609.0", MPFR_RNDU, "8.388609e6"); + check24("140737479966720.0", "16777213.0", MPFR_RNDU, "8.38861e6"); + check24("70368777732096.0", "8388611.0", MPFR_RNDU, "8.388609e6"); + check24("105553133043712.0", "12582911.0", MPFR_RNDU, "8.388611e6"); + check24("12582913.0", "12582910.0", MPFR_RNDU, "1.000000357"); + check24 ("105553124655104.0", "12582910.0", MPFR_RNDU, "8388611.0"); + check24("140737479966720.0", "8388609.0", MPFR_RNDU, "1.6777214e7"); + check24("70368777732096.0", "8388609.0", MPFR_RNDU, "8.388611e6"); + check24("105553133043712.0", "8388610.0", MPFR_RNDU, "1.2582912e7"); + check24("105553124655104.0", "8388610.0", MPFR_RNDU, "1.2582911e7"); + + check24("70368760954880.0", "8388609.0", MPFR_RNDD, "8.388608e6"); + check24("140737479966720.0", "16777213.0", MPFR_RNDD, "8.388609e6"); + check24("70368777732096.0", "8388611.0", MPFR_RNDD, "8.388608e6"); + check24("105553133043712.0", "12582911.0", MPFR_RNDD, "8.38861e6"); + check24("12582913.0", "12582910.0", MPFR_RNDD, "1.000000238"); + check24 ("105553124655104.0", "12582910.0", MPFR_RNDD, "8388610.0"); + check24("140737479966720.0", "8388609.0", MPFR_RNDD, "1.6777213e7"); + check24("70368777732096.0", "8388609.0", MPFR_RNDD, "8.38861e6"); + check24("105553133043712.0", "8388610.0", MPFR_RNDD, "1.2582911e7"); + check24("105553124655104.0", "8388610.0", MPFR_RNDD, "1.258291e7"); + + check24("70368760954880.0", "8388609.0", MPFR_RNDA, "8.388609e6"); } static void check_double(void) { - check53("0.0", "1.0", GMP_RNDZ, "0.0"); - check53("-7.4988969224688591e63", "4.8816866450288732e306", GMP_RNDD, + check53("0.0", "1.0", MPFR_RNDZ, "0.0"); + check53("-7.4988969224688591e63", "4.8816866450288732e306", MPFR_RNDD, "-1.5361282826510687291e-243"); check53("-1.33225773037748601769e+199", "3.63449540676937123913e+79", - GMP_RNDZ, "-3.6655920045905428978e119"); - check53("9.89438396044940256501e-134", "5.93472984109987421717e-67",GMP_RNDU, + MPFR_RNDZ, "-3.6655920045905428978e119"); + check53("9.89438396044940256501e-134", "5.93472984109987421717e-67",MPFR_RNDU, "1.6672003992376663654e-67"); - check53("9.89438396044940256501e-134", "5.93472984109987421717e-67",GMP_RNDA, + check53("9.89438396044940256501e-134", "5.93472984109987421717e-67",MPFR_RNDA, "1.6672003992376663654e-67"); check53("9.89438396044940256501e-134", "-5.93472984109987421717e-67", - GMP_RNDU, "-1.6672003992376663654e-67"); + MPFR_RNDU, "-1.6672003992376663654e-67"); check53("-4.53063926135729747564e-308", "7.02293374921793516813e-84", - GMP_RNDD, "-6.4512060388748850857e-225"); + MPFR_RNDD, "-6.4512060388748850857e-225"); check53("6.25089225176473806123e-01","-2.35527154824420243364e-230", - GMP_RNDD, "-2.6540006635008291192e229"); + MPFR_RNDD, "-2.6540006635008291192e229"); check53("6.25089225176473806123e-01","-2.35527154824420243364e-230", - GMP_RNDA, "-2.6540006635008291192e229"); - check53("6.52308934689126e15", "-1.62063546601505417497e273", GMP_RNDN, + MPFR_RNDA, "-2.6540006635008291192e229"); + check53("6.52308934689126e15", "-1.62063546601505417497e273", MPFR_RNDN, "-4.0250194961676020848e-258"); check53("1.04636807108079349236e-189", "3.72295730823253012954e-292", - GMP_RNDZ, "2.810583051186143125e102"); + MPFR_RNDZ, "2.810583051186143125e102"); /* problems found by Kevin under HP-PA */ - check53 ("2.861044553323177e-136", "-1.1120354257068143e+45", GMP_RNDZ, + check53 ("2.861044553323177e-136", "-1.1120354257068143e+45", MPFR_RNDZ, "-2.5727998292003016e-181"); - check53 ("-4.0559157245809205e-127", "-1.1237723844524865e+77", GMP_RNDN, + check53 ("-4.0559157245809205e-127", "-1.1237723844524865e+77", MPFR_RNDN, "3.6091968273068081e-204"); - check53 ("-1.8177943561493235e-93", "-8.51233984260364e-104", GMP_RNDU, + check53 ("-1.8177943561493235e-93", "-8.51233984260364e-104", MPFR_RNDU, "2.1354814184595821e+10"); } @@ -204,10 +204,10 @@ check_64(void) mpfr_set_str_binary(x, "1.00100100110110101001010010101111000001011100100101010000000000E54"); mpfr_set_str_binary(y, "1.00000000000000000000000000000000000000000000000000000000000000E584"); - test_div(z, x, y, GMP_RNDU); - if (mpfr_cmp_str (z, "0.1001001001101101010010100101011110000010111001001010100000000000E-529", 2, GMP_RNDN)) + test_div(z, x, y, MPFR_RNDU); + if (mpfr_cmp_str (z, "0.1001001001101101010010100101011110000010111001001010100000000000E-529", 2, MPFR_RNDN)) { - printf("Error for tdiv for GMP_RNDU and p=64\nx="); + printf("Error for tdiv for MPFR_RNDU and p=64\nx="); mpfr_print_binary(x); printf("\ny="); mpfr_print_binary(y); @@ -228,18 +228,18 @@ check_convergence (void) mpfr_init2(x, 130); mpfr_set_str_binary(x, "0.1011111101011010101000001010011111101000011100011101010011111011000011001010000000111100100111110011001010110100100001001000111001E6944"); mpfr_init2(y, 130); - mpfr_set_ui(y, 5, GMP_RNDN); - test_div(x, x, y, GMP_RNDD); /* exact division */ + mpfr_set_ui(y, 5, MPFR_RNDN); + test_div(x, x, y, MPFR_RNDD); /* exact division */ mpfr_set_prec(x, 64); mpfr_set_prec(y, 64); mpfr_set_str_binary(x, "0.10010010011011010100101001010111100000101110010010101E55"); mpfr_set_str_binary(y, "0.1E585"); - test_div(x, x, y, GMP_RNDN); + test_div(x, x, y, MPFR_RNDN); mpfr_set_str_binary(y, "0.10010010011011010100101001010111100000101110010010101E-529"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_div for prec=64, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_div for prec=64, rnd=MPFR_RNDN\n"); printf ("got "); mpfr_print_binary(x); puts (""); printf ("instead of "); mpfr_print_binary(y); puts (""); exit(1); @@ -249,10 +249,10 @@ check_convergence (void) { mpfr_set_prec(x, i); mpfr_set_prec(y, i); - mpfr_set_ui(x, 1, GMP_RNDN); + mpfr_set_ui(x, 1, MPFR_RNDN); RND_LOOP(j) { - mpfr_set_ui (y, 1, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); test_div (y, x, y, (mp_rnd_t) j); if (mpfr_cmp_ui (y, 1)) { @@ -278,7 +278,7 @@ get_inexact (mpfr_t y, mpfr_t x, mpfr_t u) mpfr_t xx; int inex; mpfr_init2 (xx, mpfr_get_prec (y) + mpfr_get_prec (u)); - mpfr_mul (xx, y, u, GMP_RNDN); /* exact */ + mpfr_mul (xx, y, u, MPFR_RNDN); /* exact */ inex = mpfr_cmp (xx, x); mpfr_clear (xx); return inex; @@ -312,7 +312,7 @@ check_hard (void) while (mpfr_cmp_ui (q2, 0) == 0); } else /* use q2=1 */ - mpfr_set_ui (q2, 1, GMP_RNDN); + mpfr_set_ui (q2, 1, MPFR_RNDN); for (precv = precq; precv <= 10 * precq; precv += precq) { mpfr_set_prec (v, precv); @@ -324,7 +324,7 @@ check_hard (void) for (precu = precq; precu <= 10 * precq; precu += precq) { mpfr_set_prec (u, precu); - mpfr_mul (u, v, q2, GMP_RNDN); + mpfr_mul (u, v, q2, MPFR_RNDN); mpfr_nextbelow (u); for (i = 0; i <= 2; i++) { @@ -340,7 +340,7 @@ check_hard (void) printf ("v= "); mpfr_dump (v); printf ("q= "); mpfr_dump (q); mpfr_set_prec (q2, precq + precv); - mpfr_mul (q2, q, v, GMP_RNDN); + mpfr_mul (q2, q, v, MPFR_RNDN); printf ("q*v="); mpfr_dump (q2); exit (1); } @@ -384,12 +384,12 @@ check_lowr (void) mpfr_urandomb (tmp, RANDS); } while (mpfr_cmp_ui (tmp, 0) == 0); - mpfr_mul (x, z, tmp, GMP_RNDN); /* exact */ - c = test_div (z2, x, tmp, GMP_RNDN); + mpfr_mul (x, z, tmp, MPFR_RNDN); /* exact */ + c = test_div (z2, x, tmp, MPFR_RNDN); if (c || mpfr_cmp (z2, z)) { - printf ("Error in mpfr_div rnd=GMP_RNDN\n"); + printf ("Error in mpfr_div rnd=MPFR_RNDN\n"); printf ("got "); mpfr_print_binary(z2); puts (""); printf ("instead of "); mpfr_print_binary(z); puts (""); printf ("inex flag = %d, expected 0\n", c); @@ -407,15 +407,15 @@ check_lowr (void) mpfr_urandomb (tmp, RANDS); } while (mpfr_cmp_ui (tmp, 0) == 0); - mpfr_mul (x, z, tmp, GMP_RNDN); /* exact */ - c = test_div (z2, x, tmp, GMP_RNDN); + mpfr_mul (x, z, tmp, MPFR_RNDN); /* exact */ + c = test_div (z2, x, tmp, MPFR_RNDN); /* since z2 has one less bit that z, either the division is exact if z is representable on 9 bits, or we have an even round case */ c2 = get_inexact (z2, x, tmp); if ((mpfr_cmp (z2, z) == 0 && c) || inex_cmp (c, c2)) { - printf ("Error in mpfr_div rnd=GMP_RNDN\n"); + printf ("Error in mpfr_div rnd=MPFR_RNDN\n"); printf ("got "); mpfr_print_binary(z2); puts (""); printf ("instead of "); mpfr_print_binary(z); puts (""); printf ("inex flag = %d, expected %d\n", c, c2); @@ -426,7 +426,7 @@ check_lowr (void) mpfr_nexttoinf (z); if (mpfr_cmp(z2, z)) { - printf ("Error in mpfr_div [even rnd?] rnd=GMP_RNDN\n"); + printf ("Error in mpfr_div [even rnd?] rnd=MPFR_RNDN\n"); printf ("Dividing "); printf ("got "); mpfr_print_binary(z2); puts (""); printf ("instead of "); mpfr_print_binary(z); puts (""); @@ -439,7 +439,7 @@ check_lowr (void) mpfr_nexttozero (z); if (mpfr_cmp(z2, z)) { - printf ("Error in mpfr_div [even rnd?] rnd=GMP_RNDN\n"); + printf ("Error in mpfr_div [even rnd?] rnd=MPFR_RNDN\n"); printf ("Dividing "); printf ("got "); mpfr_print_binary(z2); puts (""); printf ("instead of "); mpfr_print_binary(z); puts (""); @@ -468,30 +468,30 @@ check_lowr (void) mpfr_urandomb (tmp, RANDS); } while (mpfr_cmp_ui (tmp, 0) == 0); - mpfr_mul(x, z, tmp, GMP_RNDN); - mpfr_set(y, tmp, GMP_RNDD); + mpfr_mul(x, z, tmp, MPFR_RNDN); + mpfr_set(y, tmp, MPFR_RNDD); mpfr_nexttoinf (x); - c = test_div(z2, x, y, GMP_RNDD); - test_div(z3, x, y, GMP_RNDD); - mpfr_set(z, z3, GMP_RNDD); + c = test_div(z2, x, y, MPFR_RNDD); + test_div(z3, x, y, MPFR_RNDD); + mpfr_set(z, z3, MPFR_RNDD); if (c != -1 || mpfr_cmp(z2, z)) { - printf ("Error in mpfr_div rnd=GMP_RNDD\n"); + printf ("Error in mpfr_div rnd=MPFR_RNDD\n"); printf ("got "); mpfr_print_binary(z2); puts (""); printf ("instead of "); mpfr_print_binary(z); puts (""); printf ("inex flag = %d\n", c); exit (1); } - mpfr_set (y, tmp, GMP_RNDU); - test_div (z3, x, y, GMP_RNDU); - mpfr_set (z, z3, GMP_RNDU); - c = test_div (z2, x, y, GMP_RNDU); + mpfr_set (y, tmp, MPFR_RNDU); + test_div (z3, x, y, MPFR_RNDU); + mpfr_set (z, z3, MPFR_RNDU); + c = test_div (z2, x, y, MPFR_RNDU); if (c != 1 || mpfr_cmp (z2, z)) { - printf ("Error in mpfr_div rnd=GMP_RNDU\n"); + printf ("Error in mpfr_div rnd=MPFR_RNDU\n"); printf ("u="); mpfr_dump (x); printf ("v="); mpfr_dump (y); printf ("got "); mpfr_print_binary (z2); puts (""); @@ -528,8 +528,8 @@ check_inexact (void) mpfr_set_prec (y, 28); mpfr_set_prec (z, 1023); mpfr_set_str_binary (x, "0.1000001001101101111100010011E0"); - mpfr_set_str (z, "48284762641021308813686974720835219181653367326353400027913400579340343320519877153813133510034402932651132854764198688352364361009429039801248971901380781746767119334993621199563870113045276395603170432175354501451429471578325545278975153148347684600400321033502982713296919861760382863826626093689036010394", 10, GMP_RNDN); - mpfr_div (x, x, z, GMP_RNDN); + mpfr_set_str (z, "48284762641021308813686974720835219181653367326353400027913400579340343320519877153813133510034402932651132854764198688352364361009429039801248971901380781746767119334993621199563870113045276395603170432175354501451429471578325545278975153148347684600400321033502982713296919861760382863826626093689036010394", 10, MPFR_RNDN); + mpfr_div (x, x, z, MPFR_RNDN); mpfr_set_str_binary (y, "0.1111001011001101001001111100E-1023"); if (mpfr_cmp (x, y)) { @@ -544,13 +544,13 @@ check_inexact (void) mpfr_set_prec (u, 127); mpfr_set_str_binary (u, "0.1000001100110110110101110110101101111000110000001111111110000000011111001010110100110010111111111101000001011011101011101101000E-2"); mpfr_set_prec (y, 95); - inexact = test_div (y, x, u, GMP_RNDN); + inexact = test_div (y, x, u, MPFR_RNDN); if (inexact != (cmp = get_inexact (y, x, u))) { printf ("Wrong inexact flag (0): expected %d, got %d\n", cmp, inexact); - printf ("x="); mpfr_out_str (stdout, 10, 99, x, GMP_RNDN); printf ("\n"); - printf ("u="); mpfr_out_str (stdout, 10, 99, u, GMP_RNDN); printf ("\n"); - printf ("y="); mpfr_out_str (stdout, 10, 99, y, GMP_RNDN); printf ("\n"); + printf ("x="); mpfr_out_str (stdout, 10, 99, x, MPFR_RNDN); printf ("\n"); + printf ("u="); mpfr_out_str (stdout, 10, 99, u, MPFR_RNDN); printf ("\n"); + printf ("y="); mpfr_out_str (stdout, 10, 99, y, MPFR_RNDN); printf ("\n"); exit (1); } @@ -559,7 +559,7 @@ check_inexact (void) mpfr_set_prec (u, 2); mpfr_set_str_binary (u, "0.1E0"); mpfr_set_prec (y, 28); - if ((inexact = test_div (y, x, u, GMP_RNDN) >= 0)) + if ((inexact = test_div (y, x, u, MPFR_RNDN) >= 0)) { printf ("Wrong inexact flag (1): expected -1, got %d\n", inexact); @@ -571,9 +571,9 @@ check_inexact (void) mpfr_set_prec (u, 15); mpfr_set_str_binary (u, "0.101101000001100E-1"); mpfr_set_prec (y, 92); - if ((inexact = test_div (y, x, u, GMP_RNDN)) <= 0) + if ((inexact = test_div (y, x, u, MPFR_RNDN)) <= 0) { - printf ("Wrong inexact flag for rnd=GMP_RNDN(1): expected 1, got %d\n", + printf ("Wrong inexact flag for rnd=MPFR_RNDN(1): expected 1, got %d\n", inexact); mpfr_dump (x); mpfr_dump (u); @@ -638,39 +638,39 @@ check_nan (void) mpfr_init2 (q, 100L); /* 1/nan == nan */ - mpfr_set_ui (a, 1L, GMP_RNDN); + mpfr_set_ui (a, 1L, MPFR_RNDN); MPFR_SET_NAN (d); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_nan_p (q)); /* nan/1 == nan */ MPFR_SET_NAN (a); - mpfr_set_ui (d, 1L, GMP_RNDN); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_ui (d, 1L, MPFR_RNDN); + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_nan_p (q)); /* +inf/1 == +inf */ MPFR_CLEAR_FLAGS (a); MPFR_SET_INF (a); MPFR_SET_POS (a); - mpfr_set_ui (d, 1L, GMP_RNDN); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_ui (d, 1L, MPFR_RNDN); + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_inf_p (q)); MPFR_ASSERTN (mpfr_sgn (q) > 0); /* 1/+inf == 0 */ - mpfr_set_ui (a, 1L, GMP_RNDN); + mpfr_set_ui (a, 1L, MPFR_RNDN); MPFR_CLEAR_FLAGS (d); MPFR_SET_INF (d); MPFR_SET_POS (d); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_number_p (q)); MPFR_ASSERTN (mpfr_sgn (q) == 0); /* 0/0 == nan */ - mpfr_set_ui (a, 0L, GMP_RNDN); - mpfr_set_ui (d, 0L, GMP_RNDN); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_ui (a, 0L, MPFR_RNDN); + mpfr_set_ui (d, 0L, MPFR_RNDN); + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_nan_p (q)); /* +inf/+inf == nan */ @@ -680,50 +680,50 @@ check_nan (void) MPFR_CLEAR_FLAGS (d); MPFR_SET_INF (d); MPFR_SET_POS (d); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_nan_p (q)); /* 1/+0 = +Inf */ - mpfr_set_ui (a, 1, GMP_RNDZ); - mpfr_set_ui (d, 0, GMP_RNDZ); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_ui (a, 1, MPFR_RNDZ); + mpfr_set_ui (d, 0, MPFR_RNDZ); + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0); /* 1/-0 = -Inf */ - mpfr_set_ui (a, 1, GMP_RNDZ); - mpfr_set_ui (d, 0, GMP_RNDZ); - mpfr_neg (d, d, GMP_RNDZ); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_ui (a, 1, MPFR_RNDZ); + mpfr_set_ui (d, 0, MPFR_RNDZ); + mpfr_neg (d, d, MPFR_RNDZ); + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) < 0); /* -1/+0 = -Inf */ - mpfr_set_si (a, -1, GMP_RNDZ); - mpfr_set_ui (d, 0, GMP_RNDZ); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_si (a, -1, MPFR_RNDZ); + mpfr_set_ui (d, 0, MPFR_RNDZ); + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) < 0); /* -1/-0 = +Inf */ - mpfr_set_si (a, -1, GMP_RNDZ); - mpfr_set_ui (d, 0, GMP_RNDZ); - mpfr_neg (d, d, GMP_RNDZ); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_si (a, -1, MPFR_RNDZ); + mpfr_set_ui (d, 0, MPFR_RNDZ); + mpfr_neg (d, d, MPFR_RNDZ); + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0); /* check overflow */ emax = mpfr_get_emax (); set_emax (1); - mpfr_set_ui (a, 1, GMP_RNDZ); - mpfr_set_ui (d, 1, GMP_RNDZ); - mpfr_div_2exp (d, d, 1, GMP_RNDZ); - test_div (q, a, d, GMP_RNDU); /* 1 / 0.5 = 2 -> overflow */ + mpfr_set_ui (a, 1, MPFR_RNDZ); + mpfr_set_ui (d, 1, MPFR_RNDZ); + mpfr_div_2exp (d, d, 1, MPFR_RNDZ); + test_div (q, a, d, MPFR_RNDU); /* 1 / 0.5 = 2 -> overflow */ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0); set_emax (emax); /* check underflow */ emin = mpfr_get_emin (); set_emin (-1); - mpfr_set_ui (a, 1, GMP_RNDZ); - mpfr_div_2exp (a, a, 2, GMP_RNDZ); + mpfr_set_ui (a, 1, MPFR_RNDZ); + mpfr_div_2exp (a, a, 2, MPFR_RNDZ); mpfr_set_prec (d, mpfr_get_prec (q) + 8); for (i = -1; i <= 1; i++) { @@ -731,8 +731,8 @@ check_nan (void) /* Test 2^(-2) / (+/- (2 + eps)), with eps < 0, eps = 0, eps > 0. -> underflow. - With div.c r5513, this test fails for eps > 0 in GMP_RNDN. */ - mpfr_set_ui (d, 2, GMP_RNDZ); + With div.c r5513, this test fails for eps > 0 in MPFR_RNDN. */ + mpfr_set_ui (d, 2, MPFR_RNDZ); if (i < 0) mpfr_nextbelow (d); if (i > 0) @@ -740,18 +740,18 @@ check_nan (void) for (sign = 0; sign <= 1; sign++) { mpfr_clear_flags (); - test_div (q, a, d, GMP_RNDZ); /* result = 0 */ + test_div (q, a, d, MPFR_RNDZ); /* result = 0 */ MPFR_ASSERTN (mpfr_underflow_p ()); MPFR_ASSERTN (sign ? MPFR_IS_NEG (q) : MPFR_IS_POS (q)); MPFR_ASSERTN (MPFR_IS_ZERO (q)); mpfr_clear_flags (); - test_div (q, a, d, GMP_RNDN); /* result = 0 iff eps >= 0 */ + test_div (q, a, d, MPFR_RNDN); /* result = 0 iff eps >= 0 */ MPFR_ASSERTN (mpfr_underflow_p ()); MPFR_ASSERTN (sign ? MPFR_IS_NEG (q) : MPFR_IS_POS (q)); if (i < 0) mpfr_nexttozero (q); MPFR_ASSERTN (MPFR_IS_ZERO (q)); - mpfr_neg (d, d, GMP_RNDN); + mpfr_neg (d, d, MPFR_RNDN); } } set_emin (emin); @@ -790,8 +790,8 @@ consistency (void) inex1 = mpfr_div (z1, x, y, rnd); MPFR_ASSERTN (!MPFR_IS_NAN (z1)); p = MAX (MAX (px, py), pz); - if (mpfr_prec_round (x, p, GMP_RNDN) != 0 || - mpfr_prec_round (y, p, GMP_RNDN) != 0) + if (mpfr_prec_round (x, p, MPFR_RNDN) != 0 || + mpfr_prec_round (y, p, MPFR_RNDN) != 0) { printf ("mpfr_prec_round error for i = %d\n", i); exit (1); @@ -819,11 +819,11 @@ test_20070603 (void) mpfr_init2 (q, 31); mpfr_init2 (c, 31); - mpfr_set_str (n, "10384593717069655257060992206846485", 10, GMP_RNDN); - mpfr_set_str (d, "10384593717069655257060992206847132", 10, GMP_RNDN); - mpfr_div (q, n, d, GMP_RNDU); + mpfr_set_str (n, "10384593717069655257060992206846485", 10, MPFR_RNDN); + mpfr_set_str (d, "10384593717069655257060992206847132", 10, MPFR_RNDN); + mpfr_div (q, n, d, MPFR_RNDU); - mpfr_set_ui (c, 1, GMP_RNDN); + mpfr_set_ui (c, 1, MPFR_RNDN); if (mpfr_cmp (q, c) != 0) { printf ("Error in test_20070603\nGot "); @@ -837,9 +837,9 @@ test_20070603 (void) mpfr_set_prec (n, 256); mpfr_set_prec (d, 256); mpfr_set_prec (q, 63); - mpfr_set_str (n, "822752278660603021077484591278675252491367930877209729029898240", 10, GMP_RNDN); - mpfr_set_str (d, "822752278660603021077484591278675252491367930877212507873738752", 10, GMP_RNDN); - mpfr_div (q, n, d, GMP_RNDU); + mpfr_set_str (n, "822752278660603021077484591278675252491367930877209729029898240", 10, MPFR_RNDN); + mpfr_set_str (d, "822752278660603021077484591278675252491367930877212507873738752", 10, MPFR_RNDN); + mpfr_div (q, n, d, MPFR_RNDU); if (mpfr_cmp (q, c) != 0) { printf ("Error in test_20070603\nGot "); @@ -872,10 +872,10 @@ test_20070628 (void) } mpfr_inits2 (53, x, y, (mpfr_ptr) 0); - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_set_si_2exp (y, 1, -256, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_set_si_2exp (y, 1, -256, MPFR_RNDN); mpfr_clear_flags (); - inex = mpfr_div (x, x, y, GMP_RNDD); + inex = mpfr_div (x, x, y, MPFR_RNDD); if (MPFR_SIGN (x) >= 0 || ! mpfr_inf_p (x)) { printf ("Error in test_20070628: expected -Inf, got\n"); @@ -915,11 +915,11 @@ main (int argc, char *argv[]) check_convergence (); check_64 (); - check4("4.0","4.503599627370496e15", GMP_RNDZ, 62, + check4("4.0","4.503599627370496e15", MPFR_RNDZ, 62, "0.10000000000000000000000000000000000000000000000000000000000000E-49"); - check4("1.0","2.10263340267725788209e+187", GMP_RNDU, 65, + check4("1.0","2.10263340267725788209e+187", MPFR_RNDU, 65, "0.11010011111001101011111001100111110100000001101001111100111000000E-622"); - check4("2.44394909079968374564e-150", "2.10263340267725788209e+187",GMP_RNDU, + check4("2.44394909079968374564e-150", "2.10263340267725788209e+187",MPFR_RNDU, 65, "0.11010011111001101011111001100111110100000001101001111100111000000E-1119"); diff --git a/tests/tdiv_d.c b/tests/tdiv_d.c index 9829dc274..c913172f2 100644 --- a/tests/tdiv_d.c +++ b/tests/tdiv_d.c @@ -40,7 +40,7 @@ check_nans (void) /* nan / 1.0 is nan */ mpfr_set_nan (x); mpfr_clear_flags (); - inexact = mpfr_div_d (y, x, 1.0, GMP_RNDN); + inexact = mpfr_div_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); MPFR_ASSERTN (mpfr_nan_p (y)); @@ -48,7 +48,7 @@ check_nans (void) /* +inf / 1.0 == +inf */ mpfr_set_inf (x, 1); mpfr_clear_flags (); - inexact = mpfr_div_d (y, x, 1.0, GMP_RNDN); + inexact = mpfr_div_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_inf_p (y)); @@ -57,16 +57,16 @@ check_nans (void) /* -inf / 1.0 == -inf */ mpfr_set_inf (x, -1); mpfr_clear_flags (); - inexact = mpfr_div_d (y, x, 1.0, GMP_RNDN); + inexact = mpfr_div_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_inf_p (y)); MPFR_ASSERTN (MPFR_IS_NEG (y)); /* 0.0 / 0.0 is nan */ - mpfr_set_d (x, 0.0, GMP_RNDN); + mpfr_set_d (x, 0.0, MPFR_RNDN); mpfr_clear_flags (); - inexact = mpfr_div_d (y, x, 0.0, GMP_RNDN); + inexact = mpfr_div_d (y, x, 0.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); MPFR_ASSERTN (mpfr_nan_p (y)); @@ -94,24 +94,24 @@ main (void) mpfr_init2 (y, IEEE_DBL_MANT_DIG); mpfr_init2 (z, IEEE_DBL_MANT_DIG); - mpfr_set_str (y, "4096", 10, GMP_RNDN); + mpfr_set_str (y, "4096", 10, MPFR_RNDN); d = 0.125; mpfr_clear_flags (); - inexact = mpfr_div_d (x, y, d, GMP_RNDN); + inexact = mpfr_div_d (x, y, d, MPFR_RNDN); if (inexact != 0) { printf ("Inexact flag error in mpfr_div_d\n"); exit (1); } - mpfr_set_str (z, "32768", 10, GMP_RNDN); + mpfr_set_str (z, "32768", 10, MPFR_RNDN); if (mpfr_cmp (z, x)) { printf ("Error in mpfr_div_d ("); - mpfr_out_str (stdout, 10, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN); printf (" + %.20g)\nexpected ", d); - mpfr_out_str (stdout, 10, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN); printf ("\ngot "); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } diff --git a/tests/tdiv_ui.c b/tests/tdiv_ui.c index c611b5bdb..6b52e7f9b 100644 --- a/tests/tdiv_ui.c +++ b/tests/tdiv_ui.c @@ -40,7 +40,7 @@ check (const char *ds, unsigned long u, mp_rnd_t rnd, const char *es) printf ("mpfr_div_ui failed for x=%s, u=%lu, rnd=%s\n", ds, u, mpfr_print_rnd_mode (rnd)); printf ("expected result is %s, got", es); - mpfr_out_str(stdout, 10, 0, y, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, y, MPFR_RNDN); exit (1); } mpfr_clear (x); @@ -58,15 +58,15 @@ special (void) mpfr_set_prec (x, 32); mpfr_set_prec (y, 32); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_div_ui (y, x, 3, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_div_ui (y, x, 3, MPFR_RNDN); mpfr_set_prec (x, 100); mpfr_set_prec (y, 100); mpfr_urandomb (x, RANDS); - mpfr_div_ui (y, x, 123456, GMP_RNDN); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_div_ui (y, x, 123456789, GMP_RNDN); + mpfr_div_ui (y, x, 123456, MPFR_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_div_ui (y, x, 123456789, MPFR_RNDN); if (mpfr_cmp_ui (y, 0)) { printf ("mpfr_div_ui gives non-zero for 0/ui\n"); @@ -77,15 +77,15 @@ special (void) mpfr_set_prec (x, 110); mpfr_set_prec (y, 60); mpfr_set_str_binary (x, "0.110101110011111110011111001110011001110111000000111110001000111011000011E-44"); - mpfr_div_ui (y, x, 17, GMP_RNDN); + mpfr_div_ui (y, x, 17, MPFR_RNDN); mpfr_set_str_binary (x, "0.11001010100101100011101110000001100001010110101001010011011E-48"); if (mpfr_cmp (x, y)) { printf ("Error in x/17 for x=1/16!\n"); printf ("Expected "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\nGot "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); exit (1); } @@ -93,23 +93,23 @@ special (void) /* corner case */ mpfr_set_prec (x, 2 * mp_bits_per_limb); mpfr_set_prec (y, 2); - mpfr_set_ui (x, 4, GMP_RNDN); + mpfr_set_ui (x, 4, MPFR_RNDN); mpfr_nextabove (x); - mpfr_div_ui (y, x, 2, GMP_RNDN); /* exactly in the middle */ + mpfr_div_ui (y, x, 2, MPFR_RNDN); /* exactly in the middle */ MPFR_ASSERTN(mpfr_cmp_ui (y, 2) == 0); mpfr_set_prec (x, 3 * mp_bits_per_limb); mpfr_set_prec (y, 2); - mpfr_set_ui (x, 2, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); mpfr_nextabove (x); - mpfr_div_ui (y, x, 2, GMP_RNDN); + mpfr_div_ui (y, x, 2, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); mpfr_set_prec (x, 3 * mp_bits_per_limb); mpfr_set_prec (y, 2); - mpfr_set_si (x, -4, GMP_RNDN); + mpfr_set_si (x, -4, MPFR_RNDN); mpfr_nextbelow (x); - mpfr_div_ui (y, x, 2, GMP_RNDD); + mpfr_div_ui (y, x, 2, MPFR_RNDD); MPFR_ASSERTN(mpfr_cmp_si (y, -3) == 0); for (xprec = 53; xprec <= 128; xprec++) @@ -119,7 +119,7 @@ special (void) for (yprec = 53; yprec <= 128; yprec++) { mpfr_set_prec (y, yprec); - mpfr_div_ui (y, x, 1, GMP_RNDN); + mpfr_div_ui (y, x, 1, MPFR_RNDN); if (mpfr_cmp(x,y)) { printf ("division by 1.0 fails for xprec=%u, yprec=%u\n", xprec, yprec); @@ -131,9 +131,9 @@ special (void) } /* Bug reported by Mark Dickinson, 6 Nov 2007 */ - mpfr_set_si (x, 0, GMP_RNDN); - mpfr_set_si (y, -1, GMP_RNDN); - mpfr_div_ui (y, x, 4, GMP_RNDN); + mpfr_set_si (x, 0, MPFR_RNDN); + mpfr_set_si (y, -1, MPFR_RNDN); + mpfr_div_ui (y, x, 4, MPFR_RNDN); MPFR_ASSERTN(MPFR_IS_ZERO(y) && MPFR_IS_POS(y)); mpfr_clear (x); @@ -166,7 +166,7 @@ check_inexact (void) { mpfr_set_prec (y, py); mpfr_set_prec (z, py + mp_bits_per_limb); - for (rnd = 0; rnd < GMP_RND_MAX; rnd++) + for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) { inexact = mpfr_div_ui (y, x, u, (mp_rnd_t) rnd); if (mpfr_mul_ui (z, y, u, (mp_rnd_t) rnd)) @@ -212,17 +212,17 @@ main (int argc, char **argv) check_inexact (); - check("1.0", 3, GMP_RNDN, "3.3333333333333331483e-1"); - check("1.0", 3, GMP_RNDZ, "3.3333333333333331483e-1"); - check("1.0", 3, GMP_RNDU, "3.3333333333333337034e-1"); - check("1.0", 3, GMP_RNDD, "3.3333333333333331483e-1"); - check("1.0", 2116118, GMP_RNDN, "4.7256343927890600483e-7"); - check("1.098612288668109782", 5, GMP_RNDN, "0.21972245773362195087"); + check("1.0", 3, MPFR_RNDN, "3.3333333333333331483e-1"); + check("1.0", 3, MPFR_RNDZ, "3.3333333333333331483e-1"); + check("1.0", 3, MPFR_RNDU, "3.3333333333333337034e-1"); + check("1.0", 3, MPFR_RNDD, "3.3333333333333331483e-1"); + check("1.0", 2116118, MPFR_RNDN, "4.7256343927890600483e-7"); + check("1.098612288668109782", 5, MPFR_RNDN, "0.21972245773362195087"); mpfr_init2 (x, 53); - mpfr_set_ui (x, 3, GMP_RNDD); - mpfr_log (x, x, GMP_RNDD); - mpfr_div_ui (x, x, 5, GMP_RNDD); + mpfr_set_ui (x, 3, MPFR_RNDD); + mpfr_log (x, x, MPFR_RNDD); + mpfr_div_ui (x, x, 5, MPFR_RNDD); if (mpfr_cmp_str1 (x, "0.21972245773362189536")) { printf ("Error in mpfr_div_ui for x=ln(3), u=5\n"); diff --git a/tests/teint.c b/tests/teint.c index 5721f20a9..61ee0c43c 100644 --- a/tests/teint.c +++ b/tests/teint.c @@ -39,7 +39,7 @@ check_specials (void) mpfr_init2 (y, 123L); mpfr_set_nan (x); - mpfr_eint (y, x, GMP_RNDN); + mpfr_eint (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: eint(NaN) != NaN\n"); @@ -47,7 +47,7 @@ check_specials (void) } mpfr_set_inf (x, 1); - mpfr_eint (y, x, GMP_RNDN); + mpfr_eint (y, x, MPFR_RNDN); if (! (mpfr_inf_p (y) && mpfr_sgn (y) > 0)) { printf ("Error: eint(+Inf) != +Inf\n"); @@ -55,7 +55,7 @@ check_specials (void) } mpfr_set_inf (x, -1); - mpfr_eint (y, x, GMP_RNDN); + mpfr_eint (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: eint(-Inf) != NaN\n"); @@ -63,15 +63,15 @@ check_specials (void) } /* eint(+/-0) = -Inf */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_eint (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_eint (y, x, MPFR_RNDN); if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0)) { printf ("Error: eint(+0) != -Inf\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_eint (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_eint (y, x, MPFR_RNDN); if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0)) { printf ("Error: eint(-0) != -Inf\n"); @@ -79,8 +79,8 @@ check_specials (void) } /* eint(x) = NaN for x < 0 */ - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_eint (y, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_eint (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: eint(-1) != NaN\n"); @@ -91,10 +91,10 @@ check_specials (void) mpfr_set_prec (y, 17); mpfr_set_str_binary (x, "1.0111110100100110e-2"); mpfr_set_str_binary (y, "-1.0010101001110100e-10"); - mpfr_eint (x, x, GMP_RNDZ); + mpfr_eint (x, x, MPFR_RNDZ); if (mpfr_cmp (x, y)) { - printf ("Error for x=1.0111110100100110e-2, GMP_RNDZ\n"); + printf ("Error for x=1.0111110100100110e-2, MPFR_RNDZ\n"); printf ("expected "); mpfr_dump (y); printf ("got "); mpfr_dump (x); exit (1); @@ -103,11 +103,11 @@ check_specials (void) mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); mpfr_set_str_binary (x, "0.10E4"); - mpfr_eint (x, x, GMP_RNDN); - mpfr_set_str (y, "440.37989953483827", 10, GMP_RNDN); + mpfr_eint (x, x, MPFR_RNDN); + mpfr_set_str (y, "440.37989953483827", 10, MPFR_RNDN); if (mpfr_cmp (x, y) != 0) { - printf ("Error for x=0.10E4, GMP_RNDZ\n"); + printf ("Error for x=0.10E4, MPFR_RNDZ\n"); printf ("expected "); mpfr_dump (y); printf ("got "); mpfr_dump (x); exit (1); @@ -116,11 +116,11 @@ check_specials (void) mpfr_set_prec (x, 63); mpfr_set_prec (y, 63); mpfr_set_str_binary (x, "1.01111101011100111000011010001000101101011000011001111101011010e-2"); - mpfr_eint (x, x, GMP_RNDZ); + mpfr_eint (x, x, MPFR_RNDZ); mpfr_set_str_binary (y, "1.11010110001101000001010010000100001111001000100100000001011100e-17"); if (mpfr_cmp (x, y) != 0) { - printf ("Error (1) for GMP_RNDZ\n"); + printf ("Error (1) for MPFR_RNDZ\n"); printf ("expected "); mpfr_dump (y); printf ("got "); mpfr_dump (x); exit (1); @@ -130,51 +130,51 @@ check_specials (void) mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); mpfr_set_str_binary (x, "1E6"); - mpfr_eint (x, x, GMP_RNDN); + mpfr_eint (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "10100011110001101001110000110010111000100111010001E37"); if (mpfr_cmp (x, y) != 0) { - printf ("Error for x=2^6, GMP_RNDN\n"); + printf ("Error for x=2^6, MPFR_RNDN\n"); printf ("expected "); mpfr_dump (y); printf ("got "); mpfr_dump (x); exit (1); } mpfr_set_str_binary (x, "1E7"); - mpfr_eint (x, x, GMP_RNDN); + mpfr_eint (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "11001100100011110000101001011010110111111011110011E128"); if (mpfr_cmp (x, y) != 0) { - printf ("Error for x=2^7, GMP_RNDN\n"); + printf ("Error for x=2^7, MPFR_RNDN\n"); printf ("expected "); mpfr_dump (y); printf ("got "); mpfr_dump (x); exit (1); } mpfr_set_str_binary (x, "1E8"); - mpfr_eint (x, x, GMP_RNDN); + mpfr_eint (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "1010000110000101111111011011000101001000101011101001E310"); if (mpfr_cmp (x, y) != 0) { - printf ("Error for x=2^8, GMP_RNDN\n"); + printf ("Error for x=2^8, MPFR_RNDN\n"); printf ("expected "); mpfr_dump (y); printf ("got "); mpfr_dump (x); exit (1); } mpfr_set_str_binary (x, "1E9"); - mpfr_eint (x, x, GMP_RNDN); + mpfr_eint (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "11001010101000001010101101110000010110011101110010101E677"); if (mpfr_cmp (x, y) != 0) { - printf ("Error for x=2^9, GMP_RNDN\n"); + printf ("Error for x=2^9, MPFR_RNDN\n"); printf ("expected "); mpfr_dump (y); printf ("got "); mpfr_dump (x); exit (1); } mpfr_set_str_binary (x, "1E10"); - mpfr_eint (x, x, GMP_RNDN); + mpfr_eint (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "10011111111010010110110101101000101100101010101101101E1415"); if (mpfr_cmp (x, y) != 0) { - printf ("Error for x=2^10, GMP_RNDN\n"); + printf ("Error for x=2^10, MPFR_RNDN\n"); printf ("expected "); mpfr_dump (y); printf ("got "); mpfr_dump (x); exit (1); @@ -195,12 +195,12 @@ main (int argc, char *argv[]) mp_prec_t p; p = (argc < 3) ? 53 : atoi (argv[2]); mpfr_init2 (x, p); - mpfr_set_str (x, argv[1], 10, GMP_RNDN); + mpfr_set_str (x, argv[1], 10, MPFR_RNDN); printf ("eint("); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf (")="); - mpfr_eint (x, x, GMP_RNDN); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_eint (x, x, MPFR_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf ("\n"); mpfr_clear (x); } diff --git a/tests/teq.c b/tests/teq.c index 1d53de71d..06aa84d4e 100644 --- a/tests/teq.c +++ b/tests/teq.c @@ -38,7 +38,7 @@ teq (mpfr_t x) for (k = 2; k < MPFR_PREC(x); k++) { - mpfr_set (y, x, GMP_RNDN); + mpfr_set (y, x, MPFR_RNDN); MPFR_MANT(y) [mx] ^= (mp_limb_t) 1 << px; @@ -78,7 +78,7 @@ special (void) mpfr_set_str (x, "1", 10, (mp_rnd_t) 0); mpfr_set_str (y, "1e-10000", 10, (mp_rnd_t) 0); - mpfr_add (z, x, y, GMP_RNDU); + mpfr_add (z, x, y, MPFR_RNDU); for (i = 1; i <= 52; i++) if (mpfr_eq (x, z, i) == 0) @@ -102,7 +102,7 @@ special (void) mpfr_set_inf (y, 1); MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0); - mpfr_set_ui (y, 0, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0); mpfr_set_inf (x, 1); @@ -118,32 +118,32 @@ special (void) MPFR_ASSERTN(mpfr_eq (x, y, 1)); mpfr_set_inf (x, 1); - mpfr_set_ui (y, 0, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_set_ui (y, 0, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0); MPFR_ASSERTN(mpfr_eq (y, x, 1) == 0); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_set_ui (y, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); MPFR_ASSERTN(mpfr_eq (x, y, 1)); - mpfr_neg (y, y, GMP_RNDN); + mpfr_neg (y, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_eq (x, y, 1)); - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_eq (x, y, 1)); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_neg (y, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_neg (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0); mpfr_set_prec (x, 2 * mp_bits_per_limb); mpfr_set_prec (y, mp_bits_per_limb); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_set_ui (y, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb - 1)); MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb)); MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb + 1)); @@ -165,14 +165,14 @@ special (void) MPFR_ASSERTN(mpfr_eq (y, x, 2 * mp_bits_per_limb) == 0); MPFR_ASSERTN(mpfr_eq (y, x, 2 * mp_bits_per_limb + 1) == 0); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_set_ui (y, 2, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_set_ui (y, 2, MPFR_RNDN); MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0); mpfr_set_prec (x, 2 * mp_bits_per_limb); mpfr_set_prec (y, 2 * mp_bits_per_limb); - mpfr_set_ui (x, 2, GMP_RNDN); - mpfr_set_ui (y, 3, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); + mpfr_set_ui (y, 3, MPFR_RNDN); MPFR_ASSERTN(mpfr_eq (x, y, 1)); MPFR_ASSERTN(mpfr_eq (x, y, 2) == 0); MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb) == 0); diff --git a/tests/terf.c b/tests/terf.c index 9372b504a..2c8726679 100644 --- a/tests/terf.c +++ b/tests/terf.c @@ -47,7 +47,7 @@ special_erf (void) /* erf(NaN) = NaN */ mpfr_set_nan (x); - mpfr_erf (y, x, GMP_RNDN); + mpfr_erf (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("mpfr_erf failed for x=NaN\n"); @@ -56,19 +56,19 @@ special_erf (void) /* erf(+Inf) = 1 */ mpfr_set_inf (x, 1); - mpfr_erf (y, x, GMP_RNDN); + mpfr_erf (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { printf ("mpfr_erf failed for x=+Inf\n"); printf ("expected 1.0, got "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); exit (1); } /* erf(-Inf) = -1 */ mpfr_set_inf (x, -1); - mpfr_erf (y, x, GMP_RNDN); + mpfr_erf (y, x, MPFR_RNDN); if (mpfr_cmp_si (y, -1)) { printf ("mpfr_erf failed for x=-Inf\n"); @@ -76,8 +76,8 @@ special_erf (void) } /* erf(+0) = +0 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_erf (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_erf (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) { printf ("mpfr_erf failed for x=+0\n"); @@ -85,79 +85,79 @@ special_erf (void) } /* erf(-0) = -0 */ - mpfr_neg (x, x, GMP_RNDN); - mpfr_erf (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_erf (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0) { printf ("mpfr_erf failed for x=-0\n"); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_erf (x, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_erf (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "0.11010111101110110011110100111010000010000100010001011"); if (mpfr_cmp (x, y)) { - printf ("mpfr_erf failed for x=1.0, rnd=GMP_RNDN\n"); + printf ("mpfr_erf failed for x=1.0, rnd=MPFR_RNDN\n"); printf ("expected "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); printf ("got "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } - mpfr_set_str (x, "6.6", 10, GMP_RNDN); - mpfr_erf (x, x, GMP_RNDN); + mpfr_set_str (x, "6.6", 10, MPFR_RNDN); + mpfr_erf (x, x, MPFR_RNDN); if (mpfr_cmp_ui (x, 1)) { - printf ("mpfr_erf failed for x=6.6, rnd=GMP_RNDN\n"); + printf ("mpfr_erf failed for x=6.6, rnd=MPFR_RNDN\n"); printf ("expected 1\n"); printf ("got "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } - mpfr_set_str (x, "-6.6", 10, GMP_RNDN); - mpfr_erf (x, x, GMP_RNDN); + mpfr_set_str (x, "-6.6", 10, MPFR_RNDN); + mpfr_erf (x, x, MPFR_RNDN); if (mpfr_cmp_si (x, -1)) { - printf ("mpfr_erf failed for x=-6.6, rnd=GMP_RNDN\n"); + printf ("mpfr_erf failed for x=-6.6, rnd=MPFR_RNDN\n"); printf ("expected -1\n"); printf ("got "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } - mpfr_set_str (x, "6.6", 10, GMP_RNDN); - mpfr_erf (x, x, GMP_RNDZ); + mpfr_set_str (x, "6.6", 10, MPFR_RNDN); + mpfr_erf (x, x, MPFR_RNDZ); mpfr_set_str_binary (y, "0.11111111111111111111111111111111111111111111111111111"); if (mpfr_cmp (x, y)) { - printf ("mpfr_erf failed for x=6.6, rnd=GMP_RNDZ\n"); + printf ("mpfr_erf failed for x=6.6, rnd=MPFR_RNDZ\n"); printf ("expected "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); printf ("got "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } - mpfr_set_str (x, "4.5", 10, GMP_RNDN); - mpfr_erf (x, x, GMP_RNDN); + mpfr_set_str (x, "4.5", 10, MPFR_RNDN); + mpfr_erf (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "0.1111111111111111111111111111111100100111110100011"); if (mpfr_cmp (x, y)) { - printf ("mpfr_erf failed for x=4.5, rnd=GMP_RNDN\n"); + printf ("mpfr_erf failed for x=4.5, rnd=MPFR_RNDN\n"); printf ("expected "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); printf ("got "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } @@ -165,54 +165,54 @@ special_erf (void) mpfr_set_prec (x, 120); mpfr_set_prec (y, 120); mpfr_set_str_binary (x, "0.110100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011E3"); - mpfr_erf (x, x, GMP_RNDN); + mpfr_erf (x, x, MPFR_RNDN); mpfr_set_str_binary (y, "0.11111111111111111111111111111111111111111111111111111111111111111100111111000100111011111011010000110101111100011001101"); if (mpfr_cmp (x, y)) { - printf ("mpfr_erf failed for x=6.6, rnd=GMP_RNDN\n"); + printf ("mpfr_erf failed for x=6.6, rnd=MPFR_RNDN\n"); printf ("expected "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); printf ("got "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } mpfr_set_prec (x, 8); mpfr_set_prec (y, 8); - mpfr_set_ui (x, 50, GMP_RNDN); - inex = mpfr_erf (y, x, GMP_RNDN); + mpfr_set_ui (x, 50, MPFR_RNDN); + inex = mpfr_erf (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { - printf ("mpfr_erf failed for x=50, rnd=GMP_RNDN\n"); + printf ("mpfr_erf failed for x=50, rnd=MPFR_RNDN\n"); printf ("expected 1, got "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); exit (1); } if (inex <= 0) { - printf ("mpfr_erf failed for x=50, rnd=GMP_RNDN: wrong ternary value\n" + printf ("mpfr_erf failed for x=50, rnd=MPFR_RNDN: wrong ternary value\n" "expected positive, got %d\n", inex); exit (1); } - inex = mpfr_erf (x, x, GMP_RNDZ); + inex = mpfr_erf (x, x, MPFR_RNDZ); mpfr_nextbelow (y); if (mpfr_cmp (x, y)) { - printf ("mpfr_erf failed for x=50, rnd=GMP_RNDZ\n"); + printf ("mpfr_erf failed for x=50, rnd=MPFR_RNDZ\n"); printf ("expected "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); printf ("got "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } if (inex >= 0) { - printf ("mpfr_erf failed for x=50, rnd=GMP_RNDN: wrong ternary value\n" + printf ("mpfr_erf failed for x=50, rnd=MPFR_RNDN: wrong ternary value\n" "expected negative, got %d\n", inex); exit (1); } @@ -222,7 +222,7 @@ special_erf (void) mpfr_set_str_binary (x, "0.1010100100111011001111100101E-1"); mpfr_set_str_binary (y, "0.10111000001110011010110001101011E-1"); - mpfr_erf (x, x, GMP_RNDN); + mpfr_erf (x, x, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("Error: erf for prec=32 (1)\n"); @@ -231,7 +231,7 @@ special_erf (void) mpfr_set_str_binary (x, "-0.10110011011010111110010001100001"); mpfr_set_str_binary (y, "-0.1010110110101011100010111000111"); - mpfr_erf (x, x, GMP_RNDN); + mpfr_erf (x, x, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("Error: erf for prec=32 (2)\n"); @@ -241,21 +241,21 @@ special_erf (void) mpfr_set_str_binary (x, "100.10001110011110100000110000111"); mpfr_set_str_binary (y, "0.11111111111111111111111111111111"); - mpfr_erf (x, x, GMP_RNDN); + mpfr_erf (x, x, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("Error: erf for prec=32 (3)\n"); exit (1); } mpfr_set_str_binary (x, "100.10001110011110100000110000111"); - mpfr_erf (x, x, GMP_RNDZ); + mpfr_erf (x, x, MPFR_RNDZ); if (mpfr_cmp (x, y)) { printf ("Error: erf for prec=32 (4)\n"); exit (1); } mpfr_set_str_binary (x, "100.10001110011110100000110000111"); - mpfr_erf (x, x, GMP_RNDU); + mpfr_erf (x, x, MPFR_RNDU); if (mpfr_cmp_ui (x, 1)) { printf ("Error: erf for prec=32 (5)\n"); @@ -263,7 +263,7 @@ special_erf (void) } mpfr_set_str_binary (x, "100.10001110011110100000110001000"); - mpfr_erf (x, x, GMP_RNDN); + mpfr_erf (x, x, MPFR_RNDN); if (mpfr_cmp_ui (x, 1)) { printf ("Error: erf for prec=32 (6)\n"); @@ -271,44 +271,44 @@ special_erf (void) } mpfr_set_str_binary (x, "100.10001110011110100000110001000"); mpfr_set_str_binary (y, "0.11111111111111111111111111111111"); - mpfr_erf (x, x, GMP_RNDZ); + mpfr_erf (x, x, MPFR_RNDZ); if (mpfr_cmp (x, y)) { printf ("Error: erf for prec=32 (7)\n"); exit (1); } mpfr_set_str_binary (x, "100.10001110011110100000110001000"); - mpfr_erf (x, x, GMP_RNDU); + mpfr_erf (x, x, MPFR_RNDU); if (mpfr_cmp_ui (x, 1)) { printf ("Error: erf for prec=32 (8)\n"); exit (1); } - mpfr_set_ui (x, 5, GMP_RNDN); - mpfr_erf (x, x, GMP_RNDN); + mpfr_set_ui (x, 5, MPFR_RNDN); + mpfr_erf (x, x, MPFR_RNDN); if (mpfr_cmp_ui (x, 1)) { printf ("Error: erf for prec=32 (9)\n"); exit (1); } - mpfr_set_ui (x, 5, GMP_RNDN); - mpfr_erf (x, x, GMP_RNDU); + mpfr_set_ui (x, 5, MPFR_RNDN); + mpfr_erf (x, x, MPFR_RNDU); if (mpfr_cmp_ui (x, 1)) { printf ("Error: erf for prec=32 (10)\n"); exit (1); } - mpfr_set_ui (x, 5, GMP_RNDN); - mpfr_erf (x, x, GMP_RNDZ); + mpfr_set_ui (x, 5, MPFR_RNDN); + mpfr_erf (x, x, MPFR_RNDZ); mpfr_set_str_binary (y, "0.11111111111111111111111111111111"); if (mpfr_cmp (x, y)) { printf ("Error: erf for prec=32 (11)\n"); exit (1); } - mpfr_set_ui (x, 5, GMP_RNDN); - mpfr_erf (x, x, GMP_RNDD); + mpfr_set_ui (x, 5, MPFR_RNDN); + mpfr_erf (x, x, MPFR_RNDD); mpfr_set_str_binary (y, "0.11111111111111111111111111111111"); if (mpfr_cmp (x, y)) { @@ -319,7 +319,7 @@ special_erf (void) mpfr_set_prec (x, 43); mpfr_set_prec (y, 64); mpfr_set_str_binary (x, "-0.1101110110101111100101011101110101101001001e3"); - mpfr_erf (y, x, GMP_RNDU); + mpfr_erf (y, x, MPFR_RNDU); mpfr_set_prec (x, 64); mpfr_set_str_binary (x, "-0.1111111111111111111111111111111111111111111111111111111111111111"); if (mpfr_cmp (x, y)) @@ -332,7 +332,7 @@ special_erf (void) mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); mpfr_set_str_binary (x, "1.0000000000000000000000000000000000000110000000101101"); - mpfr_erf (y, x, GMP_RNDN); + mpfr_erf (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.110101111011101100111101001110100000101011000011001"); if (mpfr_cmp (x, y)) { @@ -341,7 +341,7 @@ special_erf (void) } mpfr_set_str_binary (x, "1.0000000000000000000000000000011000111010101101011010"); - mpfr_erf (y, x, GMP_RNDU); + mpfr_erf (y, x, MPFR_RNDU); mpfr_set_str_binary (x, "0.11010111101110110011110100111100100111100011111000110"); if (mpfr_cmp (x, y)) { @@ -349,7 +349,7 @@ special_erf (void) exit (1); } mpfr_set_str_binary (x, "1.0000000000000000000000000000011000111010101101011010"); - mpfr_erf (y, x, GMP_RNDD); + mpfr_erf (y, x, MPFR_RNDD); mpfr_set_str_binary (x, "0.11010111101110110011110100111100100111100011111000101"); if (mpfr_cmp (x, y)) { @@ -370,7 +370,7 @@ special_erfc (void) /* erfc (NaN) = NaN */ mpfr_set_nan (x); - mpfr_erfc (y, x, GMP_RNDN); + mpfr_erfc (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("mpfr_erfc failed for x=NaN\n"); @@ -378,7 +378,7 @@ special_erfc (void) } /* erfc(+Inf) = 0+ */ mpfr_set_inf (x, 1); - mpfr_erfc (y, x, GMP_RNDN); + mpfr_erfc (y, x, MPFR_RNDN); if (!MPFR_IS_ZERO (y) || !MPFR_IS_POS (y)) { printf ("mpfr_erf failed for x=+Inf\n"); @@ -388,7 +388,7 @@ special_erfc (void) } /* erfc(-Inf) = 2 */ mpfr_set_inf (x, -1); - mpfr_erfc (y, x, GMP_RNDN); + mpfr_erfc (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 2)) { printf ("mpfr_erf failed for x=-Inf\n"); @@ -397,8 +397,8 @@ special_erfc (void) exit (1); } /* erf(+0) = 1 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_erfc (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_erfc (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { printf ("mpfr_erf failed for x=+0\n"); @@ -418,8 +418,8 @@ large_arg (void) mpfr_init2 (x, 88); mpfr_init2 (y, 98); - mpfr_set_si_2exp (x, -1, 173, GMP_RNDN); - mpfr_erfc (y, x, GMP_RNDN); + mpfr_set_si_2exp (x, -1, 173, MPFR_RNDN); + mpfr_erfc (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 2) != 0) { printf ("mpfr_erfc failed for large x (1)\n"); @@ -430,7 +430,7 @@ large_arg (void) mpfr_set_prec (x, 33); mpfr_set_prec (y, 43); mpfr_set_str_binary (x, "1.11000101010111011000111100101001e6"); - mpfr_erfc (y, x, GMP_RNDD); + mpfr_erfc (y, x, MPFR_RNDD); mpfr_set_prec (x, 43); mpfr_set_str_binary (x, "100010011100101100001101100101011101101E-18579"); if (mpfr_cmp (x, y) != 0) @@ -440,8 +440,8 @@ large_arg (void) } mpfr_set_prec (y, 43); - mpfr_set_si_2exp (x, 1, 11, GMP_RNDN); - mpfr_erfc (y, x, GMP_RNDN); + mpfr_set_si_2exp (x, 1, 11, MPFR_RNDN); + mpfr_erfc (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.1100000100100010101111001111010010001000110E-6051113"); if (mpfr_cmp (x, y) != 0) { @@ -452,7 +452,7 @@ large_arg (void) mpfr_set_prec (x, 75); mpfr_set_prec (y, 85); mpfr_set_str_binary (x, "0.111110111111010011101011001100001010011110101010011111010010111101010001011E15"); - mpfr_erfc (y, x, GMP_RNDN); + mpfr_erfc (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) { printf ("mpfr_erfc failed for large x (3b)\n"); @@ -462,7 +462,7 @@ large_arg (void) mpfr_set_prec (x, 2); mpfr_set_prec (y, 21); mpfr_set_str_binary (x, "-1.0e3"); - mpfr_erfc (y, x, GMP_RNDZ); + mpfr_erfc (y, x, MPFR_RNDZ); mpfr_set_prec (x, 21); mpfr_set_str_binary (x, "1.11111111111111111111"); if (mpfr_cmp (x, y) != 0) @@ -474,7 +474,7 @@ large_arg (void) mpfr_set_prec (x, 2); mpfr_set_prec (y, 31); mpfr_set_str_binary (x, "-1.0e3"); - mpfr_erfc (y, x, GMP_RNDZ); + mpfr_erfc (y, x, MPFR_RNDZ); mpfr_set_prec (x, 31); mpfr_set_str_binary (x, "1.111111111111111111111111111111"); if (mpfr_cmp (x, y) != 0) @@ -488,9 +488,9 @@ large_arg (void) /* Reported by Christopher Creutzig on 2007-07-10. */ mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); - mpfr_set_si_2exp (x, 54563, -1, GMP_RNDN); - mpfr_erfc (y, x, GMP_RNDZ); - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_si_2exp (x, 54563, -1, MPFR_RNDN); + mpfr_erfc (y, x, MPFR_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDN); if (! mpfr_equal_p (y, x)) { printf ("mpfr_erfc failed for x=27281.5, prec=53 (6)\n"); @@ -500,9 +500,9 @@ large_arg (void) } /* same test with rounding away from zero */ - mpfr_set_si_2exp (x, 54563, -1, GMP_RNDN); - mpfr_erfc (y, x, GMP_RNDU); - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_si_2exp (x, 54563, -1, MPFR_RNDN); + mpfr_erfc (y, x, MPFR_RNDU); + mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_nextabove (x); if (! mpfr_equal_p (y, x)) { @@ -524,9 +524,9 @@ test_erfc (void) mpfr_inits2 (40, x, y, z, (mpfr_ptr) 0); - mpfr_set_si_2exp (x, -1, -10, GMP_RNDN); + mpfr_set_si_2exp (x, -1, -10, MPFR_RNDN); mpfr_set_str_binary (z, "0.1000000000100100000110111010110111100000E1"); - mpfr_erfc (y, x, GMP_RNDN); + mpfr_erfc (y, x, MPFR_RNDN); if (mpfr_cmp (y, z) != 0) { printf ("mpfr_erfc failed for x = "); @@ -540,8 +540,8 @@ test_erfc (void) /* slowness detected by Kevin Rauch on 26 Oct 2007 */ mpfr_set_prec (x, 128); - mpfr_set_si (x, -256, GMP_RNDN); - inex = mpfr_erfc (x, x, GMP_RNDN); + mpfr_set_si (x, -256, MPFR_RNDN); + inex = mpfr_erfc (x, x, MPFR_RNDN); MPFR_ASSERTN(inex > 0 && mpfr_cmp_ui (x, 2) == 0); mpfr_clears (x, y, z, (mpfr_ptr) 0); diff --git a/tests/tests.c b/tests/tests.c index 7bc308431..ae2903524 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -520,7 +520,7 @@ tests_default_random (mpfr_ptr x, int pos, mp_exp_t emin, mp_exp_t emax) } } if (randlimb () % 512 < pos) - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); } /* The test_one argument is a boolean. If it is true and rnd is a rounding @@ -530,7 +530,7 @@ tests_default_random (mpfr_ptr x, int pos, mp_exp_t emin, mp_exp_t emax) zero, then the function is tested twice, first with the provided rounding mode and second with the rounding mode towards the corresponding infinity (determined by the sign of the result). If it is false, then the function - is tested in the 5 rounding modes, and rnd must initially be GMP_RNDZ; thus + is tested in the 5 rounding modes, and rnd must initially be MPFR_RNDZ; thus rndnext will be initialized in the first iteration. As examples of use, see the calls to test5rm from the data_check and bad_cases functions. */ @@ -539,60 +539,60 @@ test5rm (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); - mp_rnd_t rndnext = GMP_RND_MAX; /* means uninitialized */ + mp_rnd_t rndnext = MPFR_RND_MAX; /* means uninitialized */ - MPFR_ASSERTN (test_one || rnd == GMP_RNDZ); + MPFR_ASSERTN (test_one || rnd == MPFR_RNDZ); mpfr_set_prec (z, yprec); while (1) { - MPFR_ASSERTN (rnd != GMP_RND_MAX); + MPFR_ASSERTN (rnd != MPFR_RND_MAX); fct (z, x, rnd); if (! mpfr_equal_p (y, z)) { printf ("Error for %s with xprec=%lu, yprec=%lu, rnd=%s\nx = ", name, (unsigned long) MPFR_PREC (x), (unsigned long) yprec, mpfr_print_rnd_mode (rnd)); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); printf ("\nexpected "); - mpfr_out_str (stdout, 16, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN); printf ("\ngot "); - mpfr_out_str (stdout, 16, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN); printf ("\n"); exit (1); } - if (rnd == GMP_RNDN) + if (rnd == MPFR_RNDN) break; if (test_one) { - if (rnd == GMP_RNDU || rnd == GMP_RNDD) + if (rnd == MPFR_RNDU || rnd == MPFR_RNDD) break; if (MPFR_IS_NEG (y)) - rnd = (rnd == GMP_RNDA) ? GMP_RNDD : GMP_RNDU; + rnd = (rnd == MPFR_RNDA) ? MPFR_RNDD : MPFR_RNDU; else - rnd = (rnd == GMP_RNDA) ? GMP_RNDU : GMP_RNDD; + rnd = (rnd == MPFR_RNDA) ? MPFR_RNDU : MPFR_RNDD; } - else if (rnd == GMP_RNDZ) + else if (rnd == MPFR_RNDZ) { - rnd = MPFR_IS_NEG (y) ? GMP_RNDU : GMP_RNDD; - rndnext = GMP_RNDA; + rnd = MPFR_IS_NEG (y) ? MPFR_RNDU : MPFR_RNDD; + rndnext = MPFR_RNDA; } else { rnd = rndnext; - if (rnd == GMP_RNDA) + if (rnd == MPFR_RNDA) { mpfr_nexttoinf (y); - rndnext = (MPFR_IS_NEG (y)) ? GMP_RNDD : GMP_RNDU; + rndnext = (MPFR_IS_NEG (y)) ? MPFR_RNDD : MPFR_RNDU; } - else if (rndnext != GMP_RNDN) - rndnext = GMP_RNDN; + else if (rndnext != MPFR_RNDN) + rndnext = MPFR_RNDN; else { if (yprec == MPFR_PREC_MIN) break; - mpfr_prec_round (y, --yprec, GMP_RNDZ); + mpfr_prec_round (y, --yprec, MPFR_RNDZ); mpfr_set_prec (z, yprec); } } @@ -703,16 +703,16 @@ data_check (char *f, int (*foo) (FLIST), char *name) switch (r) { case 'n': - rnd = GMP_RNDN; + rnd = MPFR_RNDN; break; case 'z': case 'Z': - rnd = GMP_RNDZ; + rnd = MPFR_RNDZ; break; case 'u': - rnd = GMP_RNDU; + rnd = MPFR_RNDU; break; case 'd': - rnd = GMP_RNDD; + rnd = MPFR_RNDD; break; default: printf ("Error: unexpected rounding mode" @@ -721,12 +721,12 @@ data_check (char *f, int (*foo) (FLIST), char *name) } mpfr_set_prec (x, xprec); mpfr_set_prec (y, yprec); - if (mpfr_inp_str (x, fp, 0, GMP_RNDN) == 0) + if (mpfr_inp_str (x, fp, 0, MPFR_RNDN) == 0) { printf ("Error: corrupted argument in file '%s'\n", f); exit (1); } - if (mpfr_inp_str (y, fp, 0, GMP_RNDN) == 0) + if (mpfr_inp_str (y, fp, 0, MPFR_RNDN) == 0) { printf ("Error: corrupted result in file '%s'\n", f); exit (1); @@ -792,13 +792,13 @@ bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name, if (dbg) { printf ("bad_cases: yprec =%4ld, y = ", (long) py); - mpfr_out_str (stdout, 16, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN); printf ("\n"); } px = py + psup; mpfr_set_prec (x, px); mpfr_clear_flags (); - inv (x, y, GMP_RNDN); + inv (x, y, MPFR_RNDN); if (mpfr_nanflag_p () || mpfr_overflow_p () || mpfr_underflow_p ()) { if (dbg) @@ -808,7 +808,7 @@ bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name, if (dbg > 1) { printf ("bad_cases: x = "); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); printf ("\n"); } pz = px; @@ -816,7 +816,7 @@ bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name, { pz += 32; mpfr_set_prec (z, pz); - if (fct (z, x, GMP_RNDN) == 0) + if (fct (z, x, MPFR_RNDN) == 0) { if (dbg) printf ("bad_cases: exact case\n"); @@ -827,16 +827,16 @@ bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name, if (dbg > 1) { printf ("bad_cases: %s(x) ~= ", name); - mpfr_out_str (stdout, 16, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN); } else { - printf ("bad_cases: [GMP_RNDZ] ~= "); - mpfr_out_str (stdout, 16, 40, z, GMP_RNDZ); + printf ("bad_cases: [MPFR_RNDZ] ~= "); + mpfr_out_str (stdout, 16, 40, z, MPFR_RNDZ); } printf ("\n"); } - inex = mpfr_prec_round (z, py, GMP_RNDN); + inex = mpfr_prec_round (z, py, MPFR_RNDN); if (mpfr_nanflag_p () || mpfr_overflow_p () || mpfr_underflow_p () || ! mpfr_equal_p (z, y)) { @@ -849,11 +849,11 @@ bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name, /* We really have a bad case. */ do py--; - while (py >= MPFR_PREC_MIN && mpfr_prec_round (z, py, GMP_RNDZ) == 0); + while (py >= MPFR_PREC_MIN && mpfr_prec_round (z, py, MPFR_RNDZ) == 0); py++; /* py is now the smallest output precision such that we have a bad case in the directed rounding modes. */ - if (mpfr_prec_round (y, py, GMP_RNDZ) != 0) + if (mpfr_prec_round (y, py, MPFR_RNDZ) != 0) { printf ("Internal error for i = %d\n", i); exit (1); @@ -868,11 +868,11 @@ bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name, if (dbg) { printf ("bad_cases: yprec =%4ld, y = ", (long) py); - mpfr_out_str (stdout, 16, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN); printf ("\n"); } /* Note: y is now the expected result rounded towards zero. */ - test5rm (fct, x, y, z, GMP_RNDZ, 0, name); + test5rm (fct, x, y, z, MPFR_RNDZ, 0, name); next_i: /* In case the exponent range has been changed by tests_default_random()... */ diff --git a/tests/texceptions.c b/tests/texceptions.c index a7b9bbb89..561bd78e7 100644 --- a/tests/texceptions.c +++ b/tests/texceptions.c @@ -34,9 +34,9 @@ check_powerof2 (void) mpfr_t x; mpfr_init (x); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); MPFR_ASSERTN (mpfr_powerof2_raw (x)); - mpfr_set_ui (x, 3, GMP_RNDN); + mpfr_set_ui (x, 3, MPFR_RNDN); MPFR_ASSERTN (!mpfr_powerof2_raw (x)); mpfr_clear (x); } @@ -47,7 +47,7 @@ check_default_rnd (void) { int r; mp_rnd_t t; - for(r = 0 ; r < GMP_RND_MAX ; r++) + for(r = 0 ; r < MPFR_RND_MAX ; r++) { mpfr_set_default_rounding_mode ((mp_rnd_t) r); t = (mpfr_get_default_rounding_mode) (); @@ -57,11 +57,11 @@ check_default_rnd (void) ERROR("ERROR in setting / getting default rounding mode (1)"); } } - mpfr_set_default_rounding_mode ((mp_rnd_t) GMP_RND_MAX); - if (mpfr_get_default_rounding_mode() != GMP_RNDA) + mpfr_set_default_rounding_mode ((mp_rnd_t) MPFR_RND_MAX); + if (mpfr_get_default_rounding_mode() != MPFR_RNDA) ERROR("ERROR in setting / getting default rounding mode (2)"); mpfr_set_default_rounding_mode((mp_rnd_t) -1); - if (mpfr_get_default_rounding_mode() != GMP_RNDA) + if (mpfr_get_default_rounding_mode() != MPFR_RNDA) ERROR("ERROR in setting / getting default rounding mode (3)"); } @@ -152,34 +152,34 @@ check_flags (void) (mpfr_clear_flags)(); mpfr_set_double_range (); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); (mpfr_clear_overflow)(); - mpfr_mul_2exp (x, x, 1024, GMP_RNDN); + mpfr_mul_2exp (x, x, 1024, MPFR_RNDN); if (!(mpfr_overflow_p)()) ERROR("ERROR: No overflow detected!\n"); (mpfr_clear_underflow)(); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_div_2exp (x, x, 1025, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_div_2exp (x, x, 1025, MPFR_RNDN); if (!(mpfr_underflow_p)()) ERROR("ERROR: No underflow detected!\n"); (mpfr_clear_nanflag)(); MPFR_SET_NAN(x); - mpfr_add (x, x, x, GMP_RNDN); + mpfr_add (x, x, x, MPFR_RNDN); if (!(mpfr_nanflag_p)()) ERROR("ERROR: No NaN flag!\n"); (mpfr_clear_inexflag)(); - mpfr_set_ui(x, 2, GMP_RNDN); - mpfr_cos(x, x, GMP_RNDN); + mpfr_set_ui(x, 2, MPFR_RNDN); + mpfr_cos(x, x, MPFR_RNDN); if (!(mpfr_inexflag_p)()) ERROR("ERROR: No inexact flag!\n"); (mpfr_clear_erangeflag) (); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_mul_2exp (x, x, 1024, GMP_RNDN); - mpfr_get_ui (x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_mul_2exp (x, x, 1024, MPFR_RNDN); + mpfr_get_ui (x, MPFR_RNDN); if (!(mpfr_erangeflag_p)()) ERROR ("ERROR: No erange flag!\n"); @@ -192,20 +192,20 @@ static void test_set_underflow (void) { mpfr_t x, zero, min; - mpfr_ptr r[GMP_RND_MAX]; - int t[GMP_RND_MAX] = { 1, -1, 1, -1, 1 }; /* RNDN, RNDZ, RNDU, RNDD, RNDA */ + mpfr_ptr r[MPFR_RND_MAX]; + int t[MPFR_RND_MAX] = { 1, -1, 1, -1, 1 }; /* RNDN, RNDZ, RNDU, RNDD, RNDA */ int i; int s; mpfr_inits (x, zero, min, (mpfr_ptr) 0); - mpfr_set_ui (zero, 0, GMP_RNDN); - mpfr_set_ui (min, 0, GMP_RNDN); + mpfr_set_ui (zero, 0, MPFR_RNDN); + mpfr_set_ui (min, 0, MPFR_RNDN); mpfr_nextabove (min); r[0] = r[2] = r[4] = min; /* RNDN, RNDU, RNDA */ r[1] = r[3] = zero; /* RNDZ, RNDD */ for (s = 1; s > 0; s = -1) { - for (i = 0; i < GMP_RND_MAX ; i++) + for (i = 0; i < MPFR_RND_MAX ; i++) { int j; int inex; @@ -217,15 +217,15 @@ test_set_underflow (void) printf ("Error in test_set_underflow, sign = %d," " rnd_mode = %s\n", s, mpfr_print_rnd_mode ((mp_rnd_t) i)); printf ("Got\n"); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf (", inex = %d\ninstead of\n", inex); - mpfr_out_str (stdout, 2, 0, r[j], GMP_RNDN); + mpfr_out_str (stdout, 2, 0, r[j], MPFR_RNDN); printf (", inex = %d\n", t[j]); exit (1); } } - mpfr_neg (zero, zero, GMP_RNDN); - mpfr_neg (min, min, GMP_RNDN); + mpfr_neg (zero, zero, MPFR_RNDN); + mpfr_neg (min, min, MPFR_RNDN); } mpfr_clears (x, zero, min, (mpfr_ptr) 0); } @@ -234,8 +234,8 @@ static void test_set_overflow (void) { mpfr_t x, inf, max; - mpfr_ptr r[GMP_RND_MAX]; - int t[GMP_RND_MAX] = { 1, -1, 1, -1, 1 }; /* RNDN, RNDZ, RNDU, RNDD, RNDA */ + mpfr_ptr r[MPFR_RND_MAX]; + int t[MPFR_RND_MAX] = { 1, -1, 1, -1, 1 }; /* RNDN, RNDZ, RNDU, RNDD, RNDA */ int i; int s; @@ -247,7 +247,7 @@ test_set_overflow (void) r[1] = r[3] = max; /* RNDZ, RNDD */ for (s = 1; s > 0; s = -1) { - for (i = 0; i < GMP_RND_MAX ; i++) + for (i = 0; i < MPFR_RND_MAX ; i++) { int j; int inex; @@ -259,15 +259,15 @@ test_set_overflow (void) printf ("Error in test_set_overflow, sign = %d," " rnd_mode = %s\n", s, mpfr_print_rnd_mode ((mp_rnd_t) i)); printf ("Got\n"); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf (", inex = %d\ninstead of\n", inex); - mpfr_out_str (stdout, 2, 0, r[j], GMP_RNDN); + mpfr_out_str (stdout, 2, 0, r[j], MPFR_RNDN); printf (", inex = %d\n", t[j]); exit (1); } } - mpfr_neg (inf, inf, GMP_RNDN); - mpfr_neg (max, max, GMP_RNDN); + mpfr_neg (inf, inf, MPFR_RNDN); + mpfr_neg (max, max, MPFR_RNDN); } mpfr_clears (x, inf, max, (mpfr_ptr) 0); } @@ -314,10 +314,10 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_mul_2exp (x, x, 1024, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_mul_2exp (x, x, 1024, MPFR_RNDN); mpfr_set_double_range (); - mpfr_check_range (x, 0, GMP_RNDN); + mpfr_check_range (x, 0, MPFR_RNDN); if (!mpfr_inf_p (x) || (mpfr_sgn(x) <= 0)) { printf ("Error: 2^1024 rounded to nearest should give +Inf\n"); @@ -325,19 +325,19 @@ main (int argc, char *argv[]) } set_emax (1025); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_mul_2exp (x, x, 1024, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_mul_2exp (x, x, 1024, MPFR_RNDN); mpfr_set_double_range (); - mpfr_check_range (x, 0, GMP_RNDD); + mpfr_check_range (x, 0, MPFR_RNDD); if (!mpfr_number_p (x)) { printf ("Error: 2^1024 rounded down should give a normal number\n"); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_mul_2exp (x, x, 1023, GMP_RNDN); - mpfr_add (x, x, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_mul_2exp (x, x, 1023, MPFR_RNDN); + mpfr_add (x, x, x, MPFR_RNDN); if (!mpfr_inf_p (x) || (mpfr_sgn(x) <= 0)) { printf ("Error: x+x rounded to nearest for x=2^1023 should give +Inf\n"); @@ -346,9 +346,9 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_mul_2exp (x, x, 1023, GMP_RNDN); - mpfr_add (x, x, x, GMP_RNDD); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_mul_2exp (x, x, 1023, MPFR_RNDN); + mpfr_add (x, x, x, MPFR_RNDD); if (!mpfr_number_p (x)) { printf ("Error: x+x rounded down for x=2^1023 should give" @@ -356,10 +356,10 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_div_2exp (x, x, 1022, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_div_2exp (x, x, 1022, MPFR_RNDN); mpfr_set_str_binary (y, "1.1e-1022"); /* y = 3/2*x */ - mpfr_sub (y, y, x, GMP_RNDZ); + mpfr_sub (y, y, x, MPFR_RNDZ); if (mpfr_cmp_ui (y, 0)) { printf ("Error: y-x rounded to zero should give 0" @@ -369,10 +369,10 @@ main (int argc, char *argv[]) } set_emin (-1026); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_div_2exp (x, x, 1025, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_div_2exp (x, x, 1025, MPFR_RNDN); mpfr_set_double_range (); - mpfr_check_range (x, 0, GMP_RNDN); + mpfr_check_range (x, 0, MPFR_RNDN); if (!MPFR_IS_ZERO (x) ) { printf ("Error: x rounded to nearest for x=2^-1024 should give Zero\n"); diff --git a/tests/texp.c b/tests/texp.c index ab91a3500..d1d3bb518 100644 --- a/tests/texp.c +++ b/tests/texp.c @@ -31,7 +31,7 @@ static int test_exp (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode) { int res; - int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53; + int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53; if (ok) { mpfr_print_raw (b); @@ -57,7 +57,7 @@ check3 (const char *op, mp_rnd_t rnd, const char *res) mpfr_inits2 (53, x, y, (mpfr_ptr) 0); /* y negative. If we forget to set the sign in mpfr_exp, we'll see it. */ - mpfr_set_si (y, -1, GMP_RNDN); + mpfr_set_si (y, -1, MPFR_RNDN); mpfr_set_str1 (x, op); test_exp (y, x, rnd); if (mpfr_cmp_str1 (y, res) ) @@ -65,7 +65,7 @@ check3 (const char *op, mp_rnd_t rnd, const char *res) printf ("mpfr_exp failed for x=%s, rnd=%s\n", op, mpfr_print_rnd_mode (rnd)); printf ("expected result is %s, got ", res); - mpfr_out_str (stdout, 10, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN); putchar('\n'); exit (1); } @@ -80,14 +80,14 @@ check_worst_case (const char *Xs, const char *expxs) mpfr_inits2 (53, x, y, (mpfr_ptr) 0); mpfr_set_str1(x, Xs); - test_exp(y, x, GMP_RNDD); + test_exp(y, x, MPFR_RNDD); if (mpfr_cmp_str1 (y, expxs)) { printf ("exp(x) rounded towards -infinity is wrong\n"); exit(1); } mpfr_set_str1(x, Xs); - test_exp(x, x, GMP_RNDU); + test_exp(x, x, MPFR_RNDU); mpfr_nexttoinf (y); if (mpfr_cmp(x,y)) { @@ -110,31 +110,31 @@ check_worst_cases (void) check_worst_case("6.39488462184069720009e-14", "1.00000000000006372680"); check_worst_case("1.84741111297455401935e-12", "1.00000000000184718907"); check_worst_case("1.76177628026265550074e-10", "1.00000000017617751702"); - check3("1.76177628026265550074e-10", GMP_RNDN, "1.00000000017617773906"); + check3("1.76177628026265550074e-10", MPFR_RNDN, "1.00000000017617773906"); check_worst_case("7.54175277499595900852e-10", "1.00000000075417516676"); - check3("7.54175277499595900852e-10", GMP_RNDN, "1.00000000075417538881"); + check3("7.54175277499595900852e-10", MPFR_RNDN, "1.00000000075417538881"); /* bug found by Vincent Lefe`vre on December 8, 1999 */ - check3("-5.42410311287441459172e+02", GMP_RNDN, "2.7176584868845723e-236"); + check3("-5.42410311287441459172e+02", MPFR_RNDN, "2.7176584868845723e-236"); /* further cases communicated by Vincent Lefe`vre on January 27, 2000 */ - check3("-1.32920285897904911589e-10", GMP_RNDN, "0.999999999867079769622"); - check3("-1.44037948245738330735e-10", GMP_RNDN, "0.9999999998559621072757"); - check3("-1.66795910430705305937e-10", GMP_RNDZ, "0.9999999998332040895832"); - check3("-1.64310953745426656203e-10", GMP_RNDN, "0.9999999998356891017792"); - check3("-1.38323574826034659172e-10", GMP_RNDZ, "0.9999999998616764251835"); - check3("-1.23621668465115401498e-10", GMP_RNDZ, "0.9999999998763783315425"); + check3("-1.32920285897904911589e-10", MPFR_RNDN, "0.999999999867079769622"); + check3("-1.44037948245738330735e-10", MPFR_RNDN, "0.9999999998559621072757"); + check3("-1.66795910430705305937e-10", MPFR_RNDZ, "0.9999999998332040895832"); + check3("-1.64310953745426656203e-10", MPFR_RNDN, "0.9999999998356891017792"); + check3("-1.38323574826034659172e-10", MPFR_RNDZ, "0.9999999998616764251835"); + check3("-1.23621668465115401498e-10", MPFR_RNDZ, "0.9999999998763783315425"); mpfr_set_prec (x, 601); - mpfr_set_str (x, "0.88b6ba510e10450edc258748bc9dfdd466f21b47ed264cdf24aa8f64af1f3fad9ec2301d43c0743f534b5aa20091ff6d352df458ef1ba519811ef6f5b11853534fd8fa32764a0a6d2d0dd20@0", 16, GMP_RNDZ); + mpfr_set_str (x, "0.88b6ba510e10450edc258748bc9dfdd466f21b47ed264cdf24aa8f64af1f3fad9ec2301d43c0743f534b5aa20091ff6d352df458ef1ba519811ef6f5b11853534fd8fa32764a0a6d2d0dd20@0", 16, MPFR_RNDZ); mpfr_init2 (y, 601); - mpfr_exp_2 (y, x, GMP_RNDD); - mpfr_exp_3 (x, x, GMP_RNDD); + mpfr_exp_2 (y, x, MPFR_RNDD); + mpfr_exp_3 (x, x, MPFR_RNDD); if (mpfr_cmp (x, y)) { printf ("mpfr_exp_2 and mpfr_exp_3 differ for prec=601\n"); printf ("mpfr_exp_2 gives "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\nmpfr_exp_3 gives "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } @@ -142,8 +142,8 @@ check_worst_cases (void) mpfr_set_prec (x, 13001); mpfr_set_prec (y, 13001); mpfr_urandomb (x, RANDS); - mpfr_exp_3 (y, x, GMP_RNDN); - mpfr_exp_2 (x, x, GMP_RNDN); + mpfr_exp_3 (y, x, MPFR_RNDN); + mpfr_exp_2 (x, x, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("mpfr_exp_2 and mpfr_exp_3 differ for prec=13001\n"); @@ -205,10 +205,10 @@ check_large (void) prec = 203780; mpfr_init2 (x, prec); mpfr_init2 (z, prec); - mpfr_set_ui (x, 3, GMP_RNDN); - mpfr_sqrt (x, x, GMP_RNDN); - mpfr_sub_ui (x, x, 1, GMP_RNDN); - mpfr_exp_3 (z, x, GMP_RNDN); + mpfr_set_ui (x, 3, MPFR_RNDN); + mpfr_sqrt (x, x, MPFR_RNDN); + mpfr_sub_ui (x, x, 1, MPFR_RNDN); + mpfr_exp_3 (z, x, MPFR_RNDN); mpfr_clear (x); mpfr_clear (z); } @@ -233,7 +233,7 @@ check_special (void) /* check exp(NaN) = NaN */ mpfr_set_nan (x); - test_exp (y, x, GMP_RNDN); + test_exp (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error for exp(NaN)\n"); @@ -242,7 +242,7 @@ check_special (void) /* check exp(+inf) = +inf */ mpfr_set_inf (x, 1); - test_exp (y, x, GMP_RNDN); + test_exp (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error for exp(+inf)\n"); @@ -251,7 +251,7 @@ check_special (void) /* check exp(-inf) = +0 */ mpfr_set_inf (x, -1); - test_exp (y, x, GMP_RNDN); + test_exp (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) { printf ("Error for exp(-inf)\n"); @@ -264,11 +264,11 @@ check_special (void) mpfr_set_emin (MPFR_EMIN_DEFAULT); mpfr_set_str (x, "0.1011000101110010000101111111010100001100000001110001100111001101E30", - 2, GMP_RNDN); - mpfr_exp (x, x, GMP_RNDD); + 2, MPFR_RNDN); + mpfr_exp (x, x, MPFR_RNDD); if (mpfr_cmp_str (x, ".1111111111111111111111111111111111111111111111111111111111111111E1073741823", - 2, GMP_RNDN) != 0) + 2, MPFR_RNDN) != 0) { printf ("Wrong overflow detection in mpfr_exp\n"); mpfr_dump (x); @@ -277,9 +277,9 @@ check_special (void) /* Check underflow. Corner case of mpfr_exp_2 */ mpfr_set_str (x, "-0.1011000101110010000101111111011111010001110011110111100110101100E30", - 2, GMP_RNDN); - mpfr_exp (x, x, GMP_RNDN); - if (mpfr_cmp_str (x, "0.1E-1073741823", 2, GMP_RNDN) != 0) + 2, MPFR_RNDN); + mpfr_exp (x, x, MPFR_RNDN); + if (mpfr_cmp_str (x, "0.1E-1073741823", 2, MPFR_RNDN) != 0) { printf ("Wrong underflow (1) detection in mpfr_exp\n"); mpfr_dump (x); @@ -287,8 +287,8 @@ check_special (void) } mpfr_set_str (x, "-0.1011001101110010000101111111011111010001110011110111100110111101E30", - 2, GMP_RNDN); - mpfr_exp (x, x, GMP_RNDN); + 2, MPFR_RNDN); + mpfr_exp (x, x, MPFR_RNDN); if (mpfr_cmp_ui (x, 0) != 0) { printf ("Wrong underflow (2) detection in mpfr_exp\n"); @@ -304,9 +304,9 @@ check_special (void) ? MPFR_EXP_THRESHOLD + 10 : 64); mpfr_set_str (x, "0.1011000101110010000101111111010100001100000001110001100111001101E30", - 2, GMP_RNDN); + 2, MPFR_RNDN); mpfr_clear_overflow (); - mpfr_exp (x, x, GMP_RNDD); + mpfr_exp (x, x, MPFR_RNDD); if (!mpfr_overflow_p ()) { printf ("Wrong overflow detection in mpfr_exp_3\n"); @@ -316,9 +316,9 @@ check_special (void) /* Check underflow. Corner case of mpfr_exp_3 */ mpfr_set_str (x, "-0.1011000101110010000101111111011111010001110011110111100110101100E30", - 2, GMP_RNDN); + 2, MPFR_RNDN); mpfr_clear_underflow (); - mpfr_exp (x, x, GMP_RNDN); + mpfr_exp (x, x, MPFR_RNDN); if (!mpfr_underflow_p ()) { printf ("Wrong underflow detection in mpfr_exp_3\n"); @@ -330,8 +330,8 @@ check_special (void) /* check overflow */ set_emax (10); - mpfr_set_ui (x, 7, GMP_RNDN); - test_exp (y, x, GMP_RNDN); + mpfr_set_ui (x, 7, MPFR_RNDN); + test_exp (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error for exp(7) for emax=10\n"); @@ -341,8 +341,8 @@ check_special (void) /* check underflow */ set_emin (-10); - mpfr_set_si (x, -9, GMP_RNDN); - test_exp (y, x, GMP_RNDN); + mpfr_set_si (x, -9, MPFR_RNDN); + test_exp (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) { printf ("Error for exp(-9) for emin=-10\n"); @@ -355,7 +355,7 @@ check_special (void) /* check case EXP(x) < -precy */ mpfr_set_prec (y, 2); mpfr_set_str_binary (x, "-0.1E-3"); - test_exp (y, x, GMP_RNDD); + test_exp (y, x, MPFR_RNDD); if (mpfr_cmp_ui_2exp (y, 3, -2)) { printf ("Error for exp(-1/16), prec=2, RNDD\n"); @@ -363,7 +363,7 @@ check_special (void) mpfr_dump (y); exit (1); } - test_exp (y, x, GMP_RNDZ); + test_exp (y, x, MPFR_RNDZ); if (mpfr_cmp_ui_2exp (y, 3, -2)) { printf ("Error for exp(-1/16), prec=2, RNDZ\n"); @@ -372,13 +372,13 @@ check_special (void) exit (1); } mpfr_set_str_binary (x, "0.1E-3"); - test_exp (y, x, GMP_RNDN); + test_exp (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { printf ("Error for exp(1/16), prec=2, RNDN\n"); exit (1); } - test_exp (y, x, GMP_RNDU); + test_exp (y, x, MPFR_RNDU); if (mpfr_cmp_ui_2exp (y, 3, -1)) { printf ("Error for exp(1/16), prec=2, RNDU\n"); @@ -389,13 +389,13 @@ check_special (void) mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); mpfr_set_str_binary (x, "1.1101011000111101011110000111010010101001101001110111e28"); - test_exp (y, x, GMP_RNDN); + test_exp (y, x, MPFR_RNDN); mpfr_set_prec (x, 153); mpfr_set_prec (z, 153); mpfr_set_str_binary (x, "1.1101011000111101011110000111010010101001101001110111e28"); - test_exp (z, x, GMP_RNDN); - mpfr_prec_round (z, 53, GMP_RNDN); + test_exp (z, x, MPFR_RNDN); + mpfr_prec_round (z, 53, MPFR_RNDN); if (mpfr_cmp (y, z)) { @@ -405,9 +405,9 @@ check_special (void) /* corner cases in mpfr_exp_3 */ mpfr_set_prec (x, 2); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_set_prec (y, 2); - mpfr_exp_3 (y, x, GMP_RNDN); + mpfr_exp_3 (y, x, MPFR_RNDN); /* Check some little things about overflow detection */ set_emin (-125); @@ -417,10 +417,10 @@ check_special (void) mpfr_set_str_binary (x, "0.11110000000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000" "00000000E4"); - test_exp (y, x, GMP_RNDN); + test_exp (y, x, MPFR_RNDN); if (mpfr_cmp_str (y, "0.11000111100001100110010101111101011010010101010000" "1101110111100010111001011111111000110111001011001101010" - "01E22", 2, GMP_RNDN)) + "01E22", 2, MPFR_RNDN)) { printf ("Special overflow error (1)\n"); mpfr_dump (y); @@ -431,29 +431,29 @@ check_special (void) set_emax (emax); /* Check for overflow producing a segfault with HUGE exponent */ - mpfr_set_ui (x, 3, GMP_RNDN); - mpfr_mul_2ui (x, x, 32, GMP_RNDN); - test_exp (y, x, GMP_RNDN); /* Can't test return value: May overflow or not*/ + mpfr_set_ui (x, 3, MPFR_RNDN); + mpfr_mul_2ui (x, x, 32, MPFR_RNDN); + test_exp (y, x, MPFR_RNDN); /* Can't test return value: May overflow or not*/ /* Bug due to wrong approximation of (x)/log2 */ mpfr_set_prec (x, 163); mpfr_set_str (x, "-4.28ac8fceeadcda06bb56359017b1c81b85b392e7", 16, - GMP_RNDN); - mpfr_exp (x, x, GMP_RNDN); + MPFR_RNDN); + mpfr_exp (x, x, MPFR_RNDN); if (mpfr_cmp_str (x, "3.fffffffffffffffffffffffffffffffffffffffe8@-2", - 16, GMP_RNDN)) + 16, MPFR_RNDN)) { printf ("Error for x= -4.28ac8fceeadcda06bb56359017b1c81b85b392e7"); printf ("expected 3.fffffffffffffffffffffffffffffffffffffffe8@-2"); printf ("Got "); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n'); } /* bug found by Guillaume Melquiond, 13 Sep 2005 */ mpfr_set_prec (x, 53); mpfr_set_str_binary (x, "-1E-400"); - mpfr_exp (x, x, GMP_RNDZ); + mpfr_exp (x, x, MPFR_RNDZ); if (mpfr_cmp_ui (x, 1) == 0) { printf ("Error for exp(-2^(-400))\n"); @@ -477,7 +477,7 @@ check_inexact (void) mpfr_set_str_binary (x, "1.0000000000001001000110100100101000001101101011100101e2"); - inexact = test_exp (y, x, GMP_RNDN); + inexact = test_exp (y, x, MPFR_RNDN); if (inexact <= 0) { printf ("Wrong inexact flag (Got %d instead of 1)\n", inexact); @@ -495,9 +495,9 @@ check_exp10(void) int inexact; mpfr_init2 (x, 200); - mpfr_set_ui(x, 4, GMP_RNDN); + mpfr_set_ui(x, 4, MPFR_RNDN); - inexact = mpfr_exp10 (x, x, GMP_RNDN); + inexact = mpfr_exp10 (x, x, MPFR_RNDN); if (mpfr_cmp_ui(x, 10*10*10*10)) { printf ("exp10: Wrong returned value\n"); @@ -526,17 +526,17 @@ overflowed_exp0 (void) for (emax = -1; emax <= 0; emax++) { - mpfr_set_ui_2exp (y, 1, emax, GMP_RNDN); + mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN); mpfr_nextbelow (y); set_emax (emax); /* 1 is not representable. */ /* and if emax < 0, 1 - eps is not representable either. */ for (i = -1; i <= 1; i++) RND_LOOP (rnd) { - mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN); + mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN); mpfr_clear_flags (); inex = mpfr_exp (x, x, (mp_rnd_t) rnd); - if ((i >= 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) && + if ((i >= 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) && ! mpfr_overflow_p ()) { printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n" @@ -544,7 +544,7 @@ overflowed_exp0 (void) i, mpfr_print_rnd_mode ((mp_rnd_t) rnd)); err = 1; } - if (rnd == GMP_RNDZ || rnd == GMP_RNDD) + if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) { if (inex >= 0) { @@ -603,22 +603,22 @@ bug20080731 (void) mpfr_init2 (x, 200); mpfr_set_str (x, "-2.c5c85fdf473de6af278ece700fcbdabd03cd0cb9ca62d8b62c@7", - 16, GMP_RNDN); + 16, MPFR_RNDN); mpfr_init2 (y1, prec); - mpfr_exp (y1, x, GMP_RNDU); + mpfr_exp (y1, x, MPFR_RNDU); /* Compute the result with a higher internal precision. */ mpfr_init2 (y2, 300); - mpfr_exp (y2, x, GMP_RNDU); - mpfr_prec_round (y2, prec, GMP_RNDU); + mpfr_exp (y2, x, MPFR_RNDU); + mpfr_prec_round (y2, prec, MPFR_RNDU); if (mpfr_cmp0 (y1, y2) != 0) { printf ("Error in bug20080731\nExpected "); - mpfr_out_str (stdout, 16, 0, y2, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, y2, MPFR_RNDN); printf ("\nGot "); - mpfr_out_str (stdout, 16, 0, y1, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, y1, MPFR_RNDN); printf ("\n"); exit (1); } @@ -648,7 +648,7 @@ underflow_up (int extended_emin) int i, j; mpfr_init2 (minpos, 2); - mpfr_set_ui (minpos, 0, GMP_RNDN); + mpfr_set_ui (minpos, 0, MPFR_RNDN); mpfr_nextabove (minpos); /* Let's test values near the underflow boundary. @@ -662,15 +662,15 @@ underflow_up (int extended_emin) * rnd(exp(x)) >= minpos and no underflow. * So, let's take x1 = rndu(log(minpos)) in some precision. * 2. If eps < 0, then exp(x) < minpos and the result will be either 0 - * or minpos. An underflow always occurs in GMP_RNDZ and GMP_RNDD, - * but not necessarily in GMP_RNDN and GMP_RNDU (this is underflow + * or minpos. An underflow always occurs in MPFR_RNDZ and MPFR_RNDD, + * but not necessarily in MPFR_RNDN and MPFR_RNDU (this is underflow * after rounding in an unbounded exponent range). If -a < eps < -b, * minpos * (1 - a) < exp(x) < minpos * (1 - b + b^2). - * - If eps > -2^(-p), no underflow in GMP_RNDU. - * - If eps > -2^(-p-1), no underflow in GMP_RNDN. - * - If eps < - (2^(-p-1) + 2^(-2p-1)), underflow in GMP_RNDN. - * - If eps < - (2^(-p) + 2^(-2p+1)), underflow in GMP_RNDU. - * - In GMP_RNDN, result is minpos iff exp(eps) > 1/2, i.e. + * - If eps > -2^(-p), no underflow in MPFR_RNDU. + * - If eps > -2^(-p-1), no underflow in MPFR_RNDN. + * - If eps < - (2^(-p-1) + 2^(-2p-1)), underflow in MPFR_RNDN. + * - If eps < - (2^(-p) + 2^(-2p+1)), underflow in MPFR_RNDU. + * - In MPFR_RNDN, result is minpos iff exp(eps) > 1/2, i.e. * - log(2) < eps < ... * * Moreover, since precy < MPFR_EXP_THRESHOLD (to avoid tests that take @@ -682,7 +682,7 @@ underflow_up (int extended_emin) */ /* Case eps > 0. In revision 5461 (trunk) on a 64-bit Linux machine: - * Incorrect flags in underflow_up, eps > 0, GMP_RNDN and extended emin + * Incorrect flags in underflow_up, eps > 0, MPFR_RNDN and extended emin * for precx = 96, precy = 16, mpfr_exp_3 * Got 9 instead of 8. * Note: testing this case in several precisions for x and y introduces @@ -692,7 +692,7 @@ underflow_up (int extended_emin) for (precx = 16; precx <= 128; precx += 16) { mpfr_init2 (x, precx); - mpfr_log (x, minpos, GMP_RNDU); + mpfr_log (x, minpos, MPFR_RNDU); for (precy = 16; precy <= 128; precy += 16) { mpfr_init2 (y, precy); @@ -730,9 +730,9 @@ underflow_up (int extended_emin) err = 1; } MPFR_ASSERTN (inex != 0); - if (rnd == GMP_RNDD || rnd == GMP_RNDZ) + if (rnd == MPFR_RNDD || rnd == MPFR_RNDZ) MPFR_ASSERTN (inex < 0); - if (rnd == GMP_RNDU) + if (rnd == MPFR_RNDU) MPFR_ASSERTN (inex > 0); if (err) exit (1); @@ -744,31 +744,31 @@ underflow_up (int extended_emin) mpfr_clear (x); } - /* Case - log(2) < eps < 0 in GMP_RNDN, starting with small-precision x; + /* Case - log(2) < eps < 0 in MPFR_RNDN, starting with small-precision x; * only check the result and the ternary value. * Previous to r5453 (trunk), on 32-bit and 64-bit machines, this fails * for precx = 65 and precy = 16, e.g.: * exp_2.c:264: assertion failed: ... - * because mpfr_sub (r, x, r, GMP_RNDU); yields a null value. This is + * because mpfr_sub (r, x, r, MPFR_RNDU); yields a null value. This is * fixed in r5453 by going to next Ziv's iteration. */ for (precx = sizeof(mp_exp_t) * CHAR_BIT + 1; precx <= 81; precx += 8) { mpfr_init2 (x, precx); - mpfr_log (x, minpos, GMP_RNDD); /* |ulp| <= 1/2 */ + mpfr_log (x, minpos, MPFR_RNDD); /* |ulp| <= 1/2 */ for (precy = 16; precy <= 128; precy += 16) { mpfr_init2 (y, precy); - inex = mpfr_exp (y, x, GMP_RNDN); + inex = mpfr_exp (y, x, MPFR_RNDN); if (inex <= 0 || mpfr_cmp0 (y, minpos) != 0) { printf ("Error in underflow_up, - log(2) < eps < 0"); if (extended_emin) printf (" and extended emin"); printf (" for prec = %d\nExpected ", precy); - mpfr_out_str (stdout, 16, 0, minpos, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, minpos, MPFR_RNDN); printf (" (minimum positive MPFR number) and inex > 0\nGot "); - mpfr_out_str (stdout, 16, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN); printf ("\nwith inex = %d\n", inex); exit (1); } @@ -785,8 +785,8 @@ underflow_up (int extended_emin) mpfr_inits2 (2, t, t2, (mpfr_ptr) 0); for (precy = 16; precy <= 128; precy += 16) { - mpfr_set_ui_2exp (t, 1, - precy, GMP_RNDN); /* 2^(-p) */ - mpfr_set_ui_2exp (t2, 1, 1 - 2 * precy, GMP_RNDN); /* 2^(-2p+1) */ + mpfr_set_ui_2exp (t, 1, - precy, MPFR_RNDN); /* 2^(-p) */ + mpfr_set_ui_2exp (t2, 1, 1 - 2 * precy, MPFR_RNDN); /* 2^(-2p+1) */ precx = sizeof(mp_exp_t) * CHAR_BIT + 2 * precy + 8; mpfr_init2 (x, precx); mpfr_init2 (y, precy); @@ -797,16 +797,16 @@ underflow_up (int extended_emin) if (j == 0) { /* Case eps > -2^(-(p+i)). */ - mpfr_log (x, minpos, GMP_RNDU); + mpfr_log (x, minpos, MPFR_RNDU); } else /* j == 1 */ { /* Case eps < - (2^(-(p+i)) + 2^(1-2(p+i))). */ - mpfr_log (x, minpos, GMP_RNDD); - inex = mpfr_sub (x, x, t2, GMP_RNDN); + mpfr_log (x, minpos, MPFR_RNDD); + inex = mpfr_sub (x, x, t2, MPFR_RNDN); MPFR_ASSERTN (inex == 0); } - inex = mpfr_sub (x, x, t, GMP_RNDN); + inex = mpfr_sub (x, x, t, MPFR_RNDN); MPFR_ASSERTN (inex == 0); RND_LOOP (rnd) @@ -816,9 +816,9 @@ underflow_up (int extended_emin) unsigned int flags; flags = MPFR_FLAGS_INEXACT | - (((rnd == GMP_RNDU || rnd == GMP_RNDA) + (((rnd == MPFR_RNDU || rnd == MPFR_RNDA) && (i == 1 || j == 0)) || - (rnd == GMP_RNDN && (i == 1 && j == 0)) ? + (rnd == MPFR_RNDN && (i == 1 && j == 0)) ? 0 : MPFR_FLAGS_UNDERFLOW); mpfr_clear_flags (); inex = e3 ? exp_3 (y, x, (mpfr_rnd_t) rnd) @@ -841,7 +841,7 @@ underflow_up (int extended_emin) __gmpfr_flags, flags); err = 1; } - if (rnd == GMP_RNDU || rnd == GMP_RNDA || rnd == GMP_RNDN ? + if (rnd == MPFR_RNDU || rnd == MPFR_RNDA || rnd == MPFR_RNDN ? mpfr_cmp0 (y, minpos) != 0 : MPFR_NOTZERO (y)) { printf ("Incorrect result in underflow_up, %s", @@ -863,8 +863,8 @@ underflow_up (int extended_emin) exit (1); } /* for (e3 ...) */ } /* for (j ...) */ - mpfr_div_2si (t, t, 1, GMP_RNDN); - mpfr_div_2si (t2, t2, 2, GMP_RNDN); + mpfr_div_2si (t, t, 1, MPFR_RNDN); + mpfr_div_2si (t2, t2, 2, MPFR_RNDN); } /* for (i ...) */ mpfr_clears (x, y, (mpfr_ptr) 0); } /* for (precy ...) */ @@ -887,9 +887,9 @@ underflow_up (int extended_emin) mpfr_inits2 (sizeof(mp_exp_t) * CHAR_BIT + 64, x, t, (mpfr_ptr) 0); for (i = 0; i <= 1; i++) { - mpfr_log (x, minpos, i ? GMP_RNDU : GMP_RNDD); - mpfr_const_log2 (t, i ? GMP_RNDD : GMP_RNDU); - mpfr_sub (x, x, t, i ? GMP_RNDU : GMP_RNDD); + mpfr_log (x, minpos, i ? MPFR_RNDU : MPFR_RNDD); + mpfr_const_log2 (t, i ? MPFR_RNDD : MPFR_RNDU); + mpfr_sub (x, x, t, i ? MPFR_RNDU : MPFR_RNDD); for (precy = 16; precy <= 128; precy += 16) { mpfr_init2 (y, precy); @@ -899,7 +899,7 @@ underflow_up (int extended_emin) MPFR_FLAGS_INEXACT | MPFR_FLAGS_UNDERFLOW; mpfr_clear_flags (); - inex = e3 ? exp_3 (y, x, GMP_RNDN) : mpfr_exp (y, x, GMP_RNDN); + inex = e3 ? exp_3 (y, x, MPFR_RNDN) : mpfr_exp (y, x, MPFR_RNDN); flags = __gmpfr_flags; if (flags != uflags || (i ? (inex <= 0 || mpfr_cmp0 (y, minpos) != 0) @@ -913,7 +913,7 @@ underflow_up (int extended_emin) e3 ? "mpfr_exp_3" : "mpfr_exp"); if (i) { - mpfr_out_str (stdout, 16, 0, minpos, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, minpos, MPFR_RNDN); printf (" (minimum positive MPFR number),\ninex >"); } else @@ -921,7 +921,7 @@ underflow_up (int extended_emin) printf ("+0, inex <"); } printf (" 0 and flags = %u\nGot ", uflags); - mpfr_out_str (stdout, 16, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN); printf ("\nwith inex = %d and flags = %u\n", inex, flags); exit (1); } @@ -965,46 +965,46 @@ main (int argc, char *argv[]) compare_exp2_exp3 (20, 1000); check_worst_cases(); - check3("0.0", GMP_RNDU, "1.0"); - check3("-1e-170", GMP_RNDU, "1.0"); - check3("-1e-170", GMP_RNDN, "1.0"); - check3("-8.88024741073346941839e-17", GMP_RNDU, "1.0"); - check3("8.70772839244701057915e-01", GMP_RNDN, "2.38875626491680437269"); - check3("1.0", GMP_RNDN, "2.71828182845904509080"); - check3("-3.42135637628104173534e-07", GMP_RNDZ, "0.999999657864420798958"); + check3("0.0", MPFR_RNDU, "1.0"); + check3("-1e-170", MPFR_RNDU, "1.0"); + check3("-1e-170", MPFR_RNDN, "1.0"); + check3("-8.88024741073346941839e-17", MPFR_RNDU, "1.0"); + check3("8.70772839244701057915e-01", MPFR_RNDN, "2.38875626491680437269"); + check3("1.0", MPFR_RNDN, "2.71828182845904509080"); + check3("-3.42135637628104173534e-07", MPFR_RNDZ, "0.999999657864420798958"); /* worst case for argument reduction, very near from 5*log(2), thanks to Jean-Michel Muller */ - check3("3.4657359027997265421", GMP_RNDN, "32.0"); - check3("3.4657359027997265421", GMP_RNDU, "32.0"); - check3("3.4657359027997265421", GMP_RNDD, "31.999999999999996447"); - check3("2.26523754332090625496e+01", GMP_RNDD, "6.8833785261699581146e9"); - check3("1.31478962104089092122e+01", GMP_RNDZ, "5.12930793917860137299e+05"); - check3("4.25637507920002378103e-01", GMP_RNDU, "1.53056585656161181497e+00"); - check3("6.26551618962329307459e-16", GMP_RNDU, "1.00000000000000066613e+00"); - check3("-3.35589513871216568383e-03",GMP_RNDD, "9.96649729583626853291e-01"); - check3("1.95151388850007272424e+01", GMP_RNDU, "2.98756340674767792225e+08"); - check3("2.45045953503350730784e+01", GMP_RNDN, "4.38743344916128387451e+10"); - check3("2.58165606081678085104e+01", GMP_RNDD, "1.62925781879432281494e+11"); - check3("-2.36539020084338638128e+01",GMP_RNDZ, "5.33630792749924762447e-11"); - check3("2.39211946135858077866e+01", GMP_RNDU, "2.44817704330214385986e+10"); - check3("-2.78190533055889162029e+01",GMP_RNDZ, "8.2858803483596879512e-13"); - check3("2.64028186174889789584e+01", GMP_RNDD, "2.9281844652878973388e11"); - check3("2.92086338843268329413e+01", GMP_RNDZ, "4.8433797301907177734e12"); - check3("-2.46355324071459982349e+01",GMP_RNDZ, "1.9995129297760994791e-11"); - check3("-2.23509444608605427618e+01",GMP_RNDZ, "1.9638492867489702307e-10"); - check3("-2.41175390197331687148e+01",GMP_RNDD, "3.3564940885530624592e-11"); - check3("2.46363885231578088053e+01", GMP_RNDU, "5.0055014282693267822e10"); - check3("111.1263531080090984914932050742208957672119140625", GMP_RNDN, "1.8262572323517295459e48"); - check3("-3.56196340354684821250e+02",GMP_RNDN, "2.0225297096141478156e-155"); - check3("6.59678273772710895173e+02", GMP_RNDU, "3.1234469273830195529e286"); - check3("5.13772529701934331570e+02", GMP_RNDD, "1.3445427121297197752e223"); - check3("3.57430211008718345056e+02", GMP_RNDD, "1.6981197246857298443e155"); - check3("3.82001814471465536371e+02", GMP_RNDU, "7.9667300591087367805e165"); - check3("5.92396038219384422518e+02", GMP_RNDD, "1.880747529554661989e257"); - check3("-5.02678550462488090034e+02",GMP_RNDU, "4.8919201895446217839e-219"); - check3("5.30015757134837031117e+02", GMP_RNDD, "1.5237672861171573939e230"); - check3("5.16239362447650933063e+02", GMP_RNDZ, "1.5845518406744492105e224"); - check3("6.00812634798592370977e-01", GMP_RNDN, "1.823600119339019443"); + check3("3.4657359027997265421", MPFR_RNDN, "32.0"); + check3("3.4657359027997265421", MPFR_RNDU, "32.0"); + check3("3.4657359027997265421", MPFR_RNDD, "31.999999999999996447"); + check3("2.26523754332090625496e+01", MPFR_RNDD, "6.8833785261699581146e9"); + check3("1.31478962104089092122e+01", MPFR_RNDZ, "5.12930793917860137299e+05"); + check3("4.25637507920002378103e-01", MPFR_RNDU, "1.53056585656161181497e+00"); + check3("6.26551618962329307459e-16", MPFR_RNDU, "1.00000000000000066613e+00"); + check3("-3.35589513871216568383e-03",MPFR_RNDD, "9.96649729583626853291e-01"); + check3("1.95151388850007272424e+01", MPFR_RNDU, "2.98756340674767792225e+08"); + check3("2.45045953503350730784e+01", MPFR_RNDN, "4.38743344916128387451e+10"); + check3("2.58165606081678085104e+01", MPFR_RNDD, "1.62925781879432281494e+11"); + check3("-2.36539020084338638128e+01",MPFR_RNDZ, "5.33630792749924762447e-11"); + check3("2.39211946135858077866e+01", MPFR_RNDU, "2.44817704330214385986e+10"); + check3("-2.78190533055889162029e+01",MPFR_RNDZ, "8.2858803483596879512e-13"); + check3("2.64028186174889789584e+01", MPFR_RNDD, "2.9281844652878973388e11"); + check3("2.92086338843268329413e+01", MPFR_RNDZ, "4.8433797301907177734e12"); + check3("-2.46355324071459982349e+01",MPFR_RNDZ, "1.9995129297760994791e-11"); + check3("-2.23509444608605427618e+01",MPFR_RNDZ, "1.9638492867489702307e-10"); + check3("-2.41175390197331687148e+01",MPFR_RNDD, "3.3564940885530624592e-11"); + check3("2.46363885231578088053e+01", MPFR_RNDU, "5.0055014282693267822e10"); + check3("111.1263531080090984914932050742208957672119140625", MPFR_RNDN, "1.8262572323517295459e48"); + check3("-3.56196340354684821250e+02",MPFR_RNDN, "2.0225297096141478156e-155"); + check3("6.59678273772710895173e+02", MPFR_RNDU, "3.1234469273830195529e286"); + check3("5.13772529701934331570e+02", MPFR_RNDD, "1.3445427121297197752e223"); + check3("3.57430211008718345056e+02", MPFR_RNDD, "1.6981197246857298443e155"); + check3("3.82001814471465536371e+02", MPFR_RNDU, "7.9667300591087367805e165"); + check3("5.92396038219384422518e+02", MPFR_RNDD, "1.880747529554661989e257"); + check3("-5.02678550462488090034e+02",MPFR_RNDU, "4.8919201895446217839e-219"); + check3("5.30015757134837031117e+02", MPFR_RNDD, "1.5237672861171573939e230"); + check3("5.16239362447650933063e+02", MPFR_RNDZ, "1.5845518406744492105e224"); + check3("6.00812634798592370977e-01", MPFR_RNDN, "1.823600119339019443"); check_exp10 (); bug20080731 (); diff --git a/tests/texp10.c b/tests/texp10.c index baed970d9..27d6b6fa9 100644 --- a/tests/texp10.c +++ b/tests/texp10.c @@ -48,7 +48,7 @@ special_overflow (void) mpfr_init2 (y, 24); mpfr_set_str_binary (x, "0.101100100000000000110100E15"); - inex = mpfr_exp10 (y, x, GMP_RNDN); + inex = mpfr_exp10 (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || inex <= 0) { printf ("Overflow error.\n"); @@ -73,14 +73,14 @@ emax_m_eps (void) mpfr_init2 (x, sizeof(mp_exp_t) * CHAR_BIT * 4); mpfr_init2 (y, 8); - mpfr_set_si (x, mpfr_get_emax (), GMP_RNDN); + mpfr_set_si (x, mpfr_get_emax (), MPFR_RNDN); mpfr_clear_flags (); - inex = mpfr_exp10 (y, x, GMP_RNDN); + inex = mpfr_exp10 (y, x, MPFR_RNDN); ov = mpfr_overflow_p (); if (!ov || !mpfr_inf_p (y) || inex <= 0) { - printf ("Overflow error for x = emax, GMP_RNDN.\n"); + printf ("Overflow error for x = emax, MPFR_RNDN.\n"); mpfr_dump (y); printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no "); exit (1); @@ -100,14 +100,14 @@ exp_range (void) emin = mpfr_get_emin (); set_emin (3); mpfr_init2 (x, 16); - mpfr_set_ui (x, 4, GMP_RNDN); - mpfr_exp10 (x, x, GMP_RNDN); + mpfr_set_ui (x, 4, MPFR_RNDN); + mpfr_exp10 (x, x, MPFR_RNDN); set_emin (emin); if (mpfr_nan_p (x) || mpfr_cmp_ui (x, 10000) != 0) { printf ("Error in mpfr_exp10 for x = 4, with emin = 3\n"); printf ("Expected 10000, got "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } @@ -128,17 +128,17 @@ overfl_exp10_0 (void) for (emax = -1; emax <= 0; emax++) { - mpfr_set_ui_2exp (y, 1, emax, GMP_RNDN); + mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN); mpfr_nextbelow (y); set_emax (emax); /* 1 is not representable. */ /* and if emax < 0, 1 - eps is not representable either. */ for (i = -1; i <= 1; i++) RND_LOOP (rnd) { - mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN); + mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN); mpfr_clear_flags (); inex = mpfr_exp10 (x, x, (mp_rnd_t) rnd); - if ((i >= 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) && + if ((i >= 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) && ! mpfr_overflow_p ()) { printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n" @@ -146,7 +146,7 @@ overfl_exp10_0 (void) i, mpfr_print_rnd_mode ((mp_rnd_t) rnd)); err = 1; } - if (rnd == GMP_RNDZ || rnd == GMP_RNDD) + if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) { if (inex >= 0) { @@ -208,23 +208,23 @@ main (int argc, char *argv[]) mpfr_init (x); mpfr_init (y); - mpfr_set_ui (x, 4, GMP_RNDN); - mpfr_exp10 (y, x, GMP_RNDN); + mpfr_set_ui (x, 4, MPFR_RNDN); + mpfr_exp10 (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 10000) != 0) { - printf ("Error for 10^4, GMP_RNDN\n"); + printf ("Error for 10^4, MPFR_RNDN\n"); exit (1); } - mpfr_exp10 (y, x, GMP_RNDD); + mpfr_exp10 (y, x, MPFR_RNDD); if (mpfr_cmp_ui (y, 10000) != 0) { - printf ("Error for 10^4, GMP_RNDD\n"); + printf ("Error for 10^4, MPFR_RNDD\n"); exit (1); } - mpfr_exp10 (y, x, GMP_RNDU); + mpfr_exp10 (y, x, MPFR_RNDU); if (mpfr_cmp_ui (y, 10000) != 0) { - printf ("Error for 10^4, GMP_RNDU\n"); + printf ("Error for 10^4, MPFR_RNDU\n"); exit (1); } @@ -233,8 +233,8 @@ main (int argc, char *argv[]) /* save emin */ emin = mpfr_get_emin (); set_emin (-11); - mpfr_set_si (x, -4, GMP_RNDN); - mpfr_exp10 (y, x, GMP_RNDN); + mpfr_set_si (x, -4, MPFR_RNDN); + mpfr_exp10 (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) { printf ("Error for emin = -11, x = -4, RNDN\n"); @@ -248,8 +248,8 @@ main (int argc, char *argv[]) /* save emax */ emax = mpfr_get_emax (); set_emax (13); - mpfr_set_ui (x, 4, GMP_RNDN); - mpfr_exp10 (y, x, GMP_RNDN); + mpfr_set_ui (x, 4, MPFR_RNDN); + mpfr_exp10 (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error for emax = 13, x = 4, RNDN\n"); @@ -262,7 +262,7 @@ main (int argc, char *argv[]) MPFR_SET_INF (x); MPFR_SET_POS (x); - mpfr_exp10 (y, x, GMP_RNDN); + mpfr_exp10 (y, x, MPFR_RNDN); if (!MPFR_IS_INF (y)) { printf ("evaluation of function in INF does not return INF\n"); @@ -270,7 +270,7 @@ main (int argc, char *argv[]) } MPFR_CHANGE_SIGN (x); - mpfr_exp10 (y, x, GMP_RNDN); + mpfr_exp10 (y, x, MPFR_RNDN); if (!MPFR_IS_ZERO (y)) { printf ("evaluation of function in -INF does not return 0\n"); @@ -278,7 +278,7 @@ main (int argc, char *argv[]) } MPFR_SET_NAN (x); - mpfr_exp10 (y, x, GMP_RNDN); + mpfr_exp10 (y, x, MPFR_RNDN); if (!MPFR_IS_NAN (y)) { printf ("evaluation of function in NaN does not return NaN\n"); @@ -291,13 +291,13 @@ main (int argc, char *argv[]) /* emax <= 10000000000 */ mpfr_set_prec (x, 40); mpfr_set_prec (y, 40); - mpfr_set_str (x, "3010299957", 10, GMP_RNDN); + mpfr_set_str (x, "3010299957", 10, MPFR_RNDN); mpfr_clear_flags (); - inex = mpfr_exp10 (y, x, GMP_RNDN); + inex = mpfr_exp10 (y, x, MPFR_RNDN); ov = mpfr_overflow_p (); if (!(MPFR_IS_INF (y) && MPFR_IS_POS (y) && ov)) { - printf ("Overflow error for x = 3010299957, GMP_RNDN.\n"); + printf ("Overflow error for x = 3010299957, MPFR_RNDN.\n"); mpfr_dump (y); printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no "); exit (1); diff --git a/tests/texp2.c b/tests/texp2.c index 0f06863b5..ca4078860 100644 --- a/tests/texp2.c +++ b/tests/texp2.c @@ -48,7 +48,7 @@ special_overflow (void) mpfr_init2 (y, 24); mpfr_set_str_binary (x, "0.101100100000000000110100E15"); - inex = mpfr_exp2 (y, x, GMP_RNDN); + inex = mpfr_exp2 (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || inex <= 0) { printf ("Overflow error.\n"); @@ -73,14 +73,14 @@ emax_m_eps (void) mpfr_init2 (x, sizeof(mp_exp_t) * CHAR_BIT * 4); mpfr_init2 (y, 8); - mpfr_set_si (x, mpfr_get_emax (), GMP_RNDN); + mpfr_set_si (x, mpfr_get_emax (), MPFR_RNDN); mpfr_clear_flags (); - inex = mpfr_exp2 (y, x, GMP_RNDN); + inex = mpfr_exp2 (y, x, MPFR_RNDN); ov = mpfr_overflow_p (); if (!ov || !mpfr_inf_p (y) || inex <= 0) { - printf ("Overflow error for x = emax, GMP_RNDN.\n"); + printf ("Overflow error for x = emax, MPFR_RNDN.\n"); mpfr_dump (y); printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no "); exit (1); @@ -89,23 +89,23 @@ emax_m_eps (void) mpfr_nextbelow (x); mpfr_clear_flags (); - inex = mpfr_exp2 (y, x, GMP_RNDN); + inex = mpfr_exp2 (y, x, MPFR_RNDN); ov = mpfr_overflow_p (); if (!ov || !mpfr_inf_p (y) || inex <= 0) { - printf ("Overflow error for x = emax - eps, GMP_RNDN.\n"); + printf ("Overflow error for x = emax - eps, MPFR_RNDN.\n"); mpfr_dump (y); printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no "); exit (1); } mpfr_clear_flags (); - inex = mpfr_exp2 (y, x, GMP_RNDD); + inex = mpfr_exp2 (y, x, MPFR_RNDD); ov = mpfr_overflow_p (); if (ov || mpfr_inf_p (y) || inex >= 0 || (mpfr_nextabove (y), !mpfr_inf_p (y))) { - printf ("Overflow error for x = emax - eps, GMP_RNDD.\n"); + printf ("Overflow error for x = emax - eps, MPFR_RNDD.\n"); mpfr_dump (y); printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no "); exit (1); @@ -125,14 +125,14 @@ exp_range (void) emin = mpfr_get_emin (); set_emin (3); mpfr_init2 (x, 8); - mpfr_set_ui (x, 5, GMP_RNDN); - mpfr_exp2 (x, x, GMP_RNDN); + mpfr_set_ui (x, 5, MPFR_RNDN); + mpfr_exp2 (x, x, MPFR_RNDN); set_emin (emin); if (mpfr_nan_p (x) || mpfr_cmp_ui (x, 32) != 0) { printf ("Error in mpfr_exp2 for x = 5, with emin = 3\n"); printf ("Expected 32, got "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } @@ -153,17 +153,17 @@ overflowed_exp2_0 (void) for (emax = -1; emax <= 0; emax++) { - mpfr_set_ui_2exp (y, 1, emax, GMP_RNDN); + mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN); mpfr_nextbelow (y); set_emax (emax); /* 1 is not representable. */ /* and if emax < 0, 1 - eps is not representable either. */ for (i = -1; i <= 1; i++) RND_LOOP (rnd) { - mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN); + mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN); mpfr_clear_flags (); inex = mpfr_exp2 (x, x, (mp_rnd_t) rnd); - if ((i >= 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) && + if ((i >= 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) && ! mpfr_overflow_p ()) { printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n" @@ -171,7 +171,7 @@ overflowed_exp2_0 (void) i, mpfr_print_rnd_mode ((mp_rnd_t) rnd)); err = 1; } - if (rnd == GMP_RNDZ || rnd == GMP_RNDD) + if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) { if (inex >= 0) { @@ -232,51 +232,51 @@ main (int argc, char *argv[]) mpfr_init (x); mpfr_init (y); - mpfr_set_ui (x, 4, GMP_RNDN); - mpfr_exp2 (y, x, GMP_RNDN); + mpfr_set_ui (x, 4, MPFR_RNDN); + mpfr_exp2 (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 16) != 0) { - printf ("Error for 2^4, GMP_RNDN\n"); + printf ("Error for 2^4, MPFR_RNDN\n"); exit (1); } - mpfr_exp2 (y, x, GMP_RNDD); + mpfr_exp2 (y, x, MPFR_RNDD); if (mpfr_cmp_ui (y, 16) != 0) { - printf ("Error for 2^4, GMP_RNDD\n"); + printf ("Error for 2^4, MPFR_RNDD\n"); exit (1); } - mpfr_exp2 (y, x, GMP_RNDU); + mpfr_exp2 (y, x, MPFR_RNDU); if (mpfr_cmp_ui (y, 16) != 0) { - printf ("Error for 2^4, GMP_RNDU\n"); + printf ("Error for 2^4, MPFR_RNDU\n"); exit (1); } - mpfr_set_si (x, -4, GMP_RNDN); - mpfr_exp2 (y, x, GMP_RNDN); + mpfr_set_si (x, -4, MPFR_RNDN); + mpfr_exp2 (y, x, MPFR_RNDN); if (mpfr_cmp_ui_2exp (y, 1, -4) != 0) { - printf ("Error for 2^(-4), GMP_RNDN\n"); + printf ("Error for 2^(-4), MPFR_RNDN\n"); exit (1); } - mpfr_exp2 (y, x, GMP_RNDD); + mpfr_exp2 (y, x, MPFR_RNDD); if (mpfr_cmp_ui_2exp (y, 1, -4) != 0) { - printf ("Error for 2^(-4), GMP_RNDD\n"); + printf ("Error for 2^(-4), MPFR_RNDD\n"); exit (1); } - mpfr_exp2 (y, x, GMP_RNDU); + mpfr_exp2 (y, x, MPFR_RNDU); if (mpfr_cmp_ui_2exp (y, 1, -4) != 0) { - printf ("Error for 2^(-4), GMP_RNDU\n"); + printf ("Error for 2^(-4), MPFR_RNDU\n"); exit (1); } mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); mpfr_set_str (x, /*-1683977482443233.0 / 2199023255552.0*/ - "-7.6578429909351734750089235603809357e2", 10, GMP_RNDN); - mpfr_exp2 (y, x, GMP_RNDN); + "-7.6578429909351734750089235603809357e2", 10, MPFR_RNDN); + mpfr_exp2 (y, x, MPFR_RNDN); if (mpfr_cmp_str1 (y, "2.991959870867646566478e-231")) { printf ("Error for x=-1683977482443233/2^41\n"); @@ -288,8 +288,8 @@ main (int argc, char *argv[]) /* save emin */ emin = mpfr_get_emin (); set_emin (-10); - mpfr_set_si (x, -12, GMP_RNDN); - mpfr_exp2 (y, x, GMP_RNDN); + mpfr_set_si (x, -12, MPFR_RNDN); + mpfr_exp2 (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) { printf ("Error for x=emin-2, RNDN\n"); @@ -303,8 +303,8 @@ main (int argc, char *argv[]) /* save emax */ emax = mpfr_get_emax (); set_emax (10); - mpfr_set_ui (x, 11, GMP_RNDN); - mpfr_exp2 (y, x, GMP_RNDN); + mpfr_set_ui (x, 11, MPFR_RNDN); + mpfr_exp2 (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error for x=emax+1, RNDN\n"); @@ -315,7 +315,7 @@ main (int argc, char *argv[]) MPFR_SET_INF(x); MPFR_SET_POS(x); - mpfr_exp2 (y, x, GMP_RNDN); + mpfr_exp2 (y, x, MPFR_RNDN); if(!MPFR_IS_INF(y)) { printf ("evaluation of function in INF does not return INF\n"); @@ -323,7 +323,7 @@ main (int argc, char *argv[]) } MPFR_CHANGE_SIGN(x); - mpfr_exp2 (y, x, GMP_RNDN); + mpfr_exp2 (y, x, MPFR_RNDN); if(!MPFR_IS_ZERO(y)) { printf ("evaluation of function in -INF does not return 0\n"); @@ -331,7 +331,7 @@ main (int argc, char *argv[]) } MPFR_SET_NAN(x); - mpfr_exp2 (y, x, GMP_RNDN); + mpfr_exp2 (y, x, MPFR_RNDN); if(!MPFR_IS_NAN(y)) { printf ("evaluation of function in NaN does not return NaN\n"); @@ -344,9 +344,9 @@ main (int argc, char *argv[]) /* emax <= 10000000000 */ mpfr_set_prec (x, 40); mpfr_set_prec (y, 40); - mpfr_set_str (x, "10000000000.5", 10, GMP_RNDN); + mpfr_set_str (x, "10000000000.5", 10, MPFR_RNDN); mpfr_clear_flags (); - mpfr_exp2 (y, x, GMP_RNDN); + mpfr_exp2 (y, x, MPFR_RNDN); if (!(MPFR_IS_INF (y) && MPFR_IS_POS (y) && mpfr_overflow_p ())) { printf ("exp2(10000000000.5) should overflow.\n"); @@ -357,7 +357,7 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 2); mpfr_set_prec (y, 2); mpfr_set_str_binary (x, "-1.0E-26"); - mpfr_exp2 (y, x, GMP_RNDD); + mpfr_exp2 (y, x, MPFR_RNDD); mpfr_set_str_binary (x, "1.1E-1"); if (mpfr_cmp (x, y)) { diff --git a/tests/texpm1.c b/tests/texpm1.c index 862bb6301..21b81bfc5 100644 --- a/tests/texpm1.c +++ b/tests/texpm1.c @@ -30,7 +30,7 @@ static int test_expm1 (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode) { int res; - int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53; + int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53; if (ok) { mpfr_print_raw (b); @@ -63,7 +63,7 @@ special (void) mpfr_init (y); mpfr_set_nan (x); - test_expm1 (y, x, GMP_RNDN); + test_expm1 (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error for expm1(NaN)\n"); @@ -71,7 +71,7 @@ special (void) } mpfr_set_inf (x, 1); - test_expm1 (y, x, GMP_RNDN); + test_expm1 (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error for expm1(+Inf)\n"); @@ -79,23 +79,23 @@ special (void) } mpfr_set_inf (x, -1); - test_expm1 (y, x, GMP_RNDN); + test_expm1 (y, x, MPFR_RNDN); if (mpfr_cmp_si (y, -1)) { printf ("Error for expm1(-Inf)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); - test_expm1 (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + test_expm1 (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) { printf ("Error for expm1(+0)\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - test_expm1 (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + test_expm1 (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0) { printf ("Error for expm1(-0)\n"); @@ -105,21 +105,21 @@ special (void) /* Check overflow of expm1(x) */ mpfr_clear_flags (); mpfr_set_str_binary (x, "1.1E1000000000"); - i = test_expm1 (x, x, GMP_RNDN); + i = test_expm1 (x, x, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "1.1E1000000000"); - i = test_expm1 (x, x, GMP_RNDU); + i = test_expm1 (x, x, MPFR_RNDU); MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "1.1E1000000000"); - i = test_expm1 (x, x, GMP_RNDD); + i = test_expm1 (x, x, MPFR_RNDD); MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == -1); @@ -128,26 +128,26 @@ special (void) mpfr_set_prec (x, 2); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1.1E1000000000"); - i = test_expm1 (x, x, GMP_RNDN); + i = test_expm1 (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_si (x, -1) == 0); MPFR_ASSERTN (!mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == -1); mpfr_set_str_binary (x, "-1.1E1000000000"); - i = test_expm1 (x, x, GMP_RNDD); + i = test_expm1 (x, x, MPFR_RNDD); MPFR_ASSERTN (mpfr_cmp_si (x, -1) == 0); MPFR_ASSERTN (!mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == -1); mpfr_set_str_binary (x, "-1.1E1000000000"); - i = test_expm1 (x, x, GMP_RNDZ); - MPFR_ASSERTN (mpfr_cmp_str (x, "-0.11", 2, GMP_RNDN) == 0); + i = test_expm1 (x, x, MPFR_RNDZ); + MPFR_ASSERTN (mpfr_cmp_str (x, "-0.11", 2, MPFR_RNDN) == 0); MPFR_ASSERTN (!mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == 1); mpfr_set_str_binary (x, "-1.1E1000000000"); - i = test_expm1 (x, x, GMP_RNDU); - MPFR_ASSERTN (mpfr_cmp_str (x, "-0.11", 2, GMP_RNDN) == 0); + i = test_expm1 (x, x, MPFR_RNDU); + MPFR_ASSERTN (mpfr_cmp_str (x, "-0.11", 2, MPFR_RNDN) == 0); MPFR_ASSERTN (!mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == 1); diff --git a/tests/tfactorial.c b/tests/tfactorial.c index 479f59454..a3633d01e 100644 --- a/tests/tfactorial.c +++ b/tests/tfactorial.c @@ -38,7 +38,7 @@ special (void) mpfr_set_prec (x, 21); mpfr_set_prec (y, 21); - mpfr_fac_ui (x, 119, GMP_RNDZ); + mpfr_fac_ui (x, 119, MPFR_RNDZ); mpfr_set_str_binary (y, "0.101111101110100110110E654"); if (mpfr_cmp (x, y)) { @@ -47,7 +47,7 @@ special (void) } mpfr_set_prec (y, 206); - inex = mpfr_fac_ui (y, 767, GMP_RNDN); + inex = mpfr_fac_ui (y, 767, MPFR_RNDN); mpfr_set_prec (x, 206); mpfr_set_str_binary (x, "0.110111100001000001101010010001000111000100000100111000010011100011011111001100011110101000111101101100110001001100110100001001111110000101010000100100011100010011101110000001000010001100010000101001111E6250"); if (mpfr_cmp (x, y)) @@ -62,7 +62,7 @@ special (void) } mpfr_set_prec (y, 202); - mpfr_fac_ui (y, 69, GMP_RNDU); + mpfr_fac_ui (y, 69, MPFR_RNDU); mpfr_clear (x); mpfr_clear (y); @@ -91,7 +91,7 @@ test_int (void) { mpfr_set_prec (x, p); mpfr_set_prec (y, p); - for (r = 0; r < GMP_RND_MAX; r++) + for (r = 0; r < MPFR_RND_MAX; r++) { inex1 = mpfr_fac_ui (x, n, (mp_rnd_t) r); inex2 = mpfr_set_z (y, f, (mp_rnd_t) r); @@ -129,7 +129,7 @@ overflowed_fac0 (void) mpfr_init2 (x, 8); mpfr_init2 (y, 8); - mpfr_set_ui (y, 1, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); mpfr_nextbelow (y); set_emax (0); /* 1 is not representable. */ RND_LOOP (rnd) @@ -143,7 +143,7 @@ overflowed_fac0 (void) mpfr_print_rnd_mode ((mp_rnd_t) rnd)); err = 1; } - if (rnd == GMP_RNDZ || rnd == GMP_RNDD) + if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) { if (inex >= 0) { @@ -207,7 +207,7 @@ main (int argc, char *argv[]) mpfr_init (z); mpfr_init (t); - mpfr_fac_ui (y, 0, GMP_RNDN); + mpfr_fac_ui (y, 0, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { @@ -224,10 +224,10 @@ main (int argc, char *argv[]) mpfr_set_prec (y, yprec); for (n = 0; n < 50; n++) - for (rnd = 0; rnd < GMP_RND_MAX; rnd++) + for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) { inexact = mpfr_fac_ui (y, n, (mp_rnd_t) rnd); - err = (rnd == GMP_RNDN) ? yprec + 1 : yprec; + err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec; if (mpfr_can_round (y, err, (mp_rnd_t) rnd, (mp_rnd_t) rnd, prec)) { mpfr_set (t, y, (mp_rnd_t) rnd); @@ -257,14 +257,14 @@ main (int argc, char *argv[]) if (mpfr_cmp (t, z)) { printf ("results differ for x="); - mpfr_out_str (stdout, 2, prec, x, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN); printf (" prec=%u rnd_mode=%s\n", prec, mpfr_print_rnd_mode ((mp_rnd_t) rnd)); printf (" got "); - mpfr_out_str (stdout, 2, prec, z, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); puts (""); printf (" expected "); - mpfr_out_str (stdout, 2, prec, t, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); puts (""); printf (" approximation was "); mpfr_print_binary (y); diff --git a/tests/tfits.c b/tests/tfits.c index f7a983524..efa9955a3 100644 --- a/tests/tfits.c +++ b/tests/tfits.c @@ -63,136 +63,136 @@ main (void) /* Check NAN */ mpfr_set_nan(x); - if (mpfr_fits_ulong_p(x, GMP_RNDN)) + if (mpfr_fits_ulong_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_slong_p(x, GMP_RNDN)) + if (mpfr_fits_slong_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_uint_p(x, GMP_RNDN)) + if (mpfr_fits_uint_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_sint_p(x, GMP_RNDN)) + if (mpfr_fits_sint_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_ushort_p(x, GMP_RNDN)) + if (mpfr_fits_ushort_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_sshort_p(x, GMP_RNDN)) + if (mpfr_fits_sshort_p(x, MPFR_RNDN)) ERROR1; /* Check INF */ mpfr_set_inf(x, 1); - if (mpfr_fits_ulong_p(x, GMP_RNDN)) + if (mpfr_fits_ulong_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_slong_p(x, GMP_RNDN)) + if (mpfr_fits_slong_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_uint_p(x, GMP_RNDN)) + if (mpfr_fits_uint_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_sint_p(x, GMP_RNDN)) + if (mpfr_fits_sint_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_ushort_p(x, GMP_RNDN)) + if (mpfr_fits_ushort_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_sshort_p(x, GMP_RNDN)) + if (mpfr_fits_sshort_p(x, MPFR_RNDN)) ERROR1; /* Check Zero */ MPFR_SET_ZERO(x); - if (!mpfr_fits_ulong_p(x, GMP_RNDN)) + if (!mpfr_fits_ulong_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_slong_p(x, GMP_RNDN)) + if (!mpfr_fits_slong_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_uint_p(x, GMP_RNDN)) + if (!mpfr_fits_uint_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_sint_p(x, GMP_RNDN)) + if (!mpfr_fits_sint_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_ushort_p(x, GMP_RNDN)) + if (!mpfr_fits_ushort_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_sshort_p(x, GMP_RNDN)) + if (!mpfr_fits_sshort_p(x, MPFR_RNDN)) ERROR2; /* Check small op */ mpfr_set_str1 (x, "1@-1"); - if (!mpfr_fits_ulong_p(x, GMP_RNDN)) + if (!mpfr_fits_ulong_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_slong_p(x, GMP_RNDN)) + if (!mpfr_fits_slong_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_uint_p(x, GMP_RNDN)) + if (!mpfr_fits_uint_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_sint_p(x, GMP_RNDN)) + if (!mpfr_fits_sint_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_ushort_p(x, GMP_RNDN)) + if (!mpfr_fits_ushort_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_sshort_p(x, GMP_RNDN)) + if (!mpfr_fits_sshort_p(x, MPFR_RNDN)) ERROR2; /* Check 17 */ - mpfr_set_ui (x, 17, GMP_RNDN); - if (!mpfr_fits_ulong_p(x, GMP_RNDN)) + mpfr_set_ui (x, 17, MPFR_RNDN); + if (!mpfr_fits_ulong_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_slong_p(x, GMP_RNDN)) + if (!mpfr_fits_slong_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_uint_p(x, GMP_RNDN)) + if (!mpfr_fits_uint_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_sint_p(x, GMP_RNDN)) + if (!mpfr_fits_sint_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_ushort_p(x, GMP_RNDN)) + if (!mpfr_fits_ushort_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_sshort_p(x, GMP_RNDN)) + if (!mpfr_fits_sshort_p(x, MPFR_RNDN)) ERROR2; /* Check all other values */ - mpfr_set_ui(x, ULONG_MAX, GMP_RNDN); - mpfr_mul_2exp(x, x, 1, GMP_RNDN); - if (mpfr_fits_ulong_p(x, GMP_RNDN)) + mpfr_set_ui(x, ULONG_MAX, MPFR_RNDN); + mpfr_mul_2exp(x, x, 1, MPFR_RNDN); + if (mpfr_fits_ulong_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_slong_p(x, GMP_RNDN)) + if (mpfr_fits_slong_p(x, MPFR_RNDN)) ERROR1; - mpfr_mul_2exp(x, x, 40, GMP_RNDN); - if (mpfr_fits_ulong_p(x, GMP_RNDN)) + mpfr_mul_2exp(x, x, 40, MPFR_RNDN); + if (mpfr_fits_ulong_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_uint_p(x, GMP_RNDN)) + if (mpfr_fits_uint_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_sint_p(x, GMP_RNDN)) + if (mpfr_fits_sint_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_ushort_p(x, GMP_RNDN)) + if (mpfr_fits_ushort_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_sshort_p(x, GMP_RNDN)) + if (mpfr_fits_sshort_p(x, MPFR_RNDN)) ERROR1; - mpfr_set_ui(x, ULONG_MAX, GMP_RNDN); - if (!mpfr_fits_ulong_p(x, GMP_RNDN)) + mpfr_set_ui(x, ULONG_MAX, MPFR_RNDN); + if (!mpfr_fits_ulong_p(x, MPFR_RNDN)) ERROR2; - mpfr_set_ui(x, LONG_MAX, GMP_RNDN); - if (!mpfr_fits_slong_p(x, GMP_RNDN)) + mpfr_set_ui(x, LONG_MAX, MPFR_RNDN); + if (!mpfr_fits_slong_p(x, MPFR_RNDN)) ERROR2; - mpfr_set_ui(x, UINT_MAX, GMP_RNDN); - if (!mpfr_fits_uint_p(x, GMP_RNDN)) + mpfr_set_ui(x, UINT_MAX, MPFR_RNDN); + if (!mpfr_fits_uint_p(x, MPFR_RNDN)) ERROR2; - mpfr_set_ui(x, INT_MAX, GMP_RNDN); - if (!mpfr_fits_sint_p(x, GMP_RNDN)) + mpfr_set_ui(x, INT_MAX, MPFR_RNDN); + if (!mpfr_fits_sint_p(x, MPFR_RNDN)) ERROR2; - mpfr_set_ui(x, USHRT_MAX, GMP_RNDN); - if (!mpfr_fits_ushort_p(x, GMP_RNDN)) + mpfr_set_ui(x, USHRT_MAX, MPFR_RNDN); + if (!mpfr_fits_ushort_p(x, MPFR_RNDN)) ERROR2; - mpfr_set_ui(x, SHRT_MAX, GMP_RNDN); - if (!mpfr_fits_sshort_p(x, GMP_RNDN)) + mpfr_set_ui(x, SHRT_MAX, MPFR_RNDN); + if (!mpfr_fits_sshort_p(x, MPFR_RNDN)) ERROR2; - mpfr_set_si(x, 1, GMP_RNDN); - if (!mpfr_fits_sint_p(x, GMP_RNDN)) + mpfr_set_si(x, 1, MPFR_RNDN); + if (!mpfr_fits_sint_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_sshort_p(x, GMP_RNDN)) + if (!mpfr_fits_sshort_p(x, MPFR_RNDN)) ERROR2; /* Check negative value */ - mpfr_set_si (x, -1, GMP_RNDN); - if (!mpfr_fits_sint_p(x, GMP_RNDN)) + mpfr_set_si (x, -1, MPFR_RNDN); + if (!mpfr_fits_sint_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_sshort_p(x, GMP_RNDN)) + if (!mpfr_fits_sshort_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_slong_p(x, GMP_RNDN)) + if (!mpfr_fits_slong_p(x, MPFR_RNDN)) ERROR2; - if (mpfr_fits_uint_p(x, GMP_RNDN)) + if (mpfr_fits_uint_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_ushort_p(x, GMP_RNDN)) + if (mpfr_fits_ushort_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_ulong_p(x, GMP_RNDN)) + if (mpfr_fits_ulong_p(x, MPFR_RNDN)) ERROR1; mpfr_clear (x); @@ -212,73 +212,73 @@ static void check_intmax (void) /* Check NAN */ mpfr_set_nan(x); - if (mpfr_fits_uintmax_p(x, GMP_RNDN)) + if (mpfr_fits_uintmax_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_intmax_p(x, GMP_RNDN)) + if (mpfr_fits_intmax_p(x, MPFR_RNDN)) ERROR1; /* Check INF */ mpfr_set_inf(x, 1); - if (mpfr_fits_uintmax_p(x, GMP_RNDN)) + if (mpfr_fits_uintmax_p(x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_intmax_p(x, GMP_RNDN)) + if (mpfr_fits_intmax_p(x, MPFR_RNDN)) ERROR1; /* Check Zero */ MPFR_SET_ZERO(x); - if (!mpfr_fits_uintmax_p(x, GMP_RNDN)) + if (!mpfr_fits_uintmax_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_intmax_p(x, GMP_RNDN)) + if (!mpfr_fits_intmax_p(x, MPFR_RNDN)) ERROR2; /* Check small op */ mpfr_set_str1 (x, "1@-1"); - if (!mpfr_fits_uintmax_p(x, GMP_RNDN)) + if (!mpfr_fits_uintmax_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_intmax_p(x, GMP_RNDN)) + if (!mpfr_fits_intmax_p(x, MPFR_RNDN)) ERROR2; /* Check 17 */ - mpfr_set_ui (x, 17, GMP_RNDN); - if (!mpfr_fits_uintmax_p(x, GMP_RNDN)) + mpfr_set_ui (x, 17, MPFR_RNDN); + if (!mpfr_fits_uintmax_p(x, MPFR_RNDN)) ERROR2; - if (!mpfr_fits_intmax_p(x, GMP_RNDN)) + if (!mpfr_fits_intmax_p(x, MPFR_RNDN)) ERROR2; /* Check hugest */ - mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, GMP_RNDN); - if (mpfr_fits_uintmax_p (x, GMP_RNDN)) + mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN); + if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) ERROR1; - if (mpfr_fits_intmax_p (x, GMP_RNDN)) + if (mpfr_fits_intmax_p (x, MPFR_RNDN)) ERROR1; /* Check all other values */ - mpfr_set_uj (x, UINTMAX_MAX, GMP_RNDN); - mpfr_add_ui (x, x, 1, GMP_RNDN); - if (mpfr_fits_uintmax_p (x, GMP_RNDN)) + mpfr_set_uj (x, UINTMAX_MAX, MPFR_RNDN); + mpfr_add_ui (x, x, 1, MPFR_RNDN); + if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) ERROR1; - mpfr_set_uj (x, UINTMAX_MAX, GMP_RNDN); - if (!mpfr_fits_uintmax_p (x, GMP_RNDN)) + mpfr_set_uj (x, UINTMAX_MAX, MPFR_RNDN); + if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) ERROR2; - mpfr_set_sj (x, INTMAX_MAX, GMP_RNDN); - mpfr_add_ui (x, x, 1, GMP_RNDN); - if (mpfr_fits_intmax_p (x, GMP_RNDN)) + mpfr_set_sj (x, INTMAX_MAX, MPFR_RNDN); + mpfr_add_ui (x, x, 1, MPFR_RNDN); + if (mpfr_fits_intmax_p (x, MPFR_RNDN)) ERROR1; - mpfr_set_sj (x, INTMAX_MAX, GMP_RNDN); - if (!mpfr_fits_intmax_p (x, GMP_RNDN)) + mpfr_set_sj (x, INTMAX_MAX, MPFR_RNDN); + if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) ERROR2; - mpfr_set_sj (x, INTMAX_MIN, GMP_RNDN); - if (!mpfr_fits_intmax_p (x, GMP_RNDN)) + mpfr_set_sj (x, INTMAX_MIN, MPFR_RNDN); + if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) ERROR2; - mpfr_sub_ui (x, x, 1, GMP_RNDN); - if (mpfr_fits_intmax_p (x, GMP_RNDN)) + mpfr_sub_ui (x, x, 1, MPFR_RNDN); + if (mpfr_fits_intmax_p (x, MPFR_RNDN)) ERROR1; /* Check negative value */ - mpfr_set_si (x, -1, GMP_RNDN); - if (!mpfr_fits_intmax_p (x, GMP_RNDN)) + mpfr_set_si (x, -1, MPFR_RNDN); + if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) ERROR2; - if (mpfr_fits_uintmax_p (x, GMP_RNDN)) + if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) ERROR1; mpfr_clear (x); diff --git a/tests/tfma.c b/tests/tfma.c index 1df784167..3bb3e19b5 100644 --- a/tests/tfma.c +++ b/tests/tfma.c @@ -43,9 +43,9 @@ test_exact (void) for (k = 0; k < sv; k++) RND_LOOP (rnd) { - 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) || + if (mpfr_set_str (a, val[i], 10, MPFR_RNDN) || + mpfr_set_str (b, val[j], 10, MPFR_RNDN) || + mpfr_set_str (c, val[k], 10, MPFR_RNDN) || mpfr_mul (r1, a, b, (mp_rnd_t) rnd) || mpfr_add (r1, r1, c, (mp_rnd_t) rnd)) { @@ -70,9 +70,9 @@ test_exact (void) if (mpfr_cmp (r1, r2) || MPFR_SIGN (r1) != MPFR_SIGN (r2)) { printf ("test_exact(%d,%d,%d,%d):\nexpected ", i, j, k, rnd); - mpfr_out_str (stdout, 10, 0, r1, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, r1, MPFR_RNDN); printf ("\n got "); - mpfr_out_str (stdout, 10, 0, r2, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, r2, MPFR_RNDN); printf ("\n"); exit (1); } @@ -90,18 +90,18 @@ test_overflow1 (void) mpfr_inits2 (8, x, y, z, r, (mpfr_ptr) 0); MPFR_SET_POS (x); mpfr_setmax (x, mpfr_get_emax ()); /* x = 2^emax - ulp */ - mpfr_set_ui (y, 2, GMP_RNDN); /* y = 2 */ - mpfr_neg (z, x, GMP_RNDN); /* z = -x = -(2^emax - ulp) */ + mpfr_set_ui (y, 2, MPFR_RNDN); /* y = 2 */ + mpfr_neg (z, x, MPFR_RNDN); /* z = -x = -(2^emax - ulp) */ mpfr_clear_flags (); /* The intermediate multiplication x * y overflows, but x * y + z = x is representable. */ - inex = mpfr_fma (r, x, y, z, GMP_RNDN); + inex = mpfr_fma (r, x, y, z, MPFR_RNDN); if (inex || ! mpfr_equal_p (r, x)) { printf ("Error in test_overflow1\nexpected "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf (" with inex = 0\n got "); - mpfr_out_str (stdout, 2, 0, r, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, r, MPFR_RNDN); printf (" with inex = %d\n", inex); exit (1); } @@ -123,7 +123,7 @@ test_overflow2 (void) MPFR_SET_POS (x); mpfr_setmin (x, mpfr_get_emax ()); /* x = 0.1@emax */ - mpfr_set_si (y, -2, GMP_RNDN); /* y = -2 */ + mpfr_set_si (y, -2, MPFR_RNDN); /* y = -2 */ /* The intermediate multiplication x * y will overflow. */ for (i = -9; i <= 9; i++) @@ -131,10 +131,10 @@ test_overflow2 (void) { int inf, overflow; - inf = rnd == GMP_RNDN || rnd == GMP_RNDD || rnd == GMP_RNDA; + inf = rnd == MPFR_RNDN || rnd == MPFR_RNDD || rnd == MPFR_RNDA; overflow = inf || i <= 0; - inex = mpfr_set_si_2exp (z, i, mpfr_get_emin (), GMP_RNDN); + inex = mpfr_set_si_2exp (z, i, mpfr_get_emin (), MPFR_RNDN); MPFR_ASSERTN (inex == 0); mpfr_clear_flags (); @@ -209,12 +209,12 @@ test_underflow1 (void) for (signy = -1; signy <= 1; signy += 2) { - mpfr_set_si_2exp (y, signy, -1, GMP_RNDN); /* |y| = 1/2 */ + mpfr_set_si_2exp (y, signy, -1, MPFR_RNDN); /* |y| = 1/2 */ for (signz = -3; signz <= 3; signz += 2) { RND_LOOP (rnd) { - mpfr_set_si (z, signz, GMP_RNDN); + mpfr_set_si (z, signz, MPFR_RNDN); if (ABS (signz) != 1) mpfr_setmax (z, mpfr_get_emax ()); /* |z| = 1 or 2^emax - ulp */ @@ -253,18 +253,18 @@ test_underflow1 (void) printf ("\n"); err = 1; } - if (inex >= 0 && (rnd == GMP_RNDD || - (rnd == GMP_RNDZ && signz > 0) || - (rnd == GMP_RNDN && signy > 0))) + if (inex >= 0 && (rnd == MPFR_RNDD || + (rnd == MPFR_RNDZ && signz > 0) || + (rnd == MPFR_RNDN && signy > 0))) { printf (ERRTU1 "ternary value = %d instead of < 0\n", signy, signz, mpfr_print_rnd_mode ((mp_rnd_t) rnd), inex); err = 1; } - if (inex <= 0 && (rnd == GMP_RNDU || - (rnd == GMP_RNDZ && signz < 0) || - (rnd == GMP_RNDN && signy < 0))) + if (inex <= 0 && (rnd == MPFR_RNDU || + (rnd == MPFR_RNDZ && signz < 0) || + (rnd == MPFR_RNDN && signy < 0))) { printf (ERRTU1 "ternary value = %d instead of > 0\n", signy, signz, mpfr_print_rnd_mode ((mp_rnd_t) rnd), @@ -288,21 +288,21 @@ test_underflow2 (void) mpfr_inits2 (32, x, y, z, r, (mpfr_ptr) 0); - mpfr_set_si_2exp (z, 1, mpfr_get_emin (), GMP_RNDN); /* z = 2^emin */ - mpfr_set_si_2exp (x, 1, mpfr_get_emin (), GMP_RNDN); /* x = 2^emin */ + mpfr_set_si_2exp (z, 1, mpfr_get_emin (), MPFR_RNDN); /* z = 2^emin */ + mpfr_set_si_2exp (x, 1, mpfr_get_emin (), MPFR_RNDN); /* x = 2^emin */ for (b = 0; b <= 1; b++) { for (i = 15; i <= 17; i++) { - mpfr_set_si_2exp (y, i, -4 - MPFR_PREC (z), GMP_RNDN); + mpfr_set_si_2exp (y, i, -4 - MPFR_PREC (z), MPFR_RNDN); /* z = 1.000...00b * xy = 01111 * or 10000 * or 10001 */ mpfr_clear_flags (); - inex = mpfr_fma (r, x, y, z, GMP_RNDN); + inex = mpfr_fma (r, x, y, z, MPFR_RNDN); #define ERRTU2 "Error in test_underflow2 (b = %d, i = %d)\n " if (__gmpfr_flags != MPFR_FLAGS_INEXACT) { @@ -317,7 +317,7 @@ test_underflow2 (void) b, i, inex, same ? '<' : '>'); err = 1; } - mpfr_set (y, z, GMP_RNDN); + mpfr_set (y, z, MPFR_RNDN); if (!same) mpfr_nextabove (y); if (! mpfr_equal_p (r, y)) @@ -355,10 +355,10 @@ main (int argc, char *argv[]) mpfr_set_prec (y, 2); mpfr_set_prec (z, 2); mpfr_set_prec (s, 2); - mpfr_set_str (x, "-0.75", 10, GMP_RNDN); - mpfr_set_str (y, "0.5", 10, GMP_RNDN); - mpfr_set_str (z, "0.375", 10, GMP_RNDN); - mpfr_fma (s, x, y, z, GMP_RNDU); /* result is 0 */ + mpfr_set_str (x, "-0.75", 10, MPFR_RNDN); + mpfr_set_str (y, "0.5", 10, MPFR_RNDN); + mpfr_set_str (z, "0.375", 10, MPFR_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDU); /* result is 0 */ if (mpfr_cmp_ui(s, 0)) { printf("Error: -0.75 * 0.5 + 0.375 should be equal to 0 for prec=2\n"); @@ -370,9 +370,9 @@ main (int argc, char *argv[]) mpfr_set_prec (z, 27); mpfr_set_prec (s, 27); mpfr_set_str_binary (x, "1.11111111111111111111111111e-1"); - mpfr_set (y, x, GMP_RNDN); + mpfr_set (y, x, MPFR_RNDN); mpfr_set_str_binary (z, "-1.00011110100011001011001001e-1"); - if (mpfr_fma (s, x, y, z, GMP_RNDN) >= 0) + if (mpfr_fma (s, x, y, z, MPFR_RNDN) >= 0) { printf ("Wrong inexact flag for x=y=1-2^(-27)\n"); exit (1); @@ -381,7 +381,7 @@ main (int argc, char *argv[]) mpfr_set_nan (x); mpfr_urandomb (y, RANDS); mpfr_urandomb (z, RANDS); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { printf ("evaluation of function in x=NAN does not return NAN"); @@ -391,7 +391,7 @@ main (int argc, char *argv[]) mpfr_set_nan (y); mpfr_urandomb (x, RANDS); mpfr_urandomb (z, RANDS); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p(s)) { printf ("evaluation of function in y=NAN does not return NAN"); @@ -401,7 +401,7 @@ main (int argc, char *argv[]) mpfr_set_nan (z); mpfr_urandomb (y, RANDS); mpfr_urandomb (x, RANDS); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { printf ("evaluation of function in z=NAN does not return NAN"); @@ -411,7 +411,7 @@ main (int argc, char *argv[]) mpfr_set_inf (x, 1); mpfr_set_inf (y, 1); mpfr_set_inf (z, 1); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { printf ("Error for (+inf) * (+inf) + (+inf)\n"); @@ -421,7 +421,7 @@ main (int argc, char *argv[]) mpfr_set_inf (x, -1); mpfr_set_inf (y, -1); mpfr_set_inf (z, 1); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { printf ("Error for (-inf) * (-inf) + (+inf)\n"); @@ -431,7 +431,7 @@ main (int argc, char *argv[]) mpfr_set_inf (x, 1); mpfr_set_inf (y, -1); mpfr_set_inf (z, -1); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) > 0) { printf ("Error for (+inf) * (-inf) + (-inf)\n"); @@ -441,7 +441,7 @@ main (int argc, char *argv[]) mpfr_set_inf (x, -1); mpfr_set_inf (y, 1); mpfr_set_inf (z, -1); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) > 0) { printf ("Error for (-inf) * (+inf) + (-inf)\n"); @@ -449,9 +449,9 @@ main (int argc, char *argv[]) } mpfr_set_inf (x, 1); - mpfr_set_ui (y, 0, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); mpfr_urandomb (z, RANDS); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { printf ("evaluation of function in x=INF y=0 does not return NAN"); @@ -459,9 +459,9 @@ main (int argc, char *argv[]) } mpfr_set_inf (y, 1); - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_urandomb (z, RANDS); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { printf ("evaluation of function in x=0 y=INF does not return NAN"); @@ -471,7 +471,7 @@ main (int argc, char *argv[]) mpfr_set_inf (x, 1); mpfr_urandomb (y, RANDS); /* always positive */ mpfr_set_inf (z, -1); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { printf ("evaluation of function in x=INF y>0 z=-INF does not return NAN"); @@ -481,7 +481,7 @@ main (int argc, char *argv[]) mpfr_set_inf (y, 1); mpfr_urandomb (x, RANDS); mpfr_set_inf (z, -1); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { printf ("evaluation of function in x>0 y=INF z=-INF does not return NAN"); @@ -491,7 +491,7 @@ main (int argc, char *argv[]) mpfr_set_inf (x, 1); mpfr_urandomb (y, RANDS); mpfr_urandomb (z, RANDS); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { printf ("evaluation of function in x=INF does not return INF"); @@ -501,7 +501,7 @@ main (int argc, char *argv[]) mpfr_set_inf (y, 1); mpfr_urandomb (x, RANDS); mpfr_urandomb (z, RANDS); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { printf ("evaluation of function in y=INF does not return INF"); @@ -511,27 +511,27 @@ main (int argc, char *argv[]) mpfr_set_inf (z, 1); mpfr_urandomb (x, RANDS); mpfr_urandomb (y, RANDS); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { printf ("evaluation of function in z=INF does not return INF"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_urandomb (y, RANDS); mpfr_urandomb (z, RANDS); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (mpfr_cmp (s, z)) { printf ("evaluation of function in x=0 does not return z\n"); exit (1); } - mpfr_set_ui (y, 0, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); mpfr_urandomb (x, RANDS); mpfr_urandomb (z, RANDS); - mpfr_fma (s, x, y, z, GMP_RNDN); + mpfr_fma (s, x, y, z, MPFR_RNDN); if (mpfr_cmp (s, z)) { printf ("evaluation of function in y=0 does not return z\n"); @@ -567,11 +567,11 @@ main (int argc, char *argv[]) mpfr_urandomb (z, RANDS); if (randlimb () % 2) - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); if (randlimb () % 2) - mpfr_neg (y, y, GMP_RNDN); + mpfr_neg (y, y, MPFR_RNDN); if (randlimb () % 2) - mpfr_neg (z, z, GMP_RNDN); + mpfr_neg (z, z, MPFR_RNDN); rnd = RND_RAND (); mpfr_set_prec (slong, 2 * prec); @@ -585,18 +585,18 @@ main (int argc, char *argv[]) if (mpfr_cmp (s, t)) { printf ("results differ for x="); - mpfr_out_str (stdout, 2, prec, x, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN); printf (" y="); - mpfr_out_str (stdout, 2, prec, y, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, y, MPFR_RNDN); printf (" z="); - mpfr_out_str (stdout, 2, prec, z, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); printf (" prec=%u rnd_mode=%s\n", (unsigned int) prec, mpfr_print_rnd_mode (rnd)); printf ("got "); - mpfr_out_str (stdout, 2, prec, s, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, s, MPFR_RNDN); puts (""); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); puts (""); printf ("approx "); mpfr_print_binary (slong); @@ -609,10 +609,10 @@ main (int argc, char *argv[]) { printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n", mpfr_print_rnd_mode (rnd), compare, inexact); - printf (" x="); mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); - printf (" y="); mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); - printf (" z="); mpfr_out_str (stdout, 2, 0, z, GMP_RNDN); - printf (" s="); mpfr_out_str (stdout, 2, 0, s, GMP_RNDN); + printf (" x="); mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); + printf (" y="); mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); + printf (" z="); mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); + printf (" s="); mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN); printf ("\n"); exit (1); } diff --git a/tests/tfmod.c b/tests/tfmod.c index 32bf0d1d5..fc73a350c 100644 --- a/tests/tfmod.c +++ b/tests/tfmod.c @@ -57,10 +57,10 @@ slow_fmod (mpfr_ptr r, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd) then |x/y| < 2^(ex-ey+1) */ mpfr_init2 (q, MAX (MPFR_PREC_MIN, mpfr_get_exp (x) - mpfr_get_exp (y) + 1)); - mpfr_div (q, x, y, GMP_RNDZ); + mpfr_div (q, x, y, MPFR_RNDZ); mpfr_trunc (q, q); /* may change inexact flag */ - mpfr_prec_round (q, mpfr_get_prec (q) + mpfr_get_prec (y), GMP_RNDZ); - inexact = mpfr_mul (q, q, y, GMP_RNDZ); /* exact */ + mpfr_prec_round (q, mpfr_get_prec (q) + mpfr_get_prec (y), MPFR_RNDZ); + inexact = mpfr_mul (q, q, y, MPFR_RNDZ); /* exact */ inexact = mpfr_sub (r, x, q, rnd); mpfr_clear (q); return inexact; @@ -70,14 +70,14 @@ static void test_failed (mpfr_t erem, mpfr_t grem, mpfr_t x, mpfr_t y, mp_rnd_t rnd) { printf ("error : mpfr_fmod (r, x, y, rnd)\n x = "); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDD); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDD); printf ("\n y = "); - mpfr_out_str (stdout, 10, 0, y, GMP_RNDD); + mpfr_out_str (stdout, 10, 0, y, MPFR_RNDD); printf ("\nrnd = %s\n", mpfr_print_rnd_mode (rnd)); printf ("\n expected r = "); - mpfr_out_str (stdout, 10, 0, erem, GMP_RNDD); + mpfr_out_str (stdout, 10, 0, erem, MPFR_RNDD); printf ("\n got r = "); - mpfr_out_str (stdout, 10, 0, grem, GMP_RNDD); + mpfr_out_str (stdout, 10, 0, grem, MPFR_RNDD); putchar ('\n'); mpfr_clears (erem, grem, x, y, (mpfr_ptr) 0); @@ -109,9 +109,9 @@ special (void) /* NaN mod NaN is NaN */ mpfr_set_nan (x); mpfr_set_nan (y); - inexact = mpfr_fmod (r, x, y, GMP_RNDN); + inexact = mpfr_fmod (r, x, y, MPFR_RNDN); if (!mpfr_nan_p (r)) - test_failed (r, x, x, y, GMP_RNDN); + test_failed (r, x, x, y, MPFR_RNDN); if (inexact) { printf ("error : mpfr_fmod (NaN, NaN) should be exact\n"); @@ -119,10 +119,10 @@ special (void) } /* NaN mod +0 is NaN */ - mpfr_set_ui (y, 0, GMP_RNDN); - inexact = mpfr_fmod (r, x, y, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); + inexact = mpfr_fmod (r, x, y, MPFR_RNDN); if (!mpfr_nan_p (r)) - test_failed (r, x, x, y, GMP_RNDN); + test_failed (r, x, x, y, MPFR_RNDN); if (inexact) { printf ("error : mpfr_fmod (NaN, +0) should be exact\n"); @@ -130,10 +130,10 @@ special (void) } /* 3.1415 mod +0 is NaN */ - mpfr_set_d (x, 3.1415, GMP_RNDN); - inexact = mpfr_fmod (r, x, y, GMP_RNDN); + mpfr_set_d (x, 3.1415, MPFR_RNDN); + inexact = mpfr_fmod (r, x, y, MPFR_RNDN); if (!mpfr_nan_p (r)) - test_failed (r, x, x, y, GMP_RNDN); + test_failed (r, x, x, y, MPFR_RNDN); if (inexact) { printf ("error : mpfr_fmod (3.1415, NaN) should be exact\n"); @@ -142,9 +142,9 @@ special (void) /* 3.1415 mod +Inf is 3.1415 */ mpfr_set_inf (y, 1); - inexact = mpfr_fmod (r, x, y, GMP_RNDN); + inexact = mpfr_fmod (r, x, y, MPFR_RNDN); if (MPFR_IS_SINGULAR (r)) - test_failed (r, x, x, y, GMP_RNDN); + test_failed (r, x, x, y, MPFR_RNDN); if (inexact) { printf ("error : mpfr_fmod (3.1415, +Inf) should be exact\n"); @@ -174,27 +174,27 @@ main (int argc, char *argv[]) special (); /* remainder = 0 */ - mpfr_set_str (y, "FEDCBA987654321p-64", 16, GMP_RNDN); - mpfr_pow_ui (x, y, 42, GMP_RNDN); - check (r, x, y, GMP_RNDN); + mpfr_set_str (y, "FEDCBA987654321p-64", 16, MPFR_RNDN); + mpfr_pow_ui (x, y, 42, MPFR_RNDN); + check (r, x, y, MPFR_RNDN); /* x < y */ - mpfr_mul_d (x, y, .12345, GMP_RNDN); - check (r, x, y, GMP_RNDN); + mpfr_mul_d (x, y, .12345, MPFR_RNDN); + check (r, x, y, MPFR_RNDN); /* sign(x) = sign (r) */ - mpfr_set_str (x, "123798", 10, GMP_RNDN); - mpfr_set_str (y, "10", 10, GMP_RNDN); - check (r, x, y, GMP_RNDN); + mpfr_set_str (x, "123798", 10, MPFR_RNDN); + mpfr_set_str (y, "10", 10, MPFR_RNDN); + check (r, x, y, MPFR_RNDN); /* huge difference between precisions */ mpfr_set_prec (x, 314); - mpfr_const_pi (x, GMP_RNDD); /* x = pi */ + mpfr_const_pi (x, MPFR_RNDD); /* x = pi */ mpfr_set_prec (y, 8); - mpfr_set_ui (y, 1, GMP_RNDD); - mpfr_div_2ui (y, y, 3, GMP_RNDD); /* y = 1/8 */ + mpfr_set_ui (y, 1, MPFR_RNDD); + mpfr_div_2ui (y, y, 3, MPFR_RNDD); /* y = 1/8 */ mpfr_set_prec (r, 123); - check (r, x, y, GMP_RNDD); + check (r, x, y, MPFR_RNDD); mpfr_clears (x, y, r, (mpfr_ptr) 0); tests_end_mpfr (); diff --git a/tests/tfms.c b/tests/tfms.c index b7d9d4827..0cfb3688a 100644 --- a/tests/tfms.c +++ b/tests/tfms.c @@ -43,9 +43,9 @@ test_exact (void) for (k = 0; k < sv; k++) RND_LOOP (rnd) { - 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) || + if (mpfr_set_str (a, val[i], 10, MPFR_RNDN) || + mpfr_set_str (b, val[j], 10, MPFR_RNDN) || + mpfr_set_str (c, val[k], 10, MPFR_RNDN) || mpfr_mul (r1, a, b, (mp_rnd_t) rnd) || mpfr_sub (r1, r1, c, (mp_rnd_t) rnd)) { @@ -70,9 +70,9 @@ test_exact (void) if (mpfr_cmp (r1, r2) || MPFR_SIGN (r1) != MPFR_SIGN (r2)) { printf ("test_exact(%d,%d,%d,%d):\nexpected ", i, j, k, rnd); - mpfr_out_str (stdout, 10, 0, r1, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, r1, MPFR_RNDN); printf ("\n got "); - mpfr_out_str (stdout, 10, 0, r2, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, r2, MPFR_RNDN); printf ("\n"); exit (1); } @@ -90,18 +90,18 @@ test_overflow1 (void) mpfr_inits2 (8, x, y, z, r, (mpfr_ptr) 0); MPFR_SET_POS (x); mpfr_setmax (x, mpfr_get_emax ()); /* x = 2^emax - ulp */ - mpfr_set_ui (y, 2, GMP_RNDN); /* y = 2 */ - mpfr_set (z, x, GMP_RNDN); /* z = x = 2^emax - ulp */ + mpfr_set_ui (y, 2, MPFR_RNDN); /* y = 2 */ + mpfr_set (z, x, MPFR_RNDN); /* z = x = 2^emax - ulp */ mpfr_clear_flags (); /* The intermediate multiplication x * y overflows, but x * y - z = x is representable. */ - inex = mpfr_fms (r, x, y, z, GMP_RNDN); + inex = mpfr_fms (r, x, y, z, MPFR_RNDN); if (inex || ! mpfr_equal_p (r, x)) { printf ("Error in test_overflow1\nexpected "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf (" with inex = 0\n got "); - mpfr_out_str (stdout, 2, 0, r, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, r, MPFR_RNDN); printf (" with inex = %d\n", inex); exit (1); } @@ -123,7 +123,7 @@ test_overflow2 (void) MPFR_SET_POS (x); mpfr_setmin (x, mpfr_get_emax ()); /* x = 0.1@emax */ - mpfr_set_si (y, -2, GMP_RNDN); /* y = -2 */ + mpfr_set_si (y, -2, MPFR_RNDN); /* y = -2 */ /* The intermediate multiplication x * y will overflow. */ for (i = -9; i <= 9; i++) @@ -131,10 +131,10 @@ test_overflow2 (void) { int inf, overflow; - inf = rnd == GMP_RNDN || rnd == GMP_RNDD || rnd == GMP_RNDA; + inf = rnd == MPFR_RNDN || rnd == MPFR_RNDD || rnd == MPFR_RNDA; overflow = inf || i <= 0; - inex = mpfr_set_si_2exp (z, -i, mpfr_get_emin (), GMP_RNDN); + inex = mpfr_set_si_2exp (z, -i, mpfr_get_emin (), MPFR_RNDN); MPFR_ASSERTN (inex == 0); mpfr_clear_flags (); @@ -209,12 +209,12 @@ test_underflow1 (void) for (signy = -1; signy <= 1; signy += 2) { - mpfr_set_si_2exp (y, signy, -1, GMP_RNDN); /* |y| = 1/2 */ + mpfr_set_si_2exp (y, signy, -1, MPFR_RNDN); /* |y| = 1/2 */ for (signz = -3; signz <= 3; signz += 2) { RND_LOOP (rnd) { - mpfr_set_si (z, signz, GMP_RNDN); + mpfr_set_si (z, signz, MPFR_RNDN); if (ABS (signz) != 1) mpfr_setmax (z, mpfr_get_emax ()); /* |z| = 1 or 2^emax - ulp */ @@ -227,7 +227,7 @@ test_underflow1 (void) mpfr_print_rnd_mode ((mp_rnd_t) rnd)); err = 1; } - mpfr_neg (z, z, GMP_RNDN); + mpfr_neg (z, z, MPFR_RNDN); if (signy < 0 && MPFR_IS_LIKE_RNDD(rnd, -signz)) mpfr_nextbelow (z); if (signy > 0 && MPFR_IS_LIKE_RNDU(rnd, -signz)) @@ -254,18 +254,18 @@ test_underflow1 (void) printf ("\n"); err = 1; } - if (inex >= 0 && (rnd == GMP_RNDD || - (rnd == GMP_RNDZ && signz < 0) || - (rnd == GMP_RNDN && signy > 0))) + if (inex >= 0 && (rnd == MPFR_RNDD || + (rnd == MPFR_RNDZ && signz < 0) || + (rnd == MPFR_RNDN && signy > 0))) { printf (ERRTU1 "ternary value = %d instead of < 0\n", signy, signz, mpfr_print_rnd_mode ((mp_rnd_t) rnd), inex); err = 1; } - if (inex <= 0 && (rnd == GMP_RNDU || - (rnd == GMP_RNDZ && signz > 0) || - (rnd == GMP_RNDN && signy < 0))) + if (inex <= 0 && (rnd == MPFR_RNDU || + (rnd == MPFR_RNDZ && signz > 0) || + (rnd == MPFR_RNDN && signy < 0))) { printf (ERRTU1 "ternary value = %d instead of > 0\n", signy, signz, mpfr_print_rnd_mode ((mp_rnd_t) rnd), @@ -289,21 +289,21 @@ test_underflow2 (void) mpfr_inits2 (32, x, y, z, r, (mpfr_ptr) 0); - mpfr_set_si_2exp (z, -1, mpfr_get_emin (), GMP_RNDN); /* z = -2^emin */ - mpfr_set_si_2exp (x, 1, mpfr_get_emin (), GMP_RNDN); /* x = 2^emin */ + mpfr_set_si_2exp (z, -1, mpfr_get_emin (), MPFR_RNDN); /* z = -2^emin */ + mpfr_set_si_2exp (x, 1, mpfr_get_emin (), MPFR_RNDN); /* x = 2^emin */ for (b = 0; b <= 1; b++) { for (i = 15; i <= 17; i++) { - mpfr_set_si_2exp (y, i, -4 - MPFR_PREC (z), GMP_RNDN); + mpfr_set_si_2exp (y, i, -4 - MPFR_PREC (z), MPFR_RNDN); /* z = -1.000...00b * xy = 01111 * or 10000 * or 10001 */ mpfr_clear_flags (); - inex = mpfr_fms (r, x, y, z, GMP_RNDN); + inex = mpfr_fms (r, x, y, z, MPFR_RNDN); #define ERRTU2 "Error in test_underflow2 (b = %d, i = %d)\n " if (__gmpfr_flags != MPFR_FLAGS_INEXACT) { @@ -318,7 +318,7 @@ test_underflow2 (void) b, i, inex, same ? '<' : '>'); err = 1; } - mpfr_neg (y, z, GMP_RNDN); + mpfr_neg (y, z, MPFR_RNDN); if (!same) mpfr_nextabove (y); if (! mpfr_equal_p (r, y)) @@ -356,10 +356,10 @@ main (int argc, char *argv[]) mpfr_set_prec (y, 2); mpfr_set_prec (z, 2); mpfr_set_prec (s, 2); - mpfr_set_str (x, "-0.75", 10, GMP_RNDN); - mpfr_set_str (y, "0.5", 10, GMP_RNDN); - mpfr_set_str (z, "-0.375", 10, GMP_RNDN); - mpfr_fms (s, x, y, z, GMP_RNDU); /* result is 0 */ + mpfr_set_str (x, "-0.75", 10, MPFR_RNDN); + mpfr_set_str (y, "0.5", 10, MPFR_RNDN); + mpfr_set_str (z, "-0.375", 10, MPFR_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDU); /* result is 0 */ if (mpfr_cmp_ui(s, 0)) { printf("Error: -0.75 * 0.5 - -0.375 should be equal to 0 for prec=2\n"); @@ -371,9 +371,9 @@ main (int argc, char *argv[]) mpfr_set_prec (z, 27); mpfr_set_prec (s, 27); mpfr_set_str_binary (x, "1.11111111111111111111111111e-1"); - mpfr_set (y, x, GMP_RNDN); + mpfr_set (y, x, MPFR_RNDN); mpfr_set_str_binary (z, "1.00011110100011001011001001e-1"); - if (mpfr_fms (s, x, y, z, GMP_RNDN) >= 0) + if (mpfr_fms (s, x, y, z, MPFR_RNDN) >= 0) { printf ("Wrong inexact flag for x=y=1-2^(-27)\n"); exit (1); @@ -382,7 +382,7 @@ main (int argc, char *argv[]) mpfr_set_nan (x); mpfr_urandomb (y, RANDS); mpfr_urandomb (z, RANDS); - mpfr_fms (s, x, y, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { printf ("evaluation of function in x=NAN does not return NAN"); @@ -392,7 +392,7 @@ main (int argc, char *argv[]) mpfr_set_nan (y); mpfr_urandomb (x, RANDS); mpfr_urandomb (z, RANDS); - mpfr_fms (s, x, y, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p(s)) { printf ("evaluation of function in y=NAN does not return NAN"); @@ -402,7 +402,7 @@ main (int argc, char *argv[]) mpfr_set_nan (z); mpfr_urandomb (y, RANDS); mpfr_urandomb (x, RANDS); - mpfr_fms (s, x, y, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { printf ("evaluation of function in z=NAN does not return NAN"); @@ -412,7 +412,7 @@ main (int argc, char *argv[]) mpfr_set_inf (x, 1); mpfr_set_inf (y, 1); mpfr_set_inf (z, -1); - mpfr_fms (s, x, y, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { printf ("Error for (+inf) * (+inf) - (-inf)\n"); @@ -422,7 +422,7 @@ main (int argc, char *argv[]) mpfr_set_inf (x, -1); mpfr_set_inf (y, -1); mpfr_set_inf (z, -1); - mpfr_fms (s, x, y, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { printf ("Error for (-inf) * (-inf) - (-inf)\n"); @@ -432,7 +432,7 @@ main (int argc, char *argv[]) mpfr_set_inf (x, 1); mpfr_set_inf (y, -1); mpfr_set_inf (z, 1); - mpfr_fms (s, x, y, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) > 0) { printf ("Error for (+inf) * (-inf) - (+inf)\n"); @@ -442,7 +442,7 @@ main (int argc, char *argv[]) mpfr_set_inf (x, -1); mpfr_set_inf (y, 1); mpfr_set_inf (z, 1); - mpfr_fms (s, x, y, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) > 0) { printf ("Error for (-inf) * (+inf) - (+inf)\n"); @@ -450,9 +450,9 @@ main (int argc, char *argv[]) } mpfr_set_inf (x, 1); - mpfr_set_ui (y, 0, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); mpfr_urandomb (z, RANDS); - mpfr_fms (s, x, y, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { printf ("evaluation of function in x=INF y=0 does not return NAN"); @@ -460,9 +460,9 @@ main (int argc, char *argv[]) } mpfr_set_inf (y, 1); - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_urandomb (z, RANDS); - mpfr_fms (s, x, y, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { printf ("evaluation of function in x=0 y=INF does not return NAN"); @@ -472,7 +472,7 @@ main (int argc, char *argv[]) mpfr_set_inf (x, 1); mpfr_urandomb (y, RANDS); /* always positive */ mpfr_set_inf (z, 1); - mpfr_fms (s, x, y, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { printf ("evaluation of function in x=INF y>0 z=INF does not return NAN"); @@ -482,7 +482,7 @@ main (int argc, char *argv[]) mpfr_set_inf (y, 1); mpfr_urandomb (x, RANDS); mpfr_set_inf (z, 1); - mpfr_fms (s, x, y, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { printf ("evaluation of function in x>0 y=INF z=INF does not return NAN"); @@ -492,7 +492,7 @@ main (int argc, char *argv[]) mpfr_set_inf (x, 1); mpfr_urandomb (y, RANDS); mpfr_urandomb (z, RANDS); - mpfr_fms (s, x, y, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { printf ("evaluation of function in x=INF does not return INF"); @@ -502,7 +502,7 @@ main (int argc, char *argv[]) mpfr_set_inf (y, 1); mpfr_urandomb (x, RANDS); mpfr_urandomb (z, RANDS); - mpfr_fms (s, x, y, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { printf ("evaluation of function in y=INF does not return INF"); @@ -512,29 +512,29 @@ main (int argc, char *argv[]) mpfr_set_inf (z, -1); mpfr_urandomb (x, RANDS); mpfr_urandomb (y, RANDS); - mpfr_fms (s, x, y, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { printf ("evaluation of function in z=-INF does not return INF"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_urandomb (y, RANDS); mpfr_urandomb (z, RANDS); - mpfr_fms (s, x, y, z, GMP_RNDN); - mpfr_neg (z, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); + mpfr_neg (z, z, MPFR_RNDN); if (mpfr_cmp (s, z)) { printf ("evaluation of function in x=0 does not return -z\n"); exit (1); } - mpfr_set_ui (y, 0, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); mpfr_urandomb (x, RANDS); mpfr_urandomb (z, RANDS); - mpfr_fms (s, x, y, z, GMP_RNDN); - mpfr_neg (z, z, GMP_RNDN); + mpfr_fms (s, x, y, z, MPFR_RNDN); + mpfr_neg (z, z, MPFR_RNDN); if (mpfr_cmp (s, z)) { printf ("evaluation of function in y=0 does not return -z\n"); @@ -570,11 +570,11 @@ main (int argc, char *argv[]) mpfr_urandomb (z, RANDS); if (randlimb () % 2) - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); if (randlimb () % 2) - mpfr_neg (y, y, GMP_RNDN); + mpfr_neg (y, y, MPFR_RNDN); if (randlimb () % 2) - mpfr_neg (z, z, GMP_RNDN); + mpfr_neg (z, z, MPFR_RNDN); rnd = RND_RAND (); mpfr_set_prec (slong, 2 * prec); @@ -588,18 +588,18 @@ main (int argc, char *argv[]) if (mpfr_cmp (s, t)) { printf ("results differ for x="); - mpfr_out_str (stdout, 2, prec, x, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN); printf (" y="); - mpfr_out_str (stdout, 2, prec, y, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, y, MPFR_RNDN); printf (" z="); - mpfr_out_str (stdout, 2, prec, z, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); printf (" prec=%u rnd_mode=%s\n", (unsigned int) prec, mpfr_print_rnd_mode (rnd)); printf ("got "); - mpfr_out_str (stdout, 2, prec, s, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, s, MPFR_RNDN); puts (""); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); puts (""); printf ("approx "); mpfr_print_binary (slong); @@ -612,10 +612,10 @@ main (int argc, char *argv[]) { printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n", mpfr_print_rnd_mode (rnd), compare, inexact); - printf (" x="); mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); - printf (" y="); mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); - printf (" z="); mpfr_out_str (stdout, 2, 0, z, GMP_RNDN); - printf (" s="); mpfr_out_str (stdout, 2, 0, s, GMP_RNDN); + printf (" x="); mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); + printf (" y="); mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); + printf (" z="); mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); + printf (" s="); mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN); printf ("\n"); exit (1); } diff --git a/tests/tfprintf.c b/tests/tfprintf.c index 45fc4b4f3..3ba44a825 100644 --- a/tests/tfprintf.c +++ b/tests/tfprintf.c @@ -160,7 +160,7 @@ check_mixed (FILE *fout) mpz_t mpz; mpq_t mpq; mpf_t mpf; - mp_rnd_t rnd = GMP_RNDN; + mp_rnd_t rnd = MPFR_RNDN; mp_size_t limb_size = 3; mp_limb_t limb[3]; @@ -176,7 +176,7 @@ check_mixed (FILE *fout) mpf_set_q (mpf, mpq); mpfr_init2 (mpfr, prec); - mpfr_set_f (mpfr, mpf, GMP_RNDN); + mpfr_set_f (mpfr, mpf, MPFR_RNDN); limb[0] = limb[1] = limb[2] = ~ (mp_limb_t) 0; diff --git a/tests/tfrac.c b/tests/tfrac.c index 029e3506f..ae8501144 100644 --- a/tests/tfrac.c +++ b/tests/tfrac.c @@ -45,7 +45,7 @@ check0 (mpfr_ptr ip, mpfr_ptr fp, mp_prec_t prec, mp_rnd_t rnd) printf ("Internal error (1)\n"); exit (1); } - if (mpfr_add (sum, ip, fp, GMP_RNDZ)) + if (mpfr_add (sum, ip, fp, MPFR_RNDZ)) { printf ("Wrong inexact flag in mpfr_add\n"); exit (1); @@ -61,7 +61,7 @@ check0 (mpfr_ptr ip, mpfr_ptr fp, mp_prec_t prec, mp_rnd_t rnd) if (inex1 != inex2) { printf ("Wrong inexact flag in mpfr_frac for\n"); - mpfr_out_str (stdout, 2, 0, sum, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, sum, MPFR_RNDN); printf ("\nGot %d instead of %d\n", inex1, inex2); exit (1); } @@ -71,11 +71,11 @@ check0 (mpfr_ptr ip, mpfr_ptr fp, mp_prec_t prec, mp_rnd_t rnd) { printf ("Error in mpfr_frac (y, x, %s) with\nx = ", mpfr_print_rnd_mode (rnd)); - mpfr_out_str (stdout, 2, 0, sum, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, sum, MPFR_RNDN); printf ("\nGot "); - mpfr_out_str (stdout, 2, 0, dst, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, dst, MPFR_RNDN); printf ("\ninstead of "); - mpfr_out_str (stdout, 2, 0, fp2, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, fp2, MPFR_RNDN); printf ("\n"); exit (1); } @@ -94,12 +94,12 @@ check0 (mpfr_ptr ip, mpfr_ptr fp, mp_prec_t prec, mp_rnd_t rnd) { printf ("Error in mpfr_frac (x, x, %s) with\nx = ", mpfr_print_rnd_mode (rnd)); - mpfr_add (tmp, ip, fp, GMP_RNDZ); - mpfr_out_str (stdout, 2, 0, tmp, GMP_RNDN); + mpfr_add (tmp, ip, fp, MPFR_RNDZ); + mpfr_out_str (stdout, 2, 0, tmp, MPFR_RNDN); printf ("\nGot "); - mpfr_out_str (stdout, 2, 0, sum, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, sum, MPFR_RNDN); printf ("\ninstead of "); - mpfr_out_str (stdout, 2, 0, fp, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, fp, MPFR_RNDN); printf ("\n"); exit (1); } @@ -116,16 +116,16 @@ check1 (mpfr_ptr ip, mpfr_ptr fp) { int rnd; - for (rnd = 0; rnd < GMP_RND_MAX ; rnd++) + for (rnd = 0; rnd < MPFR_RND_MAX ; rnd++) { check0 (ip, fp, PMAX, (mp_rnd_t) rnd); check0 (ip, fp, 70, (mp_rnd_t) rnd); - mpfr_neg (fp, fp, GMP_RNDN); - mpfr_neg (ip, ip, GMP_RNDN); + mpfr_neg (fp, fp, MPFR_RNDN); + mpfr_neg (ip, ip, MPFR_RNDN); check0 (ip, fp, PMAX, (mp_rnd_t) rnd); check0 (ip, fp, 70, (mp_rnd_t) rnd); - mpfr_neg (fp, fp, GMP_RNDN); - mpfr_neg (ip, ip, GMP_RNDN); + mpfr_neg (fp, fp, MPFR_RNDN); + mpfr_neg (ip, ip, MPFR_RNDN); } } @@ -138,7 +138,7 @@ special (void) mpfr_init (t); mpfr_set_nan (z); - mpfr_frac (t, z, GMP_RNDN); + mpfr_frac (t, z, MPFR_RNDN); if (!mpfr_nan_p (t)) { printf ("Error for frac(NaN)\n"); @@ -149,7 +149,7 @@ special (void) mpfr_set_prec (t, 3); mpfr_set_str_binary (z, "0.101101E3"); - mpfr_frac (t, z, GMP_RNDN); + mpfr_frac (t, z, MPFR_RNDN); mpfr_set_str_binary (z, "0.101"); if (mpfr_cmp (t, z)) { @@ -160,7 +160,7 @@ special (void) mpfr_set_prec (z, 34); mpfr_set_prec (t, 26); mpfr_set_str_binary (z, "0.101101010000010011110011001101E9"); - mpfr_frac (t, z, GMP_RNDN); + mpfr_frac (t, z, MPFR_RNDN); mpfr_set_str_binary (z, "0.000010011110011001101"); if (mpfr_cmp (t, z)) { @@ -192,36 +192,36 @@ main (void) { if (ni <= 0) { /* ni + 1 */ - mpfr_set_si (ip, ni, GMP_RNDN); - mpfr_add_ui (ip, ip, 1, GMP_RNDN); + mpfr_set_si (ip, ni, MPFR_RNDN); + mpfr_add_ui (ip, ip, 1, MPFR_RNDN); } else { /* 2^ni + 1 */ - mpfr_set_ui (ip, 1, GMP_RNDN); - mpfr_mul_2ui (ip, ip, ni, GMP_RNDN); - mpfr_add_ui (ip, ip, 1, GMP_RNDN); + mpfr_set_ui (ip, 1, MPFR_RNDN); + mpfr_mul_2ui (ip, ip, ni, MPFR_RNDN); + mpfr_add_ui (ip, ip, 1, MPFR_RNDN); } - mpfr_set_ui (fp, 0, GMP_RNDN); + mpfr_set_ui (fp, 0, MPFR_RNDN); check1 (ip, fp); for (nf1 = 1; nf1 < PFP; nf1++) { - mpfr_set_ui (fp, 1, GMP_RNDN); - mpfr_div_2ui (fp, fp, nf1, GMP_RNDN); + mpfr_set_ui (fp, 1, MPFR_RNDN); + mpfr_div_2ui (fp, fp, nf1, MPFR_RNDN); check1 (ip, fp); nf2 = 1 + (randlimb () % (PFP - 1)); - mpfr_set_ui (fp, 1, GMP_RNDN); - mpfr_div_2ui (fp, fp, nf2, GMP_RNDN); - mpfr_add_ui (fp, fp, 1, GMP_RNDN); - mpfr_div_2ui (fp, fp, nf1, GMP_RNDN); + mpfr_set_ui (fp, 1, MPFR_RNDN); + mpfr_div_2ui (fp, fp, nf2, MPFR_RNDN); + mpfr_add_ui (fp, fp, 1, MPFR_RNDN); + mpfr_div_2ui (fp, fp, nf1, MPFR_RNDN); check1 (ip, fp); } } - mpfr_set_ui (ip, 1, GMP_RNDN); - mpfr_div_ui (ip, ip, 0, GMP_RNDN); - mpfr_set_ui (fp, 0, GMP_RNDN); + mpfr_set_ui (ip, 1, MPFR_RNDN); + mpfr_div_ui (ip, ip, 0, MPFR_RNDN); + mpfr_set_ui (fp, 0, MPFR_RNDN); check1 (ip, fp); /* test infinities */ mpfr_clear (ip); diff --git a/tests/tgamma.c b/tests/tgamma.c index 8ccf10c89..54ee2e675 100644 --- a/tests/tgamma.c +++ b/tests/tgamma.c @@ -39,7 +39,7 @@ special (void) mpfr_init (y); mpfr_set_nan (x); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error for gamma(NaN)\n"); @@ -47,7 +47,7 @@ special (void) } mpfr_set_inf (x, -1); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error for gamma(-Inf)\n"); @@ -55,40 +55,40 @@ special (void) } mpfr_set_inf (x, 1); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error for gamma(+Inf)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error for gamma(+0)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0) { printf ("Error for gamma(-0)\n"); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { printf ("Error for gamma(1)\n"); exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error for gamma(-1)\n"); @@ -101,9 +101,9 @@ special (void) #define CHECK_X1 "1.0762904832837976166" #define CHECK_Y1 "0.96134843256452096050" - mpfr_set_str (x, CHECK_X1, 10, GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDN); - mpfr_set_str (x, CHECK_Y1, 10, GMP_RNDN); + mpfr_set_str (x, CHECK_X1, 10, MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); + mpfr_set_str (x, CHECK_Y1, 10, MPFR_RNDN); if (mpfr_cmp (y, x)) { printf ("mpfr_lngamma("CHECK_X1") is wrong:\n" @@ -116,9 +116,9 @@ special (void) #define CHECK_X2 "9.23709516716202383435e-01" #define CHECK_Y2 "1.0502315560291053398" - mpfr_set_str (x, CHECK_X2, 10, GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDN); - mpfr_set_str (x, CHECK_Y2, 10, GMP_RNDN); + mpfr_set_str (x, CHECK_X2, 10, MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); + mpfr_set_str (x, CHECK_Y2, 10, MPFR_RNDN); if (mpfr_cmp (y, x)) { printf ("mpfr_lngamma("CHECK_X2") is wrong:\n" @@ -131,8 +131,8 @@ special (void) mpfr_set_prec (x, 8); mpfr_set_prec (y, 175); - mpfr_set_ui (x, 33, GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDU); + mpfr_set_ui (x, 33, MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDU); mpfr_set_prec (x, 175); mpfr_set_str_binary (x, "0.110010101011010101101000010101010111000110011101001000101011000001100010111001101001011E118"); if (mpfr_cmp (x, y)) @@ -143,8 +143,8 @@ special (void) mpfr_set_prec (x, 21); mpfr_set_prec (y, 8); - mpfr_set_ui (y, 120, GMP_RNDN); - mpfr_gamma (x, y, GMP_RNDZ); + mpfr_set_ui (y, 120, MPFR_RNDN); + mpfr_gamma (x, y, MPFR_RNDZ); mpfr_set_prec (y, 21); mpfr_set_str_binary (y, "0.101111101110100110110E654"); if (mpfr_cmp (x, y)) @@ -158,7 +158,7 @@ special (void) mpfr_set_prec (x, 3); mpfr_set_prec (y, 206); mpfr_set_str_binary (x, "0.110e10"); - inex = mpfr_gamma (y, x, GMP_RNDN); + inex = mpfr_gamma (y, x, MPFR_RNDN); mpfr_set_prec (x, 206); mpfr_set_str_binary (x, "0.110111100001000001101010010001000111000100000100111000010011100011011111001100011110101000111101101100110001001100110100001001111110000101010000100100011100010011101110000001000010001100010000101001111E6250"); if (mpfr_cmp (x, y)) @@ -175,13 +175,13 @@ special (void) /* worst case to exercise retry */ mpfr_set_prec (x, 1000); mpfr_set_prec (y, 869); - mpfr_const_pi (x, GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_const_pi (x, MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); mpfr_set_prec (x, 4); mpfr_set_prec (y, 4); mpfr_set_str_binary (x, "-0.1100E-66"); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "-0.1011E67"); if (mpfr_cmp (x, y)) { @@ -209,7 +209,7 @@ special_overflow (void) mpfr_init2 (x, 24); mpfr_init2 (y, 24); mpfr_set_str_binary (x, "0.101100100000000000110100E7"); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); if (!mpfr_inf_p (y)) { printf ("Overflow error.\n"); @@ -220,8 +220,8 @@ special_overflow (void) /* problem mentioned by Kenneth Wilder, 18 Aug 2005 */ mpfr_set_prec (x, 29); mpfr_set_prec (y, 29); - mpfr_set_str (x, "-200000000.5", 10, GMP_RNDN); /* exact */ - mpfr_gamma (y, x, GMP_RNDN); + mpfr_set_str (x, "-200000000.5", 10, MPFR_RNDN); /* exact */ + mpfr_gamma (y, x, MPFR_RNDN); if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0)) { printf ("Error for gamma(-200000000.5)\n"); @@ -233,8 +233,8 @@ special_overflow (void) mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); - mpfr_set_str (x, "-200000000.1", 10, GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_set_str (x, "-200000000.1", 10, MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0)) { printf ("Error for gamma(-200000000.1), prec=53\n"); @@ -247,8 +247,8 @@ special_overflow (void) /* another problem mentioned by Kenneth Wilder, 29 Aug 2005 */ mpfr_set_prec (x, 333); mpfr_set_prec (y, 14); - mpfr_set_str (x, "-2.0000000000000000000000005", 10, GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_set_str (x, "-2.0000000000000000000000005", 10, MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); mpfr_set_prec (x, 14); mpfr_set_str_binary (x, "-11010011110001E66"); if (mpfr_cmp (x, y)) @@ -265,7 +265,7 @@ special_overflow (void) mpfr_set_prec (x, 38); mpfr_set_prec (y, 54); mpfr_set_str_binary (x, "0.11101111011100111101001001010110101001E-166"); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); mpfr_set_prec (x, 54); mpfr_set_str_binary (x, "0.100010001101100001110110001010111111010000100101011E167"); if (mpfr_cmp (x, y)) @@ -282,7 +282,7 @@ special_overflow (void) mpfr_set_prec (y, 71); mpfr_set_str_binary (x, "10101011011100001111111000010111110010E-1034"); /* 184083777010*2^(-1034) */ - mpfr_gamma (y, x, GMP_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); mpfr_set_prec (x, 71); mpfr_set_str_binary (x, "10111111001000011110010001000000000000110011110000000011101011111111100E926"); /* 1762885132679550982140*2^926 */ @@ -298,7 +298,7 @@ special_overflow (void) mpfr_set_prec (y, 88); mpfr_set_str_binary (x, "10111100111001010000100001100100100101E-104"); /* 202824096037*2^(-104) */ - mpfr_gamma (y, x, GMP_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); mpfr_set_prec (x, 88); mpfr_set_str_binary (x, "1010110101111000111010111100010110101010100110111000001011000111000011101100001101110010E-21"); /* 209715199999500283894743922*2^(-21) */ @@ -313,12 +313,12 @@ special_overflow (void) mpfr_set_prec (x, 171); mpfr_set_prec (y, 38); mpfr_set_str (x, "-2993155353253689176481146537402947624254601559176535", 10, - GMP_RNDN); - mpfr_div_2exp (x, x, 170, GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDN); + MPFR_RNDN); + mpfr_div_2exp (x, x, 170, MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); mpfr_set_prec (x, 38); - mpfr_set_str (x, "201948391737", 10, GMP_RNDN); - mpfr_mul_2exp (x, x, 92, GMP_RNDN); + mpfr_set_str (x, "201948391737", 10, MPFR_RNDN); + mpfr_mul_2exp (x, x, 92, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("Error for gamma (test 5)\n"); @@ -331,10 +331,10 @@ special_overflow (void) mpfr_set_prec (x, 337); mpfr_set_prec (y, 38); mpfr_set_str (x, "-30000.000000000000000000000000000000000000000000001", 10, - GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDN); + MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); mpfr_set_prec (x, 38); - mpfr_set_str (x, "-3.623795987425E-121243", 10, GMP_RNDN); + mpfr_set_str (x, "-3.623795987425E-121243", 10, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("Error for gamma (test 7)\n"); @@ -347,8 +347,8 @@ special_overflow (void) set_emin (emin); mpfr_set_prec (x, 71); mpfr_set_prec (y, 71); - mpfr_set_str (x, "-200000000.1", 10, GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_set_str (x, "-200000000.1", 10, MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0)) { printf ("Error for gamma (test 8)\n"); @@ -360,8 +360,8 @@ special_overflow (void) set_emax (1073741823); mpfr_set_prec (x, 29); mpfr_set_prec (y, 29); - mpfr_set_str (x, "423786866", 10, GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDN); + mpfr_set_str (x, "423786866", 10, MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error for gamma(423786866)\n"); @@ -370,8 +370,8 @@ special_overflow (void) /* check exact result */ mpfr_set_prec (x, 2); - mpfr_set_ui (x, 3, GMP_RNDN); - inex = mpfr_gamma (x, x, GMP_RNDN); + mpfr_set_ui (x, 3, MPFR_RNDN); + inex = mpfr_gamma (x, x, MPFR_RNDN); if (inex != 0 || mpfr_cmp_ui (x, 2) != 0) { printf ("Error for gamma(3)\n"); @@ -382,7 +382,7 @@ special_overflow (void) mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); mpfr_set_str_binary (x, "101010110100110011111010000110001000111100000110101E-43"); - mpfr_gamma (x, x, GMP_RNDU); + mpfr_gamma (x, x, MPFR_RNDU); mpfr_set_str_binary (y, "110000011110001000111110110101011110000100001111111E971"); if (mpfr_cmp (x, y) != 0) { @@ -396,8 +396,8 @@ special_overflow (void) set_emax (emax); /* bug found by Kevin Rauch, 26 Oct 2007 */ - mpfr_set_str (x, "1e19", 10, GMP_RNDN); - inex = mpfr_gamma (x, x, GMP_RNDN); + mpfr_set_str (x, "1e19", 10, MPFR_RNDN); + inex = mpfr_gamma (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && inex > 0); mpfr_clear (y); @@ -419,9 +419,9 @@ gamma_integer (void) for (i = 0; i < 100; i++) { mpz_fac_ui (n, i); - mpfr_set_ui (x, i+1, GMP_RNDN); - mpfr_gamma (y, x, GMP_RNDN); - mpfr_set_z (x, n, GMP_RNDN); + mpfr_set_ui (x, i+1, MPFR_RNDN); + mpfr_gamma (y, x, MPFR_RNDN); + mpfr_set_z (x, n, MPFR_RNDN); if (!mpfr_equal_p (x, y)) { printf ("Error for gamma(%u)\n", i+1); @@ -447,16 +447,16 @@ test20071231 (void) mpfr_set_emin (-1000000); mpfr_init2 (x, 21); - mpfr_set_str (x, "-1000001.5", 10, GMP_RNDN); - inex = mpfr_gamma (x, x, GMP_RNDN); + mpfr_set_str (x, "-1000001.5", 10, MPFR_RNDN); + inex = mpfr_gamma (x, x, MPFR_RNDN); MPFR_ASSERTN(MPFR_IS_ZERO(x) && MPFR_IS_POS(x) && inex < 0); mpfr_clear (x); mpfr_set_emin (emin); mpfr_init2 (x, 53); - mpfr_set_str (x, "-1000000001.5", 10, GMP_RNDN); - inex = mpfr_gamma (x, x, GMP_RNDN); + mpfr_set_str (x, "-1000000001.5", 10, MPFR_RNDN); + inex = mpfr_gamma (x, x, MPFR_RNDN); MPFR_ASSERTN(MPFR_IS_ZERO(x) && MPFR_IS_POS(x) && inex < 0); mpfr_clear (x); } diff --git a/tests/tgeneric.c b/tests/tgeneric.c index 24bfe1d9b..52dced7f2 100644 --- a/tests/tgeneric.c +++ b/tests/tgeneric.c @@ -50,12 +50,12 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., do \ { \ printf ("%s\nx = ", (S)); \ - mpfr_out_str (stdout, 2, 0, (X), GMP_RNDN); \ + mpfr_out_str (stdout, 2, 0, (X), MPFR_RNDN); \ printf ("\n"); \ if ((void *) U != 0) \ { \ printf ("u = "); \ - mpfr_out_str (stdout, 2, 0, (U), GMP_RNDN); \ + mpfr_out_str (stdout, 2, 0, (U), MPFR_RNDN); \ printf ("\n"); \ } \ printf ("yprec = %u, rnd_mode = %s, inexact = %d, flags = %u\n", \ @@ -82,12 +82,12 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., printf ("tgeneric: testing function " STR(F) \ ", %s, target prec = %lu\nx = ", \ mpfr_print_rnd_mode (rnd), (unsigned long) (P)); \ - mpfr_out_str (stdout, 2, 0, (X), GMP_RNDN); \ + mpfr_out_str (stdout, 2, 0, (X), MPFR_RNDN); \ printf ("\n"); \ if (U) \ { \ printf ("u = "); \ - mpfr_out_str (stdout, 2, 0, (U), GMP_RNDN); \ + mpfr_out_str (stdout, 2, 0, (U), MPFR_RNDN); \ printf ("\n"); \ } \ } \ @@ -184,10 +184,10 @@ test_generic (mp_prec_t p0, mp_prec_t p1, unsigned int N) set_emax (MPFR_EMAX_MAX); if (n <= 1) { - mpfr_set_si (x, n == 0 ? 1 : -1, GMP_RNDN); + mpfr_set_si (x, n == 0 ? 1 : -1, MPFR_RNDN); mpfr_set_exp (x, mpfr_get_emin ()); #if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) - mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, GMP_RNDN); + mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, MPFR_RNDN); mpfr_set_exp (u, mpfr_get_emin ()); #endif } @@ -195,10 +195,10 @@ test_generic (mp_prec_t p0, mp_prec_t p1, unsigned int N) { if (getenv ("MPFR_CHECK_MAX") == NULL) goto next_n; - mpfr_set_si (x, n == 0 ? 1 : -1, GMP_RNDN); + mpfr_set_si (x, n == 0 ? 1 : -1, MPFR_RNDN); mpfr_setmax (x, REDUCE_EMAX); #if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) - mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, GMP_RNDN); + mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, MPFR_RNDN); mpfr_setmax (u, mpfr_get_emax ()); #endif } @@ -277,21 +277,21 @@ test_generic (mp_prec_t p0, mp_prec_t p1, unsigned int N) if (mpfr_nan_p (z) || mpfr_cmp (t, z) != 0) { printf ("results differ for x="); - mpfr_out_str (stdout, 2, xprec, x, GMP_RNDN); + mpfr_out_str (stdout, 2, xprec, x, MPFR_RNDN); #ifdef TWO_ARGS printf ("\nu="); - mpfr_out_str (stdout, 2, xprec, u, GMP_RNDN); + mpfr_out_str (stdout, 2, xprec, u, MPFR_RNDN); #elif defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) printf ("\nu="); - mpfr_out_str (stdout, 2, IEEE_DBL_MANT_DIG, u, GMP_RNDN); + mpfr_out_str (stdout, 2, IEEE_DBL_MANT_DIG, u, MPFR_RNDN); #endif printf (" prec=%u rnd_mode=%s\n", (unsigned) prec, mpfr_print_rnd_mode (rnd)); printf ("got "); - mpfr_out_str (stdout, 2, prec, z, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); puts (""); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); puts (""); printf ("approx "); mpfr_print_binary (y); diff --git a/tests/tgeneric_ui.c b/tests/tgeneric_ui.c index 643376a7b..0f3ec72f0 100644 --- a/tests/tgeneric_ui.c +++ b/tests/tgeneric_ui.c @@ -61,7 +61,7 @@ test_generic_ui (mp_prec_t p0, mp_prec_t p1, unsigned int N) else { /* Special cases tested in precision p1 if n <= 1. */ - mpfr_set_si (x, n == 0 ? 1 : -1, GMP_RNDN); + mpfr_set_si (x, n == 0 ? 1 : -1, MPFR_RNDN); mpfr_set_exp (x, mpfr_get_emin ()); } u = INT_RAND_FUNCTION (); @@ -75,7 +75,7 @@ test_generic_ui (mp_prec_t p0, mp_prec_t p1, unsigned int N) if (mpfr_cmp (t, z)) { printf ("results differ for x="); - mpfr_out_str (stdout, 2, prec, x, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN); printf ("\nu=%lu", (unsigned long) u); printf (" prec=%lu rnd_mode=%s\n", (unsigned long ) prec, mpfr_print_rnd_mode (rnd)); @@ -83,10 +83,10 @@ test_generic_ui (mp_prec_t p0, mp_prec_t p1, unsigned int N) printf ("Function: %s\n", TEST_FUNCTION_NAME); #endif printf ("got "); - mpfr_out_str (stdout, 2, prec, z, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); puts (""); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); puts (""); printf ("approx "); mpfr_print_binary (y); diff --git a/tests/tget_d.c b/tests/tget_d.c index cda82af93..3c4466fbf 100644 --- a/tests/tget_d.c +++ b/tests/tget_d.c @@ -42,13 +42,13 @@ check_denorms (void) mpfr_init2 (x, BITS_PER_MP_LIMB); - rnd_mode = GMP_RNDN; + rnd_mode = MPFR_RNDN; for (k = -17; k <= 17; k += 2) { d = (double) k * dbl_min; /* k * 2^(-1022) */ f = 1.0; - mpfr_set_si (x, k, GMP_RNDN); - mpfr_div_2exp (x, x, 1022, GMP_RNDN); /* k * 2^(-1022) */ + mpfr_set_si (x, k, MPFR_RNDN); + mpfr_div_2exp (x, x, 1022, MPFR_RNDN); /* k * 2^(-1022) */ for (n = 0; n <= 58; n++) { d2 = d * f; @@ -61,7 +61,7 @@ check_denorms (void) fail = 1; } f *= 0.5; - mpfr_div_2exp (x, x, 1, GMP_RNDN); + mpfr_div_2exp (x, x, 1, MPFR_RNDN); } } @@ -80,17 +80,17 @@ check_inf_nan (void) mpfr_init2 (x, 123); mpfr_set_inf (x, 1); - d = mpfr_get_d (x, GMP_RNDZ); + d = mpfr_get_d (x, MPFR_RNDZ); ASSERT_ALWAYS (d > 0); ASSERT_ALWAYS (DOUBLE_ISINF (d)); mpfr_set_inf (x, -1); - d = mpfr_get_d (x, GMP_RNDZ); + d = mpfr_get_d (x, MPFR_RNDZ); ASSERT_ALWAYS (d < 0); ASSERT_ALWAYS (DOUBLE_ISINF (d)); mpfr_set_nan (x); - d = mpfr_get_d (x, GMP_RNDZ); + d = mpfr_get_d (x, MPFR_RNDZ); ASSERT_ALWAYS (DOUBLE_ISNAN (d)); mpfr_clear (x); @@ -107,7 +107,7 @@ check_max (void) while (d < (DBL_MAX / 2.0)) d += d; mpfr_init (u); - if (mpfr_set_d (u, d, GMP_RNDN) == 0) + if (mpfr_set_d (u, d, MPFR_RNDN) == 0) { /* If setting is exact */ e = (mpfr_get_d1) (u); @@ -119,23 +119,23 @@ check_max (void) } mpfr_set_str_binary (u, "-1E1024"); - d = mpfr_get_d (u, GMP_RNDZ); + d = mpfr_get_d (u, MPFR_RNDZ); MPFR_ASSERTN(d == -DBL_MAX); - d = mpfr_get_d (u, GMP_RNDU); + d = mpfr_get_d (u, MPFR_RNDU); MPFR_ASSERTN(d == -DBL_MAX); - d = mpfr_get_d (u, GMP_RNDN); + d = mpfr_get_d (u, MPFR_RNDN); MPFR_ASSERTN(DOUBLE_ISINF(d) && d < 0.0); - d = mpfr_get_d (u, GMP_RNDD); + d = mpfr_get_d (u, MPFR_RNDD); MPFR_ASSERTN(DOUBLE_ISINF(d) && d < 0.0); mpfr_set_str_binary (u, "1E1024"); - d = mpfr_get_d (u, GMP_RNDZ); + d = mpfr_get_d (u, MPFR_RNDZ); MPFR_ASSERTN(d == DBL_MAX); - d = mpfr_get_d (u, GMP_RNDD); + d = mpfr_get_d (u, MPFR_RNDD); MPFR_ASSERTN(d == DBL_MAX); - d = mpfr_get_d (u, GMP_RNDN); + d = mpfr_get_d (u, MPFR_RNDN); MPFR_ASSERTN(DOUBLE_ISINF(d) && d > 0.0); - d = mpfr_get_d (u, GMP_RNDU); + d = mpfr_get_d (u, MPFR_RNDU); MPFR_ASSERTN(DOUBLE_ISINF(d) && d > 0.0); mpfr_clear (u); @@ -149,7 +149,7 @@ check_min(void) d = 1.0; while (d > (DBL_MIN * 2.0)) d /= 2.0; mpfr_init(u); - if (mpfr_set_d(u, d, GMP_RNDN) == 0) + if (mpfr_set_d(u, d, MPFR_RNDN) == 0) { /* If setting is exact */ e = mpfr_get_d1(u); diff --git a/tests/tget_d_2exp.c b/tests/tget_d_2exp.c index 595d14c6b..309304790 100644 --- a/tests/tget_d_2exp.c +++ b/tests/tget_d_2exp.c @@ -40,13 +40,13 @@ check_round (void) mpfr_init2 (f, 1024L); - for (rnd_mode = 0; rnd_mode < GMP_RND_MAX ; rnd_mode++) + for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX ; rnd_mode++) { for (i = 0; i < (int) numberof (data); i++) { - mpfr_set_ui (f, 1L, GMP_RNDZ); - mpfr_mul_2exp (f, f, data[i], GMP_RNDZ); - mpfr_sub_ui (f, f, 1L, GMP_RNDZ); + mpfr_set_ui (f, 1L, MPFR_RNDZ); + mpfr_mul_2exp (f, f, data[i], MPFR_RNDZ); + mpfr_sub_ui (f, f, 1L, MPFR_RNDZ); for (neg = 0; neg <= 1; neg++) { @@ -61,14 +61,14 @@ check_round (void) printf (" rnd_mode = %d\n", rnd_mode); printf (" data[i] = %lu\n", data[i]); printf (" f "); - mpfr_out_str (stdout, 2, 0, f, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, f, MPFR_RNDN); printf ("\n"); d_trace (" got ", got); printf (" got exp %ld\n", got_exp); exit(1); } - mpfr_neg (f, f, GMP_RNDZ); + mpfr_neg (f, f, MPFR_RNDZ); } } } @@ -89,17 +89,17 @@ check_inf_nan (void) mpfr_init2 (x, 123); mpfr_set_inf (x, 1); - d = mpfr_get_d_2exp (&exp, x, GMP_RNDZ); + d = mpfr_get_d_2exp (&exp, x, MPFR_RNDZ); ASSERT_ALWAYS (d > 0); ASSERT_ALWAYS (DOUBLE_ISINF (d)); mpfr_set_inf (x, -1); - d = mpfr_get_d_2exp (&exp, x, GMP_RNDZ); + d = mpfr_get_d_2exp (&exp, x, MPFR_RNDZ); ASSERT_ALWAYS (d < 0); ASSERT_ALWAYS (DOUBLE_ISINF (d)); mpfr_set_nan (x); - d = mpfr_get_d_2exp (&exp, x, GMP_RNDZ); + d = mpfr_get_d_2exp (&exp, x, MPFR_RNDZ); ASSERT_ALWAYS (DOUBLE_ISNAN (d)); mpfr_clear (x); diff --git a/tests/tget_f.c b/tests/tget_f.c index 5e9714f4c..c42dbce98 100644 --- a/tests/tget_f.c +++ b/tests/tget_f.c @@ -49,23 +49,23 @@ prec_test (void) mpf_init (x1); mpf_init (x2); mpf_init (x3); - mpfr_set_ui_2exp (y1, 1, py - 1, GMP_RNDN); - mpfr_get_f (x1, y1, GMP_RNDN); /* exact (power of 2) */ + mpfr_set_ui_2exp (y1, 1, py - 1, MPFR_RNDN); + mpfr_get_f (x1, y1, MPFR_RNDN); /* exact (power of 2) */ mpf_set (x2, x1); - mpfr_set (y2, y1, GMP_RNDN); + mpfr_set (y2, y1, MPFR_RNDN); for (e = py - 2; e >= 0; e--) { int inex; mpf_div_2exp (x2, x2, 1); mpf_add (x1, x1, x2); - mpfr_div_2exp (y2, y2, 1, GMP_RNDN); - inex = mpfr_add (y1, y1, y2, GMP_RNDN); + mpfr_div_2exp (y2, y2, 1, MPFR_RNDN); + inex = mpfr_add (y1, y1, y2, MPFR_RNDN); MPFR_ASSERTN (inex == 0); - mpfr_set_f (y3, x1, GMP_RNDN); + mpfr_set_f (y3, x1, MPFR_RNDN); if (! mpfr_equal_p (y1, y3)) break; - mpfr_get_f (x3, y3, GMP_RNDN); + mpfr_get_f (x3, y3, MPFR_RNDN); if (mpf_cmp (x1, x3) != 0) { printf ("Error in prec_test (px = %d, py = %d, e = %d)\n", @@ -106,36 +106,36 @@ main (void) mpf_init (x); mpfr_set_nan (y); - if (mpfr_get_f (x, y, GMP_RNDN) == 0) + if (mpfr_get_f (x, y, MPFR_RNDN) == 0) { printf ("Error: mpfr_get_f(NaN) should fail\n"); exit (1); } mpfr_set_inf (y, 1); - if (mpfr_get_f (x, y, GMP_RNDN) == 0) + if (mpfr_get_f (x, y, MPFR_RNDN) == 0) { printf ("Error: mpfr_get_f(+Inf) should fail\n"); exit (1); } mpfr_set_inf (y, -1); - if (mpfr_get_f (x, y, GMP_RNDN) == 0) + if (mpfr_get_f (x, y, MPFR_RNDN) == 0) { printf ("Error: mpfr_get_f(-Inf) should fail\n"); exit (1); } - mpfr_set_ui (y, 0, GMP_RNDN); - if (mpfr_get_f (x, y, GMP_RNDN) || mpf_cmp_ui (x, 0)) + mpfr_set_ui (y, 0, MPFR_RNDN); + if (mpfr_get_f (x, y, MPFR_RNDN) || mpf_cmp_ui (x, 0)) { printf ("Error: mpfr_get_f(+0) fails\n"); exit (1); } - mpfr_set_ui (y, 0, GMP_RNDN); - mpfr_neg (y, y, GMP_RNDN); - if (mpfr_get_f (x, y, GMP_RNDN) || mpf_cmp_ui (x, 0)) + mpfr_set_ui (y, 0, MPFR_RNDN); + mpfr_neg (y, y, MPFR_RNDN); + if (mpfr_get_f (x, y, MPFR_RNDN) || mpf_cmp_ui (x, 0)) { printf ("Error: mpfr_get_f(-0) fails\n"); exit (1); @@ -144,8 +144,8 @@ main (void) i = 1; while (i) { - mpfr_set_ui (y, i, GMP_RNDN); - if (mpfr_get_f (x, y, GMP_RNDN) || mpf_cmp_ui (x, i)) + mpfr_set_ui (y, i, MPFR_RNDN); + if (mpfr_get_f (x, y, MPFR_RNDN) || mpf_cmp_ui (x, i)) { printf ("Error: mpfr_get_f(%lu) fails\n", i); exit (1); @@ -153,8 +153,8 @@ main (void) if (i <= - (unsigned long) LONG_MIN) { long j = i < - (unsigned long) LONG_MIN ? - (long) i : LONG_MIN; - mpfr_set_si (y, j, GMP_RNDN); - if (mpfr_get_f (x, y, GMP_RNDN) || mpf_cmp_si (x, j)) + mpfr_set_si (y, j, MPFR_RNDN); + if (mpfr_get_f (x, y, MPFR_RNDN) || mpf_cmp_si (x, j)) { printf ("Error: mpfr_get_f(-%lu) fails\n", i); exit (1); @@ -169,14 +169,14 @@ main (void) i = 1; while (i) { - mpfr_set_ui (y, i, GMP_RNDN); - if (mpfr_get_f (x, y, GMP_RNDN) || mpf_cmp_ui (x, i)) + mpfr_set_ui (y, i, MPFR_RNDN); + if (mpfr_get_f (x, y, MPFR_RNDN) || mpf_cmp_ui (x, i)) { printf ("Error: mpfr_get_f(%lu) fails\n", i); exit (1); } - mpfr_set_si (y, (signed long) -i, GMP_RNDN); - if (mpfr_get_f (x, y, GMP_RNDN) || mpf_cmp_si (x, (signed long) -i)) + mpfr_set_si (y, (signed long) -i, MPFR_RNDN); + if (mpfr_get_f (x, y, MPFR_RNDN) || mpf_cmp_si (x, (signed long) -i)) { printf ("Error: mpfr_get_f(-%lu) fails\n", i); exit (1); @@ -188,13 +188,13 @@ main (void) for (e = 0; e <= 2 * BITS_PER_MP_LIMB; e++) { /* test with 2^(-e) */ - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_div_2exp (y, y, e, GMP_RNDN); - mpfr_get_f (x, y, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_div_2exp (y, y, e, MPFR_RNDN); + mpfr_get_f (x, y, MPFR_RNDN); mpf_mul_2exp (x, x, e); if (mpf_cmp_ui (x, 1) != 0) { - printf ("Error: mpfr_get_f(x,y,GMP_RNDN) fails\n"); + printf ("Error: mpfr_get_f(x,y,MPFR_RNDN) fails\n"); printf ("y="); mpfr_dump (y); printf ("x="); @@ -204,13 +204,13 @@ main (void) } /* test with 2^(e) */ - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_mul_2exp (y, y, e, GMP_RNDN); - mpfr_get_f (x, y, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_mul_2exp (y, y, e, MPFR_RNDN); + mpfr_get_f (x, y, MPFR_RNDN); mpf_div_2exp (x, x, e); if (mpf_cmp_ui (x, 1) != 0) { - printf ("Error: mpfr_get_f(x,y,GMP_RNDN) fails\n"); + printf ("Error: mpfr_get_f(x,y,MPFR_RNDN) fails\n"); printf ("y="); mpfr_dump (y); printf ("x="); @@ -224,9 +224,9 @@ main (void) mpfr_set_prec (y, 32); mpfr_set_prec (z, 32); mpf_set_prec (x, 32); - mpfr_set_ui_2exp (y, 0xc1234567, -30, GMP_RNDN); - mpfr_get_f (x, y, GMP_RNDN); - inex = mpfr_set_f (z, x, GMP_RNDN); + mpfr_set_ui_2exp (y, 0xc1234567, -30, MPFR_RNDN); + mpfr_get_f (x, y, MPFR_RNDN); + inex = mpfr_set_f (z, x, MPFR_RNDN); if (inex || ! mpfr_equal_p (y, z)) { printf ("Error in mpfr_get_f:\n inex = %d, y = ", inex); diff --git a/tests/tget_ld_2exp.c b/tests/tget_ld_2exp.c index 119ed7ecf..b39fee40c 100644 --- a/tests/tget_ld_2exp.c +++ b/tests/tget_ld_2exp.c @@ -40,13 +40,13 @@ check_round (void) mpfr_init2 (f, 1024L); - for (rnd_mode = 0; rnd_mode < GMP_RND_MAX ; rnd_mode++) + for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX ; rnd_mode++) { for (i = 0; i < (int) numberof (data); i++) { - mpfr_set_ui (f, 1L, GMP_RNDZ); - mpfr_mul_2exp (f, f, data[i], GMP_RNDZ); - mpfr_sub_ui (f, f, 1L, GMP_RNDZ); + mpfr_set_ui (f, 1L, MPFR_RNDZ); + mpfr_mul_2exp (f, f, data[i], MPFR_RNDZ); + mpfr_sub_ui (f, f, 1L, MPFR_RNDZ); for (neg = 0; neg <= 1; neg++) { @@ -61,14 +61,14 @@ check_round (void) printf (" rnd_mode = %d\n", rnd_mode); printf (" data[i] = %lu\n", data[i]); printf (" f "); - mpfr_out_str (stdout, 2, 0, f, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, f, MPFR_RNDN); printf ("\n"); d_trace (" got ", got); printf (" got exp %ld\n", got_exp); exit(1); } - mpfr_neg (f, f, GMP_RNDZ); + mpfr_neg (f, f, MPFR_RNDZ); } } } @@ -89,17 +89,17 @@ check_inf_nan (void) mpfr_init2 (x, 123); mpfr_set_inf (x, 1); - d = (double) mpfr_get_ld_2exp (&exp, x, GMP_RNDZ); + d = (double) mpfr_get_ld_2exp (&exp, x, MPFR_RNDZ); ASSERT_ALWAYS (d > 0); ASSERT_ALWAYS (DOUBLE_ISINF (d)); mpfr_set_inf (x, -1); - d = (double) mpfr_get_ld_2exp (&exp, x, GMP_RNDZ); + d = (double) mpfr_get_ld_2exp (&exp, x, MPFR_RNDZ); ASSERT_ALWAYS (d < 0); ASSERT_ALWAYS (DOUBLE_ISINF (d)); mpfr_set_nan (x); - d = (double) mpfr_get_ld_2exp (&exp, x, GMP_RNDZ); + d = (double) mpfr_get_ld_2exp (&exp, x, MPFR_RNDZ); ASSERT_ALWAYS (DOUBLE_ISNAN (d)); mpfr_clear (x); diff --git a/tests/tget_set_d64.c b/tests/tget_set_d64.c index 5b7473898..a3186f9e3 100644 --- a/tests/tget_set_d64.c +++ b/tests/tget_set_d64.c @@ -58,107 +58,107 @@ check_inf_nan (void) mpfr_init2 (y, 123); mpfr_set_nan (x); - d = mpfr_get_decimal64 (x, GMP_RNDZ); - mpfr_set_ui (x, 1, GMP_RNDZ); - mpfr_set_decimal64 (x, d, GMP_RNDZ); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + mpfr_set_ui (x, 1, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDZ); ASSERT_ALWAYS (mpfr_nan_p (x)); mpfr_set_inf (x, 1); - d = mpfr_get_decimal64 (x, GMP_RNDZ); - mpfr_set_ui (x, 1, GMP_RNDZ); - mpfr_set_decimal64 (x, d, GMP_RNDZ); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + mpfr_set_ui (x, 1, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDZ); ASSERT_ALWAYS (mpfr_inf_p (x) && mpfr_sgn (x) > 0); mpfr_set_inf (x, -1); - d = mpfr_get_decimal64 (x, GMP_RNDZ); - mpfr_set_ui (x, 1, GMP_RNDZ); - mpfr_set_decimal64 (x, d, GMP_RNDZ); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + mpfr_set_ui (x, 1, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDZ); ASSERT_ALWAYS (mpfr_inf_p (x) && mpfr_sgn (x) < 0); - mpfr_set_ui (x, 0, GMP_RNDZ); - d = mpfr_get_decimal64 (x, GMP_RNDZ); - mpfr_set_ui (x, 1, GMP_RNDZ); - mpfr_set_decimal64 (x, d, GMP_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDZ); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + mpfr_set_ui (x, 1, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDZ); ASSERT_ALWAYS (mpfr_cmp_ui (x, 0) == 0 && MPFR_SIGN (x) > 0); - mpfr_set_ui (x, 0, GMP_RNDZ); - mpfr_neg (x, x, GMP_RNDZ); - d = mpfr_get_decimal64 (x, GMP_RNDZ); - mpfr_set_ui (x, 1, GMP_RNDZ); - mpfr_set_decimal64 (x, d, GMP_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_neg (x, x, MPFR_RNDZ); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + mpfr_set_ui (x, 1, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDZ); ASSERT_ALWAYS (mpfr_cmp_ui (x, 0) == 0 && MPFR_SIGN (x) < 0); - mpfr_set_ui (x, 1, GMP_RNDZ); - d = mpfr_get_decimal64 (x, GMP_RNDZ); - mpfr_set_ui (x, 0, GMP_RNDZ); - mpfr_set_decimal64 (x, d, GMP_RNDZ); + mpfr_set_ui (x, 1, MPFR_RNDZ); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDZ); ASSERT_ALWAYS (mpfr_cmp_ui (x, 1) == 0); - mpfr_set_si (x, -1, GMP_RNDZ); - d = mpfr_get_decimal64 (x, GMP_RNDZ); - mpfr_set_ui (x, 0, GMP_RNDZ); - mpfr_set_decimal64 (x, d, GMP_RNDZ); + mpfr_set_si (x, -1, MPFR_RNDZ); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDZ); ASSERT_ALWAYS (mpfr_cmp_si (x, -1) == 0); - mpfr_set_ui (x, 2, GMP_RNDZ); - d = mpfr_get_decimal64 (x, GMP_RNDZ); - mpfr_set_ui (x, 0, GMP_RNDZ); - mpfr_set_decimal64 (x, d, GMP_RNDZ); + mpfr_set_ui (x, 2, MPFR_RNDZ); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDZ); ASSERT_ALWAYS (mpfr_cmp_ui (x, 2) == 0); - mpfr_set_ui (x, 99, GMP_RNDZ); - d = mpfr_get_decimal64 (x, GMP_RNDZ); - mpfr_set_ui (x, 0, GMP_RNDZ); - mpfr_set_decimal64 (x, d, GMP_RNDZ); + mpfr_set_ui (x, 99, MPFR_RNDZ); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDZ); ASSERT_ALWAYS (mpfr_cmp_ui (x, 99) == 0); - mpfr_set_str (x, "9999999999999999", 10, GMP_RNDZ); - mpfr_set (y, x, GMP_RNDZ); - d = mpfr_get_decimal64 (x, GMP_RNDZ); - mpfr_set_ui (x, 0, GMP_RNDZ); - mpfr_set_decimal64 (x, d, GMP_RNDZ); + mpfr_set_str (x, "9999999999999999", 10, MPFR_RNDZ); + mpfr_set (y, x, MPFR_RNDZ); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDZ); ASSERT_ALWAYS (mpfr_cmp (x, y) == 0); /* smallest normal number */ - mpfr_set_str (x, "1E-383", 10, GMP_RNDU); - mpfr_set (y, x, GMP_RNDZ); - d = mpfr_get_decimal64 (x, GMP_RNDZ); - mpfr_set_ui (x, 0, GMP_RNDZ); - mpfr_set_decimal64 (x, d, GMP_RNDU); + mpfr_set_str (x, "1E-383", 10, MPFR_RNDU); + mpfr_set (y, x, MPFR_RNDZ); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDU); ASSERT_ALWAYS (mpfr_cmp (x, y) == 0); /* smallest subnormal number */ - mpfr_set_str (x, "1E-398", 10, GMP_RNDU); - mpfr_set (y, x, GMP_RNDZ); - d = mpfr_get_decimal64 (x, GMP_RNDZ); - mpfr_set_ui (x, 0, GMP_RNDZ); - mpfr_set_decimal64 (x, d, GMP_RNDU); + mpfr_set_str (x, "1E-398", 10, MPFR_RNDU); + mpfr_set (y, x, MPFR_RNDZ); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDU); ASSERT_ALWAYS (mpfr_cmp (x, y) == 0); /* subnormal number with exponent change when we round back from 16 digits to 1 digit */ - mpfr_set_str (x, "9.9E-398", 10, GMP_RNDN); - d = mpfr_get_decimal64 (x, GMP_RNDU); /* should be 1E-397 */ - mpfr_set_ui (x, 0, GMP_RNDZ); - mpfr_set_decimal64 (x, d, GMP_RNDD); - mpfr_set_str (y, "1E-397", 10, GMP_RNDN); + mpfr_set_str (x, "9.9E-398", 10, MPFR_RNDN); + d = mpfr_get_decimal64 (x, MPFR_RNDU); /* should be 1E-397 */ + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDD); + mpfr_set_str (y, "1E-397", 10, MPFR_RNDN); ASSERT_ALWAYS (mpfr_cmp (x, y) == 0); /* largest number */ - mpfr_set_str (x, "9.999999999999999E384", 10, GMP_RNDZ); - mpfr_set (y, x, GMP_RNDZ); - d = mpfr_get_decimal64 (x, GMP_RNDU); - mpfr_set_ui (x, 0, GMP_RNDZ); - mpfr_set_decimal64 (x, d, GMP_RNDZ); + mpfr_set_str (x, "9.999999999999999E384", 10, MPFR_RNDZ); + mpfr_set (y, x, MPFR_RNDZ); + d = mpfr_get_decimal64 (x, MPFR_RNDU); + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDZ); ASSERT_ALWAYS (mpfr_cmp (x, y) == 0); mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); /* largest number */ - mpfr_set_str (x, "9.999999999999999E384", 10, GMP_RNDZ); - d = mpfr_get_decimal64 (x, GMP_RNDZ); - mpfr_set_decimal64 (y, d, GMP_RNDU); + mpfr_set_str (x, "9.999999999999999E384", 10, MPFR_RNDZ); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + mpfr_set_decimal64 (y, d, MPFR_RNDU); ASSERT_ALWAYS (mpfr_cmp (x, y) == 0); mpfr_clear (x); @@ -179,11 +179,11 @@ check_random (void) { mpfr_urandomb (x, RANDS); /* 0 <= x < 1 */ /* the normal decimal64 range contains [2^(-1272), 2^1278] */ - mpfr_mul_2si (x, x, (i % 2550) - 1272, GMP_RNDN); + mpfr_mul_2si (x, x, (i % 2550) - 1272, MPFR_RNDN); if (mpfr_get_exp (x) <= -1272) - mpfr_mul_2exp (x, x, -1271 - mpfr_get_exp (x), GMP_RNDN); - d = mpfr_get_decimal64 (x, GMP_RNDN); - mpfr_set_decimal64 (y, d, GMP_RNDN); + mpfr_mul_2exp (x, x, -1271 - mpfr_get_exp (x), MPFR_RNDN); + d = mpfr_get_decimal64 (x, MPFR_RNDN); + mpfr_set_decimal64 (y, d, MPFR_RNDN); if (mpfr_cmp (x, y) != 0) { printf ("x="); mpfr_dump (x); @@ -207,18 +207,18 @@ check_native (void) mpfr_init2 (x, 53); /* check important constants are correctly converted */ - mpfr_set_ui (x, 17, GMP_RNDN); - d = mpfr_get_decimal64 (x, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + d = mpfr_get_decimal64 (x, MPFR_RNDN); MPFR_ASSERTN(d == 17.0dd); - mpfr_set_ui (x, 42, GMP_RNDN); - d = mpfr_get_decimal64 (x, GMP_RNDN); + mpfr_set_ui (x, 42, MPFR_RNDN); + d = mpfr_get_decimal64 (x, MPFR_RNDN); MPFR_ASSERTN(d == 42.0dd); - mpfr_set_decimal64 (x, 17.0dd, GMP_RNDN); + mpfr_set_decimal64 (x, 17.0dd, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 17) == 0); - mpfr_set_decimal64 (x, 42.0dd, GMP_RNDN); + mpfr_set_decimal64 (x, 42.0dd, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 42) == 0); mpfr_clear (x); diff --git a/tests/tget_sj.c b/tests/tget_sj.c index 44142a17b..7f918aad6 100644 --- a/tests/tget_sj.c +++ b/tests/tget_sj.c @@ -65,21 +65,21 @@ check_sj (intmax_t s, mpfr_ptr x) { int rnd; - mpfr_set_si_2exp (y, i, -2, GMP_RNDN); - mpfr_add (y, y, x, GMP_RNDN); - for (rnd = 0; rnd < GMP_RND_MAX; rnd++) + mpfr_set_si_2exp (y, i, -2, MPFR_RNDN); + mpfr_add (y, y, x, MPFR_RNDN); + for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) { intmax_t r; - if (rnd == GMP_RNDZ && i < 0 && s >= 0) + if (rnd == MPFR_RNDZ && i < 0 && s >= 0) continue; - if (rnd == GMP_RNDZ && i > 0 && s <= 0) + if (rnd == MPFR_RNDZ && i > 0 && s <= 0) continue; - if (rnd == GMP_RNDD && i < 0) + if (rnd == MPFR_RNDD && i < 0) continue; - if (rnd == GMP_RNDU && i > 0) + if (rnd == MPFR_RNDU && i > 0) continue; - if (rnd == GMP_RNDA && ((MPFR_IS_POS(y) && i > 0) || + if (rnd == MPFR_RNDA && ((MPFR_IS_POS(y) && i > 0) || (MPFR_IS_NEG(y) && i < 0))) continue; /* rint (y) == x == s */ @@ -87,7 +87,7 @@ check_sj (intmax_t s, mpfr_ptr x) if (r != s) { printf ("Error in check_sj for y = "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf (" in %s\n", mpfr_print_rnd_mode ((mp_rnd_t) rnd)); printf ("Got %jd instead of %jd.\n", r, s); exit (1); @@ -110,19 +110,19 @@ check_uj (uintmax_t u, mpfr_ptr x) { int rnd; - mpfr_set_si_2exp (y, i, -2, GMP_RNDN); - mpfr_add (y, y, x, GMP_RNDN); - for (rnd = 0; rnd < GMP_RND_MAX; rnd++) + mpfr_set_si_2exp (y, i, -2, MPFR_RNDN); + mpfr_add (y, y, x, MPFR_RNDN); + for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) { uintmax_t r; - if (rnd == GMP_RNDZ && i < 0) + if (rnd == MPFR_RNDZ && i < 0) continue; - if (rnd == GMP_RNDD && i < 0) + if (rnd == MPFR_RNDD && i < 0) continue; - if (rnd == GMP_RNDU && i > 0) + if (rnd == MPFR_RNDU && i > 0) continue; - if (rnd == GMP_RNDA && ((MPFR_IS_POS(y) && i > 0) || + if (rnd == MPFR_RNDA && ((MPFR_IS_POS(y) && i > 0) || (MPFR_IS_NEG(y) && i < 0))) continue; /* rint (y) == x == u */ @@ -130,7 +130,7 @@ check_uj (uintmax_t u, mpfr_ptr x) if (r != u) { printf ("Error in check_uj for y = "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf (" in %s\n", mpfr_print_rnd_mode ((mp_rnd_t) rnd)); printf ("Got %ju instead of %ju.\n", r, u); exit (1); @@ -151,54 +151,54 @@ check_erange (void) /* Test for ERANGE flag + correct behaviour if overflow */ mpfr_init2 (x, 256); - mpfr_set_uj (x, UINTMAX_MAX, GMP_RNDN); + mpfr_set_uj (x, UINTMAX_MAX, MPFR_RNDN); mpfr_clear_erangeflag (); - dl = mpfr_get_uj (x, GMP_RNDN); + dl = mpfr_get_uj (x, MPFR_RNDN); if (dl != UINTMAX_MAX || mpfr_erangeflag_p ()) { printf ("ERROR for get_uj + ERANGE + UINTMAX_MAX (1)\n"); exit (1); } - mpfr_add_ui (x, x, 1, GMP_RNDN); - dl = mpfr_get_uj (x, GMP_RNDN); + mpfr_add_ui (x, x, 1, MPFR_RNDN); + dl = mpfr_get_uj (x, MPFR_RNDN); if (dl != UINTMAX_MAX || !mpfr_erangeflag_p ()) { printf ("ERROR for get_uj + ERANGE + UINTMAX_MAX (2)\n"); exit (1); } - mpfr_set_sj (x, -1, GMP_RNDN); + mpfr_set_sj (x, -1, MPFR_RNDN); mpfr_clear_erangeflag (); - dl = mpfr_get_uj (x, GMP_RNDN); + dl = mpfr_get_uj (x, MPFR_RNDN); if (dl != 0 || !mpfr_erangeflag_p ()) { printf ("ERROR for get_uj + ERANGE + -1 \n"); exit (1); } - mpfr_set_sj (x, INTMAX_MAX, GMP_RNDN); + mpfr_set_sj (x, INTMAX_MAX, MPFR_RNDN); mpfr_clear_erangeflag (); - d = mpfr_get_sj (x, GMP_RNDN); + d = mpfr_get_sj (x, MPFR_RNDN); if (d != INTMAX_MAX || mpfr_erangeflag_p ()) { printf ("ERROR for get_sj + ERANGE + INTMAX_MAX (1)\n"); exit (1); } - mpfr_add_ui (x, x, 1, GMP_RNDN); - d = mpfr_get_sj (x, GMP_RNDN); + mpfr_add_ui (x, x, 1, MPFR_RNDN); + d = mpfr_get_sj (x, MPFR_RNDN); if (d != INTMAX_MAX || !mpfr_erangeflag_p ()) { printf ("ERROR for get_sj + ERANGE + INTMAX_MAX (2)\n"); exit (1); } - mpfr_set_sj (x, INTMAX_MIN, GMP_RNDN); + mpfr_set_sj (x, INTMAX_MIN, MPFR_RNDN); mpfr_clear_erangeflag (); - d = mpfr_get_sj (x, GMP_RNDN); + d = mpfr_get_sj (x, MPFR_RNDN); if (d != INTMAX_MIN || mpfr_erangeflag_p ()) { printf ("ERROR for get_sj + ERANGE + INTMAX_MIN (1)\n"); exit (1); } - mpfr_sub_ui (x, x, 1, GMP_RNDN); - d = mpfr_get_sj (x, GMP_RNDN); + mpfr_sub_ui (x, x, 1, MPFR_RNDN); + d = mpfr_get_sj (x, MPFR_RNDN); if (d != INTMAX_MIN || !mpfr_erangeflag_p ()) { printf ("ERROR for get_sj + ERANGE + INTMAX_MIN (2)\n"); @@ -224,38 +224,38 @@ main (void) mpfr_init2 (x, prec + 4); mpfr_init2 (y, prec + 4); - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); check_sj (0, x); check_uj (0, x); - mpfr_set_si_2exp (x, 1, prec, GMP_RNDN); - mpfr_sub_ui (x, x, 1, GMP_RNDN); /* UINTMAX_MAX */ + mpfr_set_si_2exp (x, 1, prec, MPFR_RNDN); + mpfr_sub_ui (x, x, 1, MPFR_RNDN); /* UINTMAX_MAX */ - mpfr_div_ui (y, x, 2, GMP_RNDZ); + mpfr_div_ui (y, x, 2, MPFR_RNDZ); mpfr_trunc (y, y); /* INTMAX_MAX */ for (s = INTMAX_MAX; s != 0; s /= 17) { check_sj (s, y); - mpfr_div_ui (y, y, 17, GMP_RNDZ); + mpfr_div_ui (y, y, 17, MPFR_RNDZ); mpfr_trunc (y, y); } - mpfr_div_ui (y, x, 2, GMP_RNDZ); + mpfr_div_ui (y, x, 2, MPFR_RNDZ); mpfr_trunc (y, y); /* INTMAX_MAX */ - mpfr_neg (y, y, GMP_RNDN); + mpfr_neg (y, y, MPFR_RNDN); if (INTMAX_MIN + INTMAX_MAX != 0) - mpfr_sub_ui (y, y, 1, GMP_RNDN); /* INTMAX_MIN */ + mpfr_sub_ui (y, y, 1, MPFR_RNDN); /* INTMAX_MIN */ for (s = INTMAX_MIN; s != 0; s /= 17) { check_sj (s, y); - mpfr_div_ui (y, y, 17, GMP_RNDZ); + mpfr_div_ui (y, y, 17, MPFR_RNDZ); mpfr_trunc (y, y); } for (u = UINTMAX_MAX; u != 0; u /= 17) { check_uj (u, x); - mpfr_div_ui (x, x, 17, GMP_RNDZ); + mpfr_div_ui (x, x, 17, MPFR_RNDZ); mpfr_trunc (x, x); } diff --git a/tests/tget_str.c b/tests/tget_str.c index 245ab42c1..6ef6e6075 100644 --- a/tests/tget_str.c +++ b/tests/tget_str.c @@ -57,9 +57,9 @@ check_small (void) mpfr_init (x); mpfr_set_prec (x, 20); - mpfr_set_ui (x, 2, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); mpfr_nexttozero (x); - s = mpfr_get_str (NULL, &e, 4, 2, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 4, 2, x, MPFR_RNDU); if (strcmp (s, "20") || (e != 1)) { printf ("Error in mpfr_get_str: 2- rounded up with 2 digits" @@ -70,18 +70,18 @@ check_small (void) /* check n_digits=0 */ mpfr_set_prec (x, 5); - mpfr_set_ui (x, 17, GMP_RNDN); - s = mpfr_get_str (NULL, &e, 3, 0, x, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + s = mpfr_get_str (NULL, &e, 3, 0, x, MPFR_RNDN); mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 36, 0, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 36, 0, x, MPFR_RNDN); mpfr_free_str (s); mpfr_set_prec (x, 64); - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_div_2exp (x, x, 63, GMP_RNDN); /* x = -2^(-63) */ - mpfr_add_ui (x, x, 1, GMP_RNDN); /* x = 1 - 2^(-63) */ - mpfr_mul_2exp (x, x, 32, GMP_RNDN); /* x = 2^32 - 2^(-31) */ - s = mpfr_get_str (NULL, &e, 3, 21, x, GMP_RNDU); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_div_2exp (x, x, 63, MPFR_RNDN); /* x = -2^(-63) */ + mpfr_add_ui (x, x, 1, MPFR_RNDN); /* x = 1 - 2^(-63) */ + mpfr_mul_2exp (x, x, 32, MPFR_RNDN); /* x = 2^32 - 2^(-31) */ + s = mpfr_get_str (NULL, &e, 3, 21, x, MPFR_RNDU); if (strcmp (s, "102002022201221111211") || (e != 21)) { printf ("Error in mpfr_get_str: 2^32-2^(-31) rounded up with" @@ -89,7 +89,7 @@ check_small (void) exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 3, 20, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 3, 20, x, MPFR_RNDU); if (strcmp (s, "10200202220122111122") || (e != 21)) { printf ("Error in mpfr_get_str: 2^32-2^(-31) rounded up with" @@ -101,7 +101,7 @@ check_small (void) /* check corner case ret!=0, j0!=0 in mpfr_get_str_aux */ mpfr_set_prec (x, 100); mpfr_set_str_binary (x, "0.1001011111010001101110010101010101111001010111111101101101100110100011110110000101110110001011110000E-9"); - s = mpfr_get_str (NULL, &e, 3, 2, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 3, 2, x, MPFR_RNDU); if (strcmp (s, "22") || (e != -6)) { printf ("Error in mpfr_get_str: 100-bit number rounded up with" @@ -113,7 +113,7 @@ check_small (void) /* check corner case exact=0 in mpfr_get_str_aux */ mpfr_set_prec (x, 100); mpfr_set_str_binary (x, "0.1001001111101101111000101000110111111010101100000110010001111111011001101011101100001100110000000000E8"); - s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDZ); + s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDZ); if (strcmp (s, "14") || (e != 3)) { printf ("Error in mpfr_get_str: 100-bit number rounded to zero with" @@ -125,9 +125,9 @@ check_small (void) for (p=4; p<=200; p++) { mpfr_set_prec (x, p); - mpfr_set_str (x, "6.5", 10, GMP_RNDN); + mpfr_set_str (x, "6.5", 10, MPFR_RNDN); - s = mpfr_get_str (NULL, &e, 6, 2, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 6, 2, x, MPFR_RNDN); if (strcmp (s, "10") || (e != 2)) { printf ("Error in mpfr_get_str: 6.5 rounded to nearest with" @@ -137,7 +137,7 @@ check_small (void) mpfr_free_str (s); mpfr_nexttoinf (x); - s = mpfr_get_str (NULL, &e, 6, 2, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 6, 2, x, MPFR_RNDN); if (strcmp (s, "11") || (e != 2)) { printf ("Error in mpfr_get_str: 6.5+ rounded to nearest with" @@ -147,9 +147,9 @@ check_small (void) } mpfr_free_str (s); - mpfr_set_str (x, "6.5", 10, GMP_RNDN); + mpfr_set_str (x, "6.5", 10, MPFR_RNDN); mpfr_nexttozero (x); - s = mpfr_get_str (NULL, &e, 6, 2, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 6, 2, x, MPFR_RNDN); if (strcmp (s, "10") || (e != 2)) { printf ("Error in mpfr_get_str: 6.5- rounded to nearest with" @@ -160,8 +160,8 @@ check_small (void) } mpfr_set_prec (x, 3); - mpfr_set_ui (x, 7, GMP_RNDN); - s = mpfr_get_str (NULL, &e, 2, 2, x, GMP_RNDU); + mpfr_set_ui (x, 7, MPFR_RNDN); + s = mpfr_get_str (NULL, &e, 2, 2, x, MPFR_RNDU); if (strcmp (s, "10") || (e != 4)) { printf ("Error in mpfr_get_str: 7 rounded up with 2 bits should" @@ -172,19 +172,19 @@ check_small (void) /* problem found by Fabrice Rouillier */ mpfr_set_prec (x, 63); - mpfr_set_str (x, "5e14", 10, GMP_RNDN); - s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDU); + mpfr_set_str (x, "5e14", 10, MPFR_RNDN); + s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDU); mpfr_free_str (s); /* bug found by Johan Vervloet */ mpfr_set_prec (x, 6); - mpfr_set_str (x, "688.0", 10, GMP_RNDN); - s = mpfr_get_str (NULL, &e, 2, 4, x, GMP_RNDU); + mpfr_set_str (x, "688.0", 10, MPFR_RNDN); + s = mpfr_get_str (NULL, &e, 2, 4, x, MPFR_RNDU); if (strcmp (s, "1011") || (e != 10)) { printf ("Error in mpfr_get_str: 688 printed up to 4 bits should" " give 1.011e9\ninstead of "); - mpfr_out_str (stdout, 2, 4, x, GMP_RNDU); + mpfr_out_str (stdout, 2, 4, x, MPFR_RNDU); puts (""); exit (1); } @@ -192,7 +192,7 @@ check_small (void) mpfr_set_prec (x, 38); mpfr_set_str_binary (x, "1.0001110111110100011010100010010100110e-6"); - s = mpfr_get_str (NULL, &e, 8, 10, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 8, 10, x, MPFR_RNDU); if (strcmp (s, "1073721522") || (e != -1)) { printf ("Error in mpfr_get_str (3): s=%s e=%d\n", s, (int) e); @@ -202,7 +202,7 @@ check_small (void) mpfr_set_prec (x, 53); mpfr_set_str_binary (x, "0.11010111011101100010000100010101110001000000010111001E454"); - s = mpfr_get_str (NULL, &e, 19, 12, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 19, 12, x, MPFR_RNDU); if (strcmp (s, "b1cgfa4gha0h") || (e != 107)) { printf ("Error in mpfr_get_str (4): s=%s e=%d\n", s, (int) e); @@ -212,7 +212,7 @@ check_small (void) mpfr_set_prec (x, 145); mpfr_set_str_binary (x, "-0.1000110011000001011000010101101010110110101100101110100011111100011110011001001001010000100001000011000011000000010111011001000111101001110100110e6"); - s = mpfr_get_str (NULL, &e, 4, 53, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 4, 53, x, MPFR_RNDU); if (strcmp (s, "-20303001120111222312230232203330132121021100201003003") || (e != 3)) { printf ("Error in mpfr_get_str (5): s=%s e=%d\n", s, (int) e); @@ -222,7 +222,7 @@ check_small (void) mpfr_set_prec (x, 45); mpfr_set_str_binary (x, "-0.00100111010110010001011001110111010001010010010"); - s = mpfr_get_str (NULL, &e, 32, 9, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 32, 9, x, MPFR_RNDN); if (strcmp (s, "-4tchctq54") || (e != 0)) { printf ("Error in mpfr_get_str (6): s=%s e=%d\n", s, (int) e); @@ -233,7 +233,7 @@ check_small (void) /* worst case found by Vincent Lefe`vre */ mpfr_set_prec (x, 53); mpfr_set_str_binary (x, "10011110111100000000001011011110101100010000011011111E164"); - s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN); if (strcmp (s, "13076622631878654") || (e != 66)) { printf ("Error in mpfr_get_str (7): s=%s e=%d\n", s, (int) e); @@ -241,7 +241,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "10000001001001001100011101010011011011111000011000100E93"); - s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU); if (strcmp (s, "46") || e != 44) { printf ("Error in mpfr_get_str (8): s=%s e=%d\n", s, (int) e); @@ -249,7 +249,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "10010001111100000111001111010101001010000010111010101E55"); - s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN); if (strcmp (s, "19") || e != 33) { printf ("Error in mpfr_get_str (9): s=%s e=%d\n", s, (int) e); @@ -257,7 +257,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "11011001010010111110010101101100111110111000010110110E44"); - s = mpfr_get_str (NULL, &e, 10, 3, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 3, x, MPFR_RNDN); if (strcmp (s, "135") || e != 30) { printf ("Error in mpfr_get_str (10): s=%s e=%d\n", s, (int) e); @@ -265,7 +265,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "11101111101000001011100001111000011111101111011001100E72"); - s = mpfr_get_str (NULL, &e, 10, 4, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 4, x, MPFR_RNDN); if (strcmp (s, "3981") || e != 38) { printf ("Error in mpfr_get_str (11): s=%s e=%d\n", s, (int) e); @@ -273,7 +273,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "10011001001100100010111100001101110101001001111110000E46"); - s = mpfr_get_str (NULL, &e, 10, 5, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 5, x, MPFR_RNDN); if (strcmp (s, "37930") || e != 30) { printf ("Error in mpfr_get_str (12): s=%s e=%d\n", s, (int) e); @@ -281,7 +281,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "10001100110111001011011110011011011101100011010001011E-72"); - s = mpfr_get_str (NULL, &e, 10, 6, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 6, x, MPFR_RNDN); if (strcmp (s, "104950") || e != -5) { printf ("Error in mpfr_get_str (13): s=%s e=%d\n", s, (int) e); @@ -290,7 +290,7 @@ check_small (void) mpfr_free_str (s); mpfr_set_str_binary (x, "10100100001011001000011001101101000110100110000010111E89"); - s = mpfr_get_str (NULL, &e, 10, 7, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDN); if (strcmp (s, "3575392") || e != 43) { printf ("Error in mpfr_get_str (14): s=%s e=%d\n", s, (int) e); @@ -299,7 +299,7 @@ check_small (void) mpfr_free_str (s); mpfr_set_str_binary (x, "11000011011110110010100110001010000001010011001011001E-73"); - s = mpfr_get_str (NULL, &e, 10, 8, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDN); if (strcmp (s, "72822386") || e != -6) { printf ("Error in mpfr_get_str (15): s=%s e=%d\n", s, (int) e); @@ -308,7 +308,7 @@ check_small (void) mpfr_free_str (s); mpfr_set_str_binary (x, "10101010001101000111001100001000100011100010010001010E78"); - s = mpfr_get_str (NULL, &e, 10, 9, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDN); if (strcmp (s, "180992873") || e != 40) { printf ("Error in mpfr_get_str (16): s=%s e=%d\n", s, (int) e); @@ -317,7 +317,7 @@ check_small (void) mpfr_free_str (s); mpfr_set_str_binary (x, "10110111001000100000001101111001100101101110011011101E91"); - s = mpfr_get_str (NULL, &e, 10, 10, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 10, x, MPFR_RNDN); if (strcmp (s, "1595312255") || e != 44) { printf ("Error in mpfr_get_str (17): s=%s e=%d\n", s, (int) e); @@ -325,7 +325,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "10011101010111101111000100111011101011110100110110101E93"); - s = mpfr_get_str (NULL, &e, 10, 11, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 11, x, MPFR_RNDN); if (strcmp (s, "54835744350") || e != 44) { printf ("Error in mpfr_get_str (18): s=%s e=%d\n", s, (int) e); @@ -333,7 +333,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "10011101010111101111000100111011101011110100110110101E92"); - s = mpfr_get_str (NULL, &e, 10, 12, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 12, x, MPFR_RNDN); if (strcmp (s, "274178721752") || e != 44) { printf ("Error in mpfr_get_str (19): s=%s e=%d\n", s, (int) e); @@ -341,7 +341,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "10011101010111101111000100111011101011110100110110101E91"); - s = mpfr_get_str (NULL, &e, 10, 13, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 13, x, MPFR_RNDN); if (strcmp (s, "1370893608762") || e != 44) { printf ("Error in mpfr_get_str (20): s=%s e=%d\n", s, (int) e); @@ -350,7 +350,7 @@ check_small (void) mpfr_free_str (s); mpfr_set_str_binary (x, "10010011010110011100010010100101100011101000011111111E92"); - s = mpfr_get_str (NULL, &e, 10, 14, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDN); if (strcmp (s, "25672105101864") || e != 44) { printf ("Error in mpfr_get_str (21): s=%s e=%d\n", s, (int) e); @@ -359,7 +359,7 @@ check_small (void) mpfr_free_str (s); mpfr_set_str_binary (x, "100110111110110001000101110100100101101000011111001E87"); - s = mpfr_get_str (NULL, &e, 10, 15, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDN); if (strcmp (s, "212231308858721") || e != 42) { printf ("Error in mpfr_get_str (22): s=%s e=%d\n", s, (int) e); @@ -367,7 +367,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "10111010110000111000101100101111001011011100101001111E-128"); - s = mpfr_get_str (NULL, &e, 10, 15, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDN); if (strcmp (s, "193109287087290") || e != -22) { printf ("Error in mpfr_get_str (22b): s=%s e=%d\n", s, (int) e); @@ -376,7 +376,7 @@ check_small (void) mpfr_free_str (s); mpfr_set_str_binary (x, "10001101101011010001111110000111010111010000110101010E80"); - s = mpfr_get_str (NULL, &e, 10, 16, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDN); if (strcmp (s, "6026241735727920") || e != 40) { printf ("Error in mpfr_get_str (23): s=%s e=%d\n", s, (int) e); @@ -385,7 +385,7 @@ check_small (void) mpfr_free_str (s); mpfr_set_str_binary (x, "100010001011101001110101000110011001001000110001001E-81"); - s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN); if (strcmp (s, "49741483709103481") || e != -9) { printf ("Error in mpfr_get_str (24): s=%s e=%d\n", s, (int) e); @@ -393,7 +393,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "11000100001001001110111010011001111001001010110101111E-101"); - s = mpfr_get_str (NULL, &e, 10, 7, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDN); if (strcmp (s, "2722049") || e != -14) { printf ("Error in mpfr_get_str (25): s=%s e=%d\n", s, (int) e); @@ -401,7 +401,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "11111001010011100101000001111111110001001001110110001E-135"); - s = mpfr_get_str (NULL, &e, 10, 8, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDN); if (strcmp (s, "20138772") || e != -24) { printf ("Error in mpfr_get_str (26): s=%s e=%d\n", s, (int) e); @@ -410,7 +410,7 @@ check_small (void) mpfr_free_str (s); mpfr_set_str_binary (x, "11111001010011100101000001111111110001001001110110001E-136"); - s = mpfr_get_str (NULL, &e, 10, 9, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDN); if (strcmp (s, "100693858") || e != -24) { printf ("Error in mpfr_get_str (27): s=%s e=%d\n", s, (int) e); @@ -418,7 +418,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "10001000001110010110001011111011111011011010000110001E-110"); - s = mpfr_get_str (NULL, &e, 10, 14, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDN); if (strcmp (s, "36923634350619") || e != -17) { printf ("Error in mpfr_get_str (28): s=%s e=%d\n", s, (int) e); @@ -426,7 +426,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "11001100010111000111100010000110011101110001000101111E-87"); - s = mpfr_get_str (NULL, &e, 10, 16, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDN); if (strcmp (s, "4646636036100804") || e != -10) { printf ("Error in mpfr_get_str (29): s=%s e=%d\n", s, (int) e); @@ -434,7 +434,7 @@ check_small (void) } mpfr_free_str (s); mpfr_set_str_binary (x, "10011111001111110100001001010111111011010101111111000E-99"); - s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN); if (strcmp (s, "88399901882446712") || e != -14) { printf ("Error in mpfr_get_str (30): s=%s e=%d\n", s, (int) e); @@ -444,14 +444,14 @@ check_small (void) /* 8116315218207718*2^(-293) ~ 0.5100000000000000000015*10^(-72) */ mpfr_set_str_binary (x, "11100110101011011111011100101011101110110001111100110E-293"); - s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU); if (strcmp (s, "52") || e != -72) { printf ("Error in mpfr_get_str (31u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDD); if (strcmp (s, "51") || e != -72) { printf ("Error in mpfr_get_str (31d): s=%s e=%d\n", s, (int) e); @@ -461,14 +461,14 @@ check_small (void) /* 6712731423444934*2^536 ~ .151000000000000000000067*10^178 */ mpfr_set_str_binary (x, "10111110110010011000110010011111101111000111111000110E536"); - s = mpfr_get_str (NULL, &e, 10, 3, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 3, x, MPFR_RNDU); if (strcmp (s, "152") || e != 178) { printf ("Error in mpfr_get_str (32u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 3, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 3, x, MPFR_RNDD); if (strcmp (s, "151") || e != 178) { printf ("Error in mpfr_get_str (32d): s=%s e=%d\n", s, (int) e); @@ -478,14 +478,14 @@ check_small (void) /* 3356365711722467*2^540 ~ .120800000000000000000054*10^179 */ mpfr_set_str_binary (x, "1011111011001001100011001001111110111100011111100011E540"); - s = mpfr_get_str (NULL, &e, 10, 4, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 4, x, MPFR_RNDU); if (strcmp (s, "1209") || e != 179) { printf ("Error in mpfr_get_str (33u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 4, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 4, x, MPFR_RNDD); if (strcmp (s, "1208") || e != 179) { printf ("Error in mpfr_get_str (33d): s=%s e=%d\n", s, (int) e); @@ -495,14 +495,14 @@ check_small (void) /* 6475049196144587*2^100 ~ .8208099999999999999999988*10^46 */ mpfr_set_str_binary (x, "10111000000010000010111011111001111010100011111001011E100"); - s = mpfr_get_str (NULL, &e, 10, 5, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 5, x, MPFR_RNDU); if (strcmp (s, "82081") || e != 46) { printf ("Error in mpfr_get_str (34u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 5, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 5, x, MPFR_RNDD); if (strcmp (s, "82080") || e != 46) { printf ("Error in mpfr_get_str (34d): s=%s e=%d\n", s, (int) e); @@ -512,14 +512,14 @@ check_small (void) /* 6722280709661868*2^364 ~ .25260100000000000000000012*10^126 */ mpfr_set_str_binary (x, "10111111000011110000011110001110001111010010010101100E364"); - s = mpfr_get_str (NULL, &e, 10, 6, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 6, x, MPFR_RNDU); if (strcmp (s, "252602") || e != 126) { printf ("Error in mpfr_get_str (35u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 6, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 6, x, MPFR_RNDD); if (strcmp (s, "252601") || e != 126) { printf ("Error in mpfr_get_str (35d): s=%s e=%d\n", s, (int) e); @@ -529,14 +529,14 @@ check_small (void) /* 5381065484265332*2^(-455) ~ .578389299999999999999999982*10^(-121) */ mpfr_set_str_binary (x, "10011000111100000110011110000101100111110011101110100E-455"); - s = mpfr_get_str (NULL, &e, 10, 7, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDU); if (strcmp (s, "5783893") || e != -121) { printf ("Error in mpfr_get_str (36u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 7, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDD); if (strcmp (s, "5783892") || e != -121) { printf ("Error in mpfr_get_str (36d): s=%s e=%d\n", s, (int) e); @@ -546,14 +546,14 @@ check_small (void) /* 8369123604277281*2^(-852) ~ .27869147000000000000000000056*10^(-240) */ mpfr_set_str_binary (x, "11101101110111010110001101111100000111010100000100001E-852"); - s = mpfr_get_str (NULL, &e, 10, 8, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDU); if (strcmp (s, "27869148") || e != -240) { printf ("Error in mpfr_get_str (37u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 8, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDD); if (strcmp (s, "27869147") || e != -240) { printf ("Error in mpfr_get_str (37d): s=%s e=%d\n", s, (int) e); @@ -563,14 +563,14 @@ check_small (void) /* 7976538478610756*2^377 ~ .245540326999999999999999999982*10^130 */ mpfr_set_str_binary (x, "11100010101101001111010010110100011100000100101000100E377"); - s = mpfr_get_str (NULL, &e, 10, 9, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDU); if (strcmp (s, "245540327") || e != 130) { printf ("Error in mpfr_get_str (38u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 9, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDD); if (strcmp (s, "245540326") || e != 130) { printf ("Error in mpfr_get_str (38d): s=%s e=%d\n", s, (int) e); @@ -580,14 +580,14 @@ check_small (void) /* 8942832835564782*2^(-382) ~ .9078555839000000000000000000038*10^(-99) */ mpfr_set_str_binary (x, "11111110001010111010110000110011100110001010011101110E-382"); - s = mpfr_get_str (NULL, &e, 10, 10, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 10, x, MPFR_RNDU); if (strcmp (s, "9078555840") || e != -99) { printf ("Error in mpfr_get_str (39u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 10, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 10, x, MPFR_RNDD); if (strcmp (s, "9078555839") || e != -99) { printf ("Error in mpfr_get_str (39d): s=%s e=%d\n", s, (int) e); @@ -597,14 +597,14 @@ check_small (void) /* 4471416417782391*2^(-380) ~ .18157111678000000000000000000077*10^(-98) */ mpfr_set_str_binary (x, "1111111000101011101011000011001110011000101001110111E-380"); - s = mpfr_get_str (NULL, &e, 10, 11, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 11, x, MPFR_RNDU); if (strcmp (s, "18157111679") || e != -98) { printf ("Error in mpfr_get_str (40u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 11, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 11, x, MPFR_RNDD); if (strcmp (s, "18157111678") || e != -98) { printf ("Error in mpfr_get_str (40d): s=%s e=%d\n", s, (int) e); @@ -614,14 +614,14 @@ check_small (void) /* 7225450889282194*2^711 ~ .778380362292999999999999999999971*10^230 */ mpfr_set_str_binary (x, "11001101010111000001001100001100110010000001010010010E711"); - s = mpfr_get_str (NULL, &e, 10, 12, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 12, x, MPFR_RNDU); if (strcmp (s, "778380362293") || e != 230) { printf ("Error in mpfr_get_str (41u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 12, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 12, x, MPFR_RNDD); if (strcmp (s, "778380362292") || e != 230) { printf ("Error in mpfr_get_str (41d): s=%s e=%d\n", s, (int) e); @@ -631,14 +631,14 @@ check_small (void) /* 3612725444641097*2^713 ~ .1556760724585999999999999999999942*10^231 */ mpfr_set_str_binary (x, "1100110101011100000100110000110011001000000101001001E713"); - s = mpfr_get_str (NULL, &e, 10, 13, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 13, x, MPFR_RNDU); if (strcmp (s, "1556760724586") || e != 231) { printf ("Error in mpfr_get_str (42u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 13, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 13, x, MPFR_RNDD); if (strcmp (s, "1556760724585") || e != 231) { printf ("Error in mpfr_get_str (42d): s=%s e=%d\n", s, (int) e); @@ -648,14 +648,14 @@ check_small (void) /* 6965949469487146*2^(-248) ~ .15400733123779000000000000000000016*10^(-58) */ mpfr_set_str_binary (x, "11000101111110111111001111111101001101111000000101010E-248"); - s = mpfr_get_str (NULL, &e, 10, 14, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDU); if (strcmp (s, "15400733123780") || e != -58) { printf ("Error in mpfr_get_str (43u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 14, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDD); if (strcmp (s, "15400733123779") || e != -58) { printf ("Error in mpfr_get_str (43d): s=%s e=%d\n", s, (int) e); @@ -665,14 +665,14 @@ check_small (void) /* 3482974734743573*2^(-244) ~ .12320586499023200000000000000000013*10^(-57) */ mpfr_set_str_binary (x, "1100010111111011111100111111110100110111100000010101E-244"); - s = mpfr_get_str (NULL, &e, 10, 15, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDU); if (strcmp (s, "123205864990233") || e != -57) { printf ("Error in mpfr_get_str (44u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 15, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDD); if (strcmp (s, "123205864990232") || e != -57) { printf ("Error in mpfr_get_str (44d): s=%s e=%d\n", s, (int) e); @@ -682,14 +682,14 @@ check_small (void) /* 7542952370752766*2^(-919) ~ .170206189963739699999999999999999974*10^(-260) */ mpfr_set_str_binary (x, "11010110011000100011001110100100111011100110011111110E-919"); - s = mpfr_get_str (NULL, &e, 10, 16, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDU); if (strcmp (s, "1702061899637397") || e != -260) { printf ("Error in mpfr_get_str (45u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 16, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDD); if (strcmp (s, "1702061899637396") || e != -260) { printf ("Error in mpfr_get_str (45d): s=%s e=%d\n", s, (int) e); @@ -699,14 +699,14 @@ check_small (void) /* 5592117679628511*2^165 ~ .26153245263757307000000000000000000074*10^66 */ mpfr_set_str_binary (x, "10011110111100000000001011011110101100010000011011111E165"); - s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDU); if (strcmp (s, "26153245263757308") || e != 66) { printf ("Error in mpfr_get_str (46u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDD); if (strcmp (s, "26153245263757307") || e != 66) { printf ("Error in mpfr_get_str (46d): s=%s e=%d\n", s, (int) e); @@ -715,21 +715,21 @@ check_small (void) mpfr_free_str (s); mpfr_set_str_binary (x, "11010010110111100001011010000110010000100001011011101E1223"); - s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN); if (strcmp (s, "10716284017294180") || e != 385) { printf ("Error in mpfr_get_str (47n): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDU); if (strcmp (s, "107162840172941805") || e != 385) { printf ("Error in mpfr_get_str (47u): s=%s e=%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDD); if (strcmp (s, "107162840172941804") || e != 385) { printf ("Error in mpfr_get_str (47d): s=%s e=%d\n", s, (int) e); @@ -738,21 +738,21 @@ check_small (void) mpfr_free_str (s); mpfr_set_str_binary (x, "11111101111011000001010100001101101000010010001111E122620"); - s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN); if (strcmp (s, "22183435284042374") || e != 36928) { printf ("Error in mpfr_get_str (48n): s=%s e=%ld\n", s, (long) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDU); if (strcmp (s, "221834352840423736") || e != 36928) { printf ("Error in mpfr_get_str (48u): s=%s e=%ld\n", s, (long) e); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDD); if (strcmp (s, "221834352840423735") || e != 36928) { printf ("Error in mpfr_get_str (48d): s=%s e=%ld\n", s, (long) e); @@ -762,30 +762,30 @@ check_small (void) mpfr_set_prec (x, 45); mpfr_set_str_binary (x, "1E45"); - s = mpfr_get_str (NULL, &e, 32, 9, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 32, 9, x, MPFR_RNDN); mpfr_free_str (s); mpfr_set_prec (x, 7); mpfr_set_str_binary (x, "0.1010101E10"); - s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU); mpfr_free_str (s); /* checks rounding of negative numbers */ mpfr_set_prec (x, 7); - mpfr_set_str (x, "-11.5", 10, GMP_RNDN); - s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDD); + mpfr_set_str (x, "-11.5", 10, MPFR_RNDN); + s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDD); if (strcmp (s, "-12")) { - printf ("Error in mpfr_get_str for x=-11.5 and rnd=GMP_RNDD\n" + printf ("Error in mpfr_get_str for x=-11.5 and rnd=MPFR_RNDD\n" "got %s instead of -12\n", s); exit (1); } mpfr_free_str (s); - s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU); if (strcmp (s, "-11")) { - printf ("Error in mpfr_get_str for x=-11.5 and rnd=GMP_RNDU\n"); + printf ("Error in mpfr_get_str for x=-11.5 and rnd=MPFR_RNDU\n"); exit (1); } mpfr_free_str (s); @@ -793,12 +793,12 @@ check_small (void) /* bug found by Jean-Pierre Merlet, produced error in mpfr_get_str */ mpfr_set_prec (x, 128); mpfr_set_str_binary (x, "0.10111001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011010E3"); - s = mpfr_get_str (NULL, &e, 10, 0, x, GMP_RNDU); + s = mpfr_get_str (NULL, &e, 10, 0, x, MPFR_RNDU); mpfr_free_str (s); mpfr_set_prec (x, 381); mpfr_set_str_binary (x, "0.111111111111111111111111111111111111111111111111111111111111111111101110110000100110011101101101001010111000101111000100100011110101010110101110100000010100001000110100000100011111001000010010000010001010111001011110000001110010111101100001111000101101100000010110000101100100000101010110010110001010100111001111100011100101100000100100111001100010010011110011011010110000001000010"); - s = mpfr_get_str (NULL, &e, 10, 0, x, GMP_RNDD); + s = mpfr_get_str (NULL, &e, 10, 0, x, MPFR_RNDD); if (e != 0) { printf ("Error in mpfr_get_str for x=0.999999..., exponent is %d" @@ -920,9 +920,9 @@ check_large (void) mp_exp_t e; mpfr_init2 (x, 3322); - mpfr_set_str (x, xm, 10, GMP_RNDN); - mpfr_div_2exp (x, x, 4343, GMP_RNDN); - s = mpfr_get_str (NULL, &e, 10, 1000, x, GMP_RNDN); + mpfr_set_str (x, xm, 10, MPFR_RNDN); + mpfr_div_2exp (x, x, 4343, MPFR_RNDN); + s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN); if (s[999] != '1') /* s must be 5.04383...689071e-309 */ { printf ("Error in check_large: expected '689071', got '%s'\n", @@ -931,8 +931,8 @@ check_large (void) } mpfr_free_str (s); - mpfr_mul_2exp (x, x, 4343, GMP_RNDN); - s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDN); + mpfr_mul_2exp (x, x, 4343, MPFR_RNDN); + s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN); if (strcmp (s, "12") || (e != 1000)) { printf ("Error in check_large: expected 0.12e1000\n"); @@ -942,7 +942,7 @@ check_large (void) mpfr_free_str (s); mpfr_set_nan (x); - s = mpfr_get_str (NULL, &e, 10, 1000, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN); if (strcmp (s, "@NaN@")) { printf ("Error for NaN\n"); @@ -950,10 +950,10 @@ check_large (void) } mpfr_free_str (s); - mpfr_get_str (s1, &e, 10, 1000, x, GMP_RNDN); + mpfr_get_str (s1, &e, 10, 1000, x, MPFR_RNDN); mpfr_set_inf (x, 1); - s = mpfr_get_str (NULL, &e, 10, 1000, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN); if (strcmp (s, "@Inf@")) { printf ("Error for Inf\n"); @@ -961,10 +961,10 @@ check_large (void) } mpfr_free_str (s); - mpfr_get_str (s1, &e, 10, 1000, x, GMP_RNDN); + mpfr_get_str (s1, &e, 10, 1000, x, MPFR_RNDN); mpfr_set_inf (x, -1); - s = mpfr_get_str (NULL, &e, 10, 1000, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN); if (strcmp (s, "-@Inf@")) { printf ("Error for -Inf\n"); @@ -972,27 +972,27 @@ check_large (void) } mpfr_free_str (s); - mpfr_get_str (s1, &e, 10, 1000, x, GMP_RNDN); + mpfr_get_str (s1, &e, 10, 1000, x, MPFR_RNDN); - mpfr_set_ui (x, 0, GMP_RNDN); - s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN); if (e != 0 || strcmp (s, "00")) { printf ("Error for 0.0\n"); exit (1); } mpfr_free_str (s); - mpfr_get_str (s1, &e, 10, 2, x, GMP_RNDN); + mpfr_get_str (s1, &e, 10, 2, x, MPFR_RNDN); - mpfr_neg (x, x, GMP_RNDN); /* -0.0 */ - s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); /* -0.0 */ + s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN); if (e != 0 || strcmp (s, "-00")) { printf ("Error for -0.0\ngot %se%d\n", s, (int) e); exit (1); } mpfr_free_str (s); - mpfr_get_str (s1, &e, 10, 2, x, GMP_RNDN); + mpfr_get_str (s1, &e, 10, 2, x, MPFR_RNDN); mpfr_clear (x); } @@ -1010,19 +1010,19 @@ check_special (int b, mp_prec_t p) size_t m; /* check for invalid base */ - MPFR_ASSERTN(mpfr_get_str (s, &e, 1, 10, x, GMP_RNDN) == NULL); - MPFR_ASSERTN(mpfr_get_str (s, &e, 37, 10, x, GMP_RNDN) == NULL); + MPFR_ASSERTN(mpfr_get_str (s, &e, 1, 10, x, MPFR_RNDN) == NULL); + MPFR_ASSERTN(mpfr_get_str (s, &e, 37, 10, x, MPFR_RNDN) == NULL); s2[0] = '1'; for (i=1; i= 2) { mpfr_get_str (s, &e, b, i, x, (mp_rnd_t) r); @@ -1052,7 +1052,7 @@ check_special (int b, mp_prec_t p) } if (i >= 3) { - mpfr_get_str (s, &e, b, i - 1, x, GMP_RNDU); + mpfr_get_str (s, &e, b, i - 1, x, MPFR_RNDU); /* should be b^i */ if ((e != i+1) || strncmp (s, s2, i - 1) != 0) { @@ -1062,7 +1062,7 @@ check_special (int b, mp_prec_t p) } } - mpfr_add_ui (x, x, 1, GMP_RNDN); + mpfr_add_ui (x, x, 1, MPFR_RNDN); } mpfr_clear (x); } @@ -1082,10 +1082,10 @@ check_bug_base2k (void) mpfr_init2 (yy, 79); mpfr_init2 (zz, 99); - mpfr_set_str (xx, "-1.90e8c3e525d7c0000000000000@-18", 16, GMP_RNDN); - mpfr_set_str (yy, "-2.63b22b55697e8000000@130", 16, GMP_RNDN); - mpfr_add (zz, xx, yy, GMP_RNDD); - s = mpfr_get_str (NULL, &e, 16, 0, zz, GMP_RNDN); + mpfr_set_str (xx, "-1.90e8c3e525d7c0000000000000@-18", 16, MPFR_RNDN); + mpfr_set_str (yy, "-2.63b22b55697e8000000@130", 16, MPFR_RNDN); + mpfr_add (zz, xx, yy, MPFR_RNDD); + s = mpfr_get_str (NULL, &e, 16, 0, zz, MPFR_RNDN); if (strcmp (s, "-263b22b55697e8000000000008")) { printf ("Error for get_str base 16\n" @@ -1105,9 +1105,9 @@ check_reduced_exprange (void) emax = mpfr_get_emax (); mpfr_init2 (x, 8); - mpfr_set_str (x, "0.11111111E0", 2, GMP_RNDN); + mpfr_set_str (x, "0.11111111E0", 2, MPFR_RNDN); set_emax (0); - s = mpfr_get_str (NULL, &e, 16, 0, x, GMP_RNDN); + s = mpfr_get_str (NULL, &e, 16, 0, x, MPFR_RNDN); set_emax (emax); if (strcmp (s, "ff0")) { @@ -1160,23 +1160,23 @@ main (int argc, char *argv[]) mpfr_clear (x); check_large (); - check3 ("4.059650008e-83", GMP_RNDN, "40597"); - check3 ("-6.606499965302424244461355e233", GMP_RNDN, "-66065"); - check3 ("-7.4", GMP_RNDN, "-74000"); - check3 ("0.997", GMP_RNDN, "99700"); - check3 ("-4.53063926135729747564e-308", GMP_RNDN, "-45306"); - check3 ("2.14478198760196000000e+16", GMP_RNDN, "21448"); - check3 ("7.02293374921793516813e-84", GMP_RNDN, "70229"); - - check3 ("-6.7274500420134077e-87", GMP_RNDN, "-67275"); - check3 ("-6.7274500420134077e-87", GMP_RNDZ, "-67274"); - check3 ("-6.7274500420134077e-87", GMP_RNDU, "-67274"); - check3 ("-6.7274500420134077e-87", GMP_RNDD, "-67275"); - - check3 ("6.7274500420134077e-87", GMP_RNDN, "67275"); - check3 ("6.7274500420134077e-87", GMP_RNDZ, "67274"); - check3 ("6.7274500420134077e-87", GMP_RNDU, "67275"); - check3 ("6.7274500420134077e-87", GMP_RNDD, "67274"); + check3 ("4.059650008e-83", MPFR_RNDN, "40597"); + check3 ("-6.606499965302424244461355e233", MPFR_RNDN, "-66065"); + check3 ("-7.4", MPFR_RNDN, "-74000"); + check3 ("0.997", MPFR_RNDN, "99700"); + check3 ("-4.53063926135729747564e-308", MPFR_RNDN, "-45306"); + check3 ("2.14478198760196000000e+16", MPFR_RNDN, "21448"); + check3 ("7.02293374921793516813e-84", MPFR_RNDN, "70229"); + + check3 ("-6.7274500420134077e-87", MPFR_RNDN, "-67275"); + check3 ("-6.7274500420134077e-87", MPFR_RNDZ, "-67274"); + check3 ("-6.7274500420134077e-87", MPFR_RNDU, "-67274"); + check3 ("-6.7274500420134077e-87", MPFR_RNDD, "-67275"); + + check3 ("6.7274500420134077e-87", MPFR_RNDN, "67275"); + check3 ("6.7274500420134077e-87", MPFR_RNDZ, "67274"); + check3 ("6.7274500420134077e-87", MPFR_RNDU, "67275"); + check3 ("6.7274500420134077e-87", MPFR_RNDD, "67274"); check_bug_base2k (); check_reduced_exprange (); diff --git a/tests/tget_z.c b/tests/tget_z.c index d0af7a1c0..3191dfcd7 100644 --- a/tests/tget_z.c +++ b/tests/tget_z.c @@ -34,8 +34,8 @@ check_diff (void) mpz_init (z); mpfr_init2 (x, 2); - mpfr_set_ui (x, 2047, GMP_RNDU); - mpz_set_fr (z, x, GMP_RNDN); + mpfr_set_ui (x, 2047, MPFR_RNDU); + mpz_set_fr (z, x, MPFR_RNDN); if (mpz_cmp_ui (z, 2048) != 0) { printf ("get_z RU 2048 failed\n"); @@ -60,20 +60,20 @@ check_one (mpz_ptr z) for (neg = 0; neg <= 1; neg++) { mpz_neg (z, z); - mpfr_set_z (f, z, GMP_RNDN); + mpfr_set_z (f, z, MPFR_RNDN); if (sh < 0) { mpz_tdiv_q_2exp (z, z, -sh); - mpfr_div_2exp (f, f, -sh, GMP_RNDN); + mpfr_div_2exp (f, f, -sh, MPFR_RNDN); } else { mpz_mul_2exp (z, z, sh); - mpfr_mul_2exp (f, f, sh, GMP_RNDN); + mpfr_mul_2exp (f, f, sh, MPFR_RNDN); } - mpfr_get_z (got, f, GMP_RNDZ); + mpfr_get_z (got, f, MPFR_RNDZ); if (mpz_cmp (got, z) != 0) { diff --git a/tests/tgmpop.c b/tests/tgmpop.c index 2bbce4e23..f3391ac95 100644 --- a/tests/tgmpop.c +++ b/tests/tgmpop.c @@ -52,7 +52,7 @@ special (void) mpz_set_str (mpq_numref (z), "-187207494", 10); mpz_set_str (mpq_denref (z), "5721", 10); mpfr_set_str_binary (x, "11111111101001011011100101100011011110010011100010000100001E-44"); - mpfr_add_q (y, x, z, GMP_RNDN); + mpfr_add_q (y, x, z, MPFR_RNDN); CHECK_FOR ("cancelation in add_q", mpfr_cmp_ui_2exp (y, 256783, -64) == 0); mpfr_set_prec (x, 19); @@ -60,7 +60,7 @@ special (void) mpz_set_str (mpq_numref (z), "187207494", 10); mpz_set_str (mpq_denref (z), "5721", 10); mpfr_set_prec (y, 29); - mpfr_add_q (y, x, z, GMP_RNDD); + mpfr_add_q (y, x, z, MPFR_RNDD); mpfr_set_prec (x, 29); mpfr_set_str_binary (x, "11111111101001110011010001001E-14"); CHECK_FOR ("cancelation in add_q", mpfr_cmp (x,y) == 0); @@ -70,16 +70,16 @@ special (void) mpz_set_str (mpq_numref (z), "395877315", 10); mpz_set_str (mpq_denref (z), "3508975966", 10); mpfr_set_prec (y, 118); - mpfr_add_q (y, x, z, GMP_RNDU); + mpfr_add_q (y, x, z, MPFR_RNDU); CHECK_FOR ("inf", mpfr_inf_p (y) && mpfr_sgn (y) > 0); - mpfr_sub_q (y, x, z, GMP_RNDU); + mpfr_sub_q (y, x, z, MPFR_RNDU); CHECK_FOR ("inf", mpfr_inf_p (y) && mpfr_sgn (y) > 0); /* Nan */ MPFR_SET_NAN (x); - mpfr_add_q (y, x, z, GMP_RNDU); + mpfr_add_q (y, x, z, MPFR_RNDU); CHECK_FOR ("nan", mpfr_nan_p (y)); - mpfr_sub_q (y, x, z, GMP_RNDU); + mpfr_sub_q (y, x, z, MPFR_RNDU); CHECK_FOR ("nan", mpfr_nan_p (y)); /* Exact value */ @@ -88,36 +88,36 @@ special (void) mpfr_set_str1 (x, "0.5"); mpz_set_str (mpq_numref (z), "3", 10); mpz_set_str (mpq_denref (z), "2", 10); - res = mpfr_add_q (y, x, z, GMP_RNDU); + res = mpfr_add_q (y, x, z, MPFR_RNDU); CHECK_FOR ("0.5+3/2", mpfr_cmp_ui(y, 2)==0 && res==0); - res = mpfr_sub_q (y, x, z, GMP_RNDU); + res = mpfr_sub_q (y, x, z, MPFR_RNDU); CHECK_FOR ("0.5-3/2", mpfr_cmp_si(y, -1)==0 && res==0); /* Inf Rationnal */ mpq_set_ui (z, 1, 0); mpfr_set_str1 (x, "0.5"); - res = mpfr_add_q (y, x, z, GMP_RNDN); + res = mpfr_add_q (y, x, z, MPFR_RNDN); CHECK_FOR ("0.5+1/0", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0); - res = mpfr_sub_q (y, x, z, GMP_RNDN); + res = mpfr_sub_q (y, x, z, MPFR_RNDN); CHECK_FOR ("0.5-1/0", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0); mpq_set_si (z, -1, 0); - res = mpfr_add_q (y, x, z, GMP_RNDN); + res = mpfr_add_q (y, x, z, MPFR_RNDN); CHECK_FOR ("0.5+ -1/0", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0); - res = mpfr_sub_q (y, x, z, GMP_RNDN); + res = mpfr_sub_q (y, x, z, MPFR_RNDN); CHECK_FOR ("0.5- -1/0", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0); - res = mpfr_div_q (y, x, z, GMP_RNDN); + res = mpfr_div_q (y, x, z, MPFR_RNDN); CHECK_FOR ("0.5 / (-1/0)", mpfr_zero_p (y) && MPFR_SIGN (y) < 0 && res == 0); /* 0 */ mpq_set_ui (z, 0, 1); - mpfr_set_ui (x, 42, GMP_RNDN); - res = mpfr_add_q (y, x, z, GMP_RNDN); + mpfr_set_ui (x, 42, MPFR_RNDN); + res = mpfr_add_q (y, x, z, MPFR_RNDN); CHECK_FOR ("42+0/1", mpfr_cmp_ui (y, 42) == 0 && res == 0); - res = mpfr_sub_q (y, x, z, GMP_RNDN); + res = mpfr_sub_q (y, x, z, MPFR_RNDN); CHECK_FOR ("42-0/1", mpfr_cmp_ui (y, 42) == 0 && res == 0); - res = mpfr_mul_q (y, x, z, GMP_RNDN); + res = mpfr_mul_q (y, x, z, MPFR_RNDN); CHECK_FOR ("42*0/1", mpfr_zero_p (y) && MPFR_SIGN (y) > 0 && res == 0); - res = mpfr_div_q (y, x, z, GMP_RNDN); + res = mpfr_div_q (y, x, z, MPFR_RNDN); CHECK_FOR ("42/(0/1)", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0); @@ -219,7 +219,7 @@ test_cmp_z (mp_prec_t pmin, mp_prec_t pmax, int nmax) mpz_urandomb (y, RANDS, 1024); if (!MPFR_IS_SINGULAR (x)) { - mpfr_sub_z (z, x, y, GMP_RNDN); + mpfr_sub_z (z, x, y, MPFR_RNDN); res1 = mpfr_sgn (z); res2 = mpfr_cmp_z (x, y); if (res1 != res2) @@ -257,7 +257,7 @@ test_cmp_q (mp_prec_t pmin, mp_prec_t pmax, int nmax) mpq_set_ui (y, randlimb (), randlimb() ); if (!MPFR_IS_SINGULAR (x)) { - mpfr_sub_q (z, x, y, GMP_RNDN); + mpfr_sub_q (z, x, y, MPFR_RNDN); res1 = mpfr_sgn (z); res2 = mpfr_cmp_q (x, y); if (res1 != res2) @@ -296,8 +296,8 @@ test_cmp_f (mp_prec_t pmin, mp_prec_t pmax, int nmax) mpf_urandomb (y, RANDS, p); if (!MPFR_IS_SINGULAR (x)) { - mpfr_set_f (z, y, GMP_RNDN); - mpfr_sub (z, x, z, GMP_RNDN); + mpfr_set_f (z, y, MPFR_RNDN); + mpfr_sub (z, x, z, MPFR_RNDN); res1 = mpfr_sgn (z); res2 = mpfr_cmp_f (x, y); if (res1 != res2) @@ -330,13 +330,13 @@ test_specialz (int (*mpfr_func)(mpfr_ptr, mpfr_srcptr, mpz_srcptr, mp_rnd_t), mpz_fac_ui (z2, 20); /* 20!+1 fits perfectly in a 128 bits mantissa */ mpz_add_ui (z2, z2, 1); - res = mpfr_set_z(x1, z1, GMP_RNDN); + res = mpfr_set_z(x1, z1, MPFR_RNDN); if (res) { printf("Specialz %s: set_z1 error\n", op); exit(1); } - mpfr_set_z (x2, z2, GMP_RNDN); + mpfr_set_z (x2, z2, MPFR_RNDN); if (res) { printf("Specialz %s: set_z2 error\n", op); @@ -344,14 +344,14 @@ test_specialz (int (*mpfr_func)(mpfr_ptr, mpfr_srcptr, mpz_srcptr, mp_rnd_t), } /* (19!+1) * (20!+1) fits in a 128 bits number */ - res = mpfr_func(x1, x1, z2, GMP_RNDN); + res = mpfr_func(x1, x1, z2, MPFR_RNDN); if (res) { printf("Specialz %s: wrong inexact flag.\n", op); exit(1); } mpz_func(z1, z1, z2); - res = mpfr_set_z (x2, z1, GMP_RNDN); + res = mpfr_set_z (x2, z1, MPFR_RNDN); if (res) { printf("Specialz %s: set_z2 error\n", op); @@ -371,10 +371,10 @@ test_specialz (int (*mpfr_func)(mpfr_ptr, mpfr_srcptr, mpz_srcptr, mp_rnd_t), mpz_set_ui (z1, 1); mpz_set_ui (z2, 0); - mpfr_set_ui (x1, 1, GMP_RNDN); + mpfr_set_ui (x1, 1, MPFR_RNDN); mpz_func (z1, z1, z2); - res = mpfr_func(x1, x1, z2, GMP_RNDN); - mpfr_set_z (x2, z1, GMP_RNDN); + res = mpfr_func(x1, x1, z2, MPFR_RNDN); + mpfr_set_z (x2, z1, MPFR_RNDN); if (mpfr_cmp(x1, x2)) { printf("Specialz %s: results differ(2).\nx1=", op); @@ -569,11 +569,11 @@ test_specialq (mp_prec_t p0, mp_prec_t p1, unsigned int N, mpq_canonicalize (q1); mpq_canonicalize (q2); mpq_func (qr, q1, q2); - mpfr_set_q (fra, q1, GMP_RNDD); - mpfr_func (fra, fra, q2, GMP_RNDD); - mpfr_set_q (frb, q1, GMP_RNDU); - mpfr_func (frb, frb, q2, GMP_RNDU); - mpfr_set_q (frq, qr, GMP_RNDN); + mpfr_set_q (fra, q1, MPFR_RNDD); + mpfr_func (fra, fra, q2, MPFR_RNDD); + mpfr_set_q (frb, q1, MPFR_RNDU); + mpfr_func (frb, frb, q2, MPFR_RNDU); + mpfr_set_q (frq, qr, MPFR_RNDN); /* We should have fra <= qr <= frb */ if ( (mpfr_cmp(fra, frq) > 0) || (mpfr_cmp (frq, frb) > 0)) { diff --git a/tests/thyperbolic.c b/tests/thyperbolic.c index 2c05989b7..660c64cda 100644 --- a/tests/thyperbolic.c +++ b/tests/thyperbolic.c @@ -43,7 +43,7 @@ check_NAN (void) /******cosh********/ - tester=mpfr_cosh(ch,t,GMP_RNDD); + tester=mpfr_cosh(ch,t,MPFR_RNDD); if (!MPFR_IS_NAN(ch) || tester!=0) { printf("cosh NAN \n"); @@ -53,7 +53,7 @@ check_NAN (void) /******sinh********/ - tester=mpfr_sinh(sh,t,GMP_RNDD); + tester=mpfr_sinh(sh,t,MPFR_RNDD); if (!MPFR_IS_NAN(sh) || tester!=0) { printf("sinh NAN \n"); @@ -63,7 +63,7 @@ check_NAN (void) /******tanh********/ - tester=mpfr_tanh(th,t,GMP_RNDD); + tester=mpfr_tanh(th,t,MPFR_RNDD); if (!MPFR_IS_NAN(th) || tester!=0) { printf("tanh NAN \n"); @@ -73,7 +73,7 @@ check_NAN (void) /******acosh********/ - tester=mpfr_acosh(ach,t,GMP_RNDD); + tester=mpfr_acosh(ach,t,MPFR_RNDD); if (!MPFR_IS_NAN(ach) || tester!=0) { printf("acosh NAN \n"); @@ -83,7 +83,7 @@ check_NAN (void) /******asinh********/ - tester=mpfr_asinh(ash,t,GMP_RNDD); + tester=mpfr_asinh(ash,t,MPFR_RNDD); if (!MPFR_IS_NAN(ash) || tester!=0) { printf("asinh NAN \n"); @@ -93,7 +93,7 @@ check_NAN (void) /******atanh********/ - tester=mpfr_atanh(ath,t,GMP_RNDD); + tester=mpfr_atanh(ath,t,MPFR_RNDD); if (!MPFR_IS_NAN(ath) || tester!=0) { printf("atanh NAN \n"); @@ -128,11 +128,11 @@ check_zero (void) mpfr_init2(ash,200); mpfr_init2(ath,200); - mpfr_set_ui(t,0,GMP_RNDD); + mpfr_set_ui(t,0,MPFR_RNDD); /******cosh********/ - tester = mpfr_cosh (ch, t, GMP_RNDD); + tester = mpfr_cosh (ch, t, MPFR_RNDD); if (mpfr_cmp_ui(ch, 1) || tester) { printf("cosh(0) \n"); @@ -142,7 +142,7 @@ check_zero (void) /******sinh********/ - tester = mpfr_sinh (sh, t, GMP_RNDD); + tester = mpfr_sinh (sh, t, MPFR_RNDD); if (!MPFR_IS_ZERO(sh) || tester) { printf("sinh(0) \n"); @@ -152,7 +152,7 @@ check_zero (void) /******tanh********/ - tester = mpfr_tanh (th, t, GMP_RNDD); + tester = mpfr_tanh (th, t, MPFR_RNDD); if (!MPFR_IS_ZERO(th) || tester) { printf("tanh(0) \n"); @@ -162,7 +162,7 @@ check_zero (void) /******acosh********/ - tester=mpfr_acosh(ach,t,GMP_RNDD); + tester=mpfr_acosh(ach,t,MPFR_RNDD); if (!MPFR_IS_NAN(ach) || tester) { printf("acosh(0) \n"); @@ -172,7 +172,7 @@ check_zero (void) /******asinh********/ - tester=mpfr_asinh(ash,t,GMP_RNDD); + tester=mpfr_asinh(ash,t,MPFR_RNDD); if (!MPFR_IS_ZERO(ash) || tester) { printf("asinh(0) \n"); @@ -182,7 +182,7 @@ check_zero (void) /******atanh********/ - tester=mpfr_atanh(ath,t,GMP_RNDD); + tester=mpfr_atanh(ath,t,MPFR_RNDD); if (!MPFR_IS_ZERO(ath) || tester) { printf("atanh(0) \n"); @@ -224,7 +224,7 @@ check_INF (void) /******cosh********/ - tester = mpfr_cosh(ch,t,GMP_RNDD); + tester = mpfr_cosh(ch,t,MPFR_RNDD); if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0) { printf("cosh(INF) \n"); @@ -234,7 +234,7 @@ check_INF (void) /******sinh********/ - tester=mpfr_sinh(sh,t,GMP_RNDD); + tester=mpfr_sinh(sh,t,MPFR_RNDD); if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) < 0 || tester!=0) { printf("sinh(INF) \n"); @@ -244,7 +244,7 @@ check_INF (void) /******tanh********/ - tester=mpfr_tanh(th,t,GMP_RNDD); + tester=mpfr_tanh(th,t,MPFR_RNDD); if (mpfr_cmp_ui(th,1) != 0 || tester!=0) { printf("tanh(INF) \n"); @@ -254,7 +254,7 @@ check_INF (void) /******acosh********/ - tester=mpfr_acosh(ach,t,GMP_RNDD); + tester=mpfr_acosh(ach,t,MPFR_RNDD); if (!MPFR_IS_INF(ach) || MPFR_SIGN(ach) < 0 || tester!=0) { printf("acosh(INF) \n"); @@ -264,7 +264,7 @@ check_INF (void) /******asinh********/ - tester=mpfr_asinh(ash,t,GMP_RNDD); + tester=mpfr_asinh(ash,t,MPFR_RNDD); if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) < 0 || tester!=0) { printf("asinh(INF) \n"); @@ -274,7 +274,7 @@ check_INF (void) /******atanh********/ - tester = mpfr_atanh (ath, t, GMP_RNDD); + tester = mpfr_atanh (ath, t, MPFR_RNDD); if (!MPFR_IS_NAN(ath) || tester != 0) { printf("atanh(INF) \n"); @@ -286,7 +286,7 @@ check_INF (void) /******cosh********/ - tester=mpfr_cosh(ch,t,GMP_RNDD); + tester=mpfr_cosh(ch,t,MPFR_RNDD); if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0) { printf("cosh(-INF) \n"); @@ -296,7 +296,7 @@ check_INF (void) /******sinh********/ - tester=mpfr_sinh(sh,t,GMP_RNDD); + tester=mpfr_sinh(sh,t,MPFR_RNDD); if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) > 0 || tester!=0) { printf("sinh(-INF) \n"); @@ -306,7 +306,7 @@ check_INF (void) /******tanh********/ - tester=mpfr_tanh(th,t,GMP_RNDD); + tester=mpfr_tanh(th,t,MPFR_RNDD); if (!mpfr_cmp_ui(th,-1) || tester!=0) { printf("tanh(-INF) \n"); @@ -316,7 +316,7 @@ check_INF (void) /******acosh********/ - tester=mpfr_acosh(ach,t,GMP_RNDD); + tester=mpfr_acosh(ach,t,MPFR_RNDD); if (!MPFR_IS_NAN(ach) || tester!=0) { printf("acosh(-INF) \n"); @@ -326,7 +326,7 @@ check_INF (void) /******asinh********/ - tester=mpfr_asinh(ash,t,GMP_RNDD); + tester=mpfr_asinh(ash,t,MPFR_RNDD); if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) > 0 || tester!=0) { printf("asinh(-INF) \n"); @@ -336,7 +336,7 @@ check_INF (void) /******atanh********/ - tester = mpfr_atanh (ath, t, GMP_RNDD); + tester = mpfr_atanh (ath, t, MPFR_RNDD); if (!MPFR_IS_NAN(ath) || tester != 0) { printf("atanh(-INF) \n"); diff --git a/tests/thypot.c b/tests/thypot.c index 23561fb0c..3f5bdd316 100644 --- a/tests/thypot.c +++ b/tests/thypot.c @@ -39,22 +39,22 @@ special (void) mpfr_init (z); mpfr_set_nan (x); - mpfr_hypot (z, x, y, GMP_RNDN); + mpfr_hypot (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (z)); mpfr_set_inf (x, 1); mpfr_set_inf (y, -1); - mpfr_hypot (z, x, y, GMP_RNDN); + mpfr_hypot (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (z) && mpfr_sgn (z) > 0); mpfr_set_inf (x, -1); mpfr_set_nan (y); - mpfr_hypot (z, x, y, GMP_RNDN); + mpfr_hypot (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (z) && mpfr_sgn (z) > 0); mpfr_set_nan (x); mpfr_set_inf (y, -1); - mpfr_hypot (z, x, y, GMP_RNDN); + mpfr_hypot (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (z) && mpfr_sgn (z) > 0); mpfr_clear (x); @@ -72,21 +72,21 @@ test_large (void) mpfr_init (z); mpfr_init (t); - mpfr_set_ui (x, 21, GMP_RNDN); - mpfr_set_ui (y, 28, GMP_RNDN); - mpfr_set_ui (z, 35, GMP_RNDN); + mpfr_set_ui (x, 21, MPFR_RNDN); + mpfr_set_ui (y, 28, MPFR_RNDN); + mpfr_set_ui (z, 35, MPFR_RNDN); - mpfr_mul_2ui (x, x, MPFR_EMAX_DEFAULT-6, GMP_RNDN); - mpfr_mul_2ui (y, y, MPFR_EMAX_DEFAULT-6, GMP_RNDN); - mpfr_mul_2ui (z, z, MPFR_EMAX_DEFAULT-6, GMP_RNDN); + mpfr_mul_2ui (x, x, MPFR_EMAX_DEFAULT-6, MPFR_RNDN); + mpfr_mul_2ui (y, y, MPFR_EMAX_DEFAULT-6, MPFR_RNDN); + mpfr_mul_2ui (z, z, MPFR_EMAX_DEFAULT-6, MPFR_RNDN); - mpfr_hypot (t, x, y, GMP_RNDN); + mpfr_hypot (t, x, y, MPFR_RNDN); if (mpfr_cmp (z, t)) { printf ("Error in test_large: got\n"); - mpfr_out_str (stdout, 2, 0, t, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, t, MPFR_RNDN); printf ("\ninstead of\n"); - mpfr_out_str (stdout, 2, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); printf ("\n"); exit (1); } @@ -96,14 +96,14 @@ test_large (void) mpfr_set_prec (y, 53); mpfr_set_str_binary (x, "0.11101100011110000011101000010101010011001101000001100E-1021"); mpfr_set_str_binary (y, "0.11111001010011000001110110001101011100001000010010100E-1021"); - mpfr_hypot (t, x, y, GMP_RNDN); + mpfr_hypot (t, x, y, MPFR_RNDN); mpfr_set_str_binary (z, "0.101010111100110111101110111110100110010011001010111E-1020"); if (mpfr_cmp (z, t)) { printf ("Error in test_large: got\n"); - mpfr_out_str (stdout, 2, 0, t, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, t, MPFR_RNDN); printf ("\ninstead of\n"); - mpfr_out_str (stdout, 2, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); printf ("\n"); exit (1); } @@ -114,14 +114,14 @@ test_large (void) mpfr_set_prec (t, 2); mpfr_set_str_binary (x, "0.100111011010010010110100000100000001100010011100110101101111111101011110111011011101010110100101111000111100010100110000100101011110111011100110100110100101110101101100011000001100000001111101110100100100011011011010110111100110010101000111e-7"); mpfr_set_str_binary (y, "0.1111000010000011000111E-10"); - mpfr_hypot (t, x, y, GMP_RNDN); + mpfr_hypot (t, x, y, MPFR_RNDN); mpfr_set_str_binary (z, "0.11E-7"); if (mpfr_cmp (z, t)) { printf ("Error in test_large: got\n"); - mpfr_out_str (stdout, 2, 0, t, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, t, MPFR_RNDN); printf ("\ninstead of\n"); - mpfr_out_str (stdout, 2, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); printf ("\n"); exit (1); } @@ -141,22 +141,22 @@ test_small (void) /* Test hypot(x,x) with x = 2^(emin-1). Result is x * sqrt(2). */ mpfr_inits2 (8, x, y, z1, z2, (mpfr_ptr) 0); - mpfr_set_si_2exp (x, 1, mpfr_get_emin () - 1, GMP_RNDN); - mpfr_set_si_2exp (y, 1, mpfr_get_emin () - 1, GMP_RNDN); - mpfr_set_ui (z1, 2, GMP_RNDN); - inex1 = mpfr_sqrt (z1, z1, GMP_RNDN); - inex2 = mpfr_mul (z1, z1, x, GMP_RNDN); + mpfr_set_si_2exp (x, 1, mpfr_get_emin () - 1, MPFR_RNDN); + mpfr_set_si_2exp (y, 1, mpfr_get_emin () - 1, MPFR_RNDN); + mpfr_set_ui (z1, 2, MPFR_RNDN); + inex1 = mpfr_sqrt (z1, z1, MPFR_RNDN); + inex2 = mpfr_mul (z1, z1, x, MPFR_RNDN); MPFR_ASSERTN (inex2 == 0); mpfr_clear_flags (); - inex2 = mpfr_hypot (z2, x, y, GMP_RNDN); + inex2 = mpfr_hypot (z2, x, y, MPFR_RNDN); flags = __gmpfr_flags; if (mpfr_cmp (z1, z2) != 0) { printf ("Error in test_small%s\nExpected ", ext ? ", extended exponent range" : ""); - mpfr_out_str (stdout, 2, 0, z1, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, z1, MPFR_RNDN); printf ("\nGot "); - mpfr_out_str (stdout, 2, 0, z2, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, z2, MPFR_RNDN); printf ("\n"); exit (1); } @@ -186,9 +186,9 @@ test_large_small (void) mpfr_init2 (y, 2); mpfr_init2 (z, 2); - mpfr_set_ui_2exp (x, 1, mpfr_get_emax () / 2, GMP_RNDN); - mpfr_set_ui_2exp (y, 1, -1, GMP_RNDN); - inexact = mpfr_hypot (z, x, y, GMP_RNDN); + mpfr_set_ui_2exp (x, 1, mpfr_get_emax () / 2, MPFR_RNDN); + mpfr_set_ui_2exp (y, 1, -1, MPFR_RNDN); + inexact = mpfr_hypot (z, x, y, MPFR_RNDN); if (inexact >= 0 || mpfr_cmp (x, z)) { printf ("Error 1 in test_large_small%s\n", @@ -196,30 +196,30 @@ test_large_small (void) exit (1); } - mpfr_mul_ui (x, x, 5, GMP_RNDN); - inexact = mpfr_hypot (z, x, y, GMP_RNDN); + mpfr_mul_ui (x, x, 5, MPFR_RNDN); + inexact = mpfr_hypot (z, x, y, MPFR_RNDN); if (mpfr_cmp (x, z) >= 0) { printf ("Error 2 in test_large_small%s\n", ext ? ", extended exponent range" : ""); printf ("x = "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); printf ("y = "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); printf ("z = "); - mpfr_out_str (stdout, 2, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); printf (" (in precision 2) instead of\n "); - mpfr_out_str (stdout, 2, 2, x, GMP_RNDU); + mpfr_out_str (stdout, 2, 2, x, MPFR_RNDU); printf ("\n"); exit (1); } RND_LOOP(r) { - mpfr_set_ui_2exp (x, 1, mpfr_get_emax () - 1, GMP_RNDN); - mpfr_set_ui_2exp (y, 1, mpfr_get_emin (), GMP_RNDN); + mpfr_set_ui_2exp (x, 1, mpfr_get_emax () - 1, MPFR_RNDN); + mpfr_set_ui_2exp (y, 1, mpfr_get_emin (), MPFR_RNDN); inexact = mpfr_hypot (z, x, y, (mp_rnd_t) r); inex2 = mpfr_add_ui (y, x, 1, (mp_rnd_t) r); if (! mpfr_equal_p (y, z) || ! SAME_SIGN (inexact, inex2)) @@ -228,10 +228,10 @@ test_large_small (void) mpfr_print_rnd_mode ((mp_rnd_t) r), ext ? ", extended exponent range" : ""); printf ("Expected "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf (", inex = %d\n", inex2); printf ("Got "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf (", inex = %d\n", inexact); exit (1); } @@ -249,7 +249,7 @@ check_overflow (void) int inex, r; mpfr_inits2 (8, x, y, (mpfr_ptr) 0); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_setmax (x, mpfr_get_emax ()); RND_LOOP(r) @@ -264,7 +264,7 @@ check_overflow (void) exit (1); } MPFR_ASSERTN (MPFR_IS_POS (y)); - if (r == GMP_RNDZ || r == GMP_RNDD) + if (r == MPFR_RNDZ || r == MPFR_RNDD) { MPFR_ASSERTN (inex < 0); MPFR_ASSERTN (!mpfr_inf_p (y)); diff --git a/tests/tinp_str.c b/tests/tinp_str.c index 188f7e234..d61bbf1b3 100644 --- a/tests/tinp_str.c +++ b/tests/tinp_str.c @@ -42,7 +42,7 @@ main (int argc, char *argv[]) printf ("Error, can't open inp_str.data\n"); exit (1); } - i = mpfr_inp_str (x, f, 10, GMP_RNDN); + i = mpfr_inp_str (x, f, 10, MPFR_RNDN); if (i == 0 || mpfr_cmp_ui (x, 31415)) { printf ("Error in reading 1st line from file inp_str.data (%d)\n", i); @@ -50,7 +50,7 @@ main (int argc, char *argv[]) exit (1); } getc (f); - i = mpfr_inp_str (x, f, 10, GMP_RNDN); + i = mpfr_inp_str (x, f, 10, MPFR_RNDN); if ((i == 0) || mpfr_cmp_ui (x, 31416)) { printf ("Error in reading 2nd line from file inp_str.data (%d)\n", i); @@ -58,7 +58,7 @@ main (int argc, char *argv[]) exit (1); } getc (f); - i = mpfr_inp_str (x, f, 10, GMP_RNDN); + i = mpfr_inp_str (x, f, 10, MPFR_RNDN); if (i != 0) { printf ("Error in reading 3rd line from file inp_str.data (%d)\n", i); diff --git a/tests/tinternals.c b/tests/tinternals.c index 91cc9d5b6..141ee3835 100644 --- a/tests/tinternals.c +++ b/tests/tinternals.c @@ -60,14 +60,14 @@ test_round_near_x (void) mpfr_set_prec (y, 3); mpfr_set_prec (z, 3); mpfr_set_prec (eps, 2); - mpfr_set_ui_2exp (eps, 1, -32, GMP_RNDN); + mpfr_set_ui_2exp (eps, 1, -32, MPFR_RNDN); for (mx = 16; mx < 32; mx++) { - mpfr_set_ui_2exp (x, mx, -2, GMP_RNDN); + mpfr_set_ui_2exp (x, mx, -2, MPFR_RNDN); for (p = buffer, neg = 0; neg <= 1; - mpfr_neg (x, x, GMP_RNDN), p++, neg++) + mpfr_neg (x, x, MPFR_RNDN), p++, neg++) for (err = 2; err <= 6; err++) for (dir = 0; dir <= 1; dir++) RND_LOOP(r) @@ -91,11 +91,11 @@ test_round_near_x (void) else { printf ("Bad MPFR value (should have got "); - mpfr_out_str (stdout, 2, 3, z, GMP_RNDZ); + mpfr_out_str (stdout, 2, 3, z, MPFR_RNDZ); printf (") for:\n"); } - if (!mpfr_get_str (buffer, &e, 2, 5, x, GMP_RNDZ) || e != 3) + if (!mpfr_get_str (buffer, &e, 2, 5, x, MPFR_RNDZ) || e != 3) { printf ("mpfr_get_str failed in test_round_near_x\n"); exit (1); @@ -107,7 +107,7 @@ test_round_near_x (void) if (inex != 0) { printf (", y = "); - mpfr_out_str (stdout, 2, 3, y, GMP_RNDZ); + mpfr_out_str (stdout, 2, 3, y, MPFR_RNDZ); } printf ("\n"); if (inex == 0) diff --git a/tests/tisnan.c b/tests/tisnan.c index 0f1c5678b..460c95e85 100644 --- a/tests/tisnan.c +++ b/tests/tisnan.c @@ -35,8 +35,8 @@ main (void) mpfr_init (x); /* check +infinity gives non-zero for mpfr_inf_p only */ - mpfr_set_ui (x, 1L, GMP_RNDZ); - mpfr_div_ui (x, x, 0L, GMP_RNDZ); + mpfr_set_ui (x, 1L, MPFR_RNDZ); + mpfr_div_ui (x, x, 0L, MPFR_RNDZ); if (mpfr_nan_p (x) || (mpfr_nan_p) (x) ) { printf ("Error: mpfr_nan_p(+Inf) gives non-zero\n"); @@ -59,7 +59,7 @@ main (void) } /* same for -Inf */ - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); if (mpfr_nan_p (x) || (mpfr_nan_p(x))) { printf ("Error: mpfr_nan_p(-Inf) gives non-zero\n"); @@ -82,7 +82,7 @@ main (void) } /* same for NaN */ - mpfr_sub (x, x, x, GMP_RNDN); + mpfr_sub (x, x, x, MPFR_RNDN); if (mpfr_nan_p (x) == 0) { printf ("Error: mpfr_nan_p(NaN) gives zero\n"); @@ -105,7 +105,7 @@ main (void) } /* same for an ordinary number */ - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); if (mpfr_nan_p (x) || (mpfr_nan_p)(x)) { printf ("Error: mpfr_nan_p(1) gives non-zero\n"); @@ -128,7 +128,7 @@ main (void) } /* Same for 0 */ - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); if (mpfr_nan_p (x) || (mpfr_nan_p)(x)) { printf ("Error: mpfr_nan_p(0) gives non-zero\n"); diff --git a/tests/tj0.c b/tests/tj0.c index 40b625848..28d6bd6d7 100644 --- a/tests/tj0.c +++ b/tests/tj0.c @@ -42,60 +42,60 @@ main (int argc, char *argv[]) /* special values */ mpfr_set_nan (x); - mpfr_j0 (y, x, GMP_RNDN); + mpfr_j0 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); mpfr_set_inf (x, 1); /* +Inf */ - mpfr_j0 (y, x, GMP_RNDN); + mpfr_j0 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); mpfr_set_inf (x, -1); /* -Inf */ - mpfr_j0 (y, x, GMP_RNDN); + mpfr_j0 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); - mpfr_set_ui (x, 0, GMP_RNDN); /* +0 */ - mpfr_j0 (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */ + mpfr_j0 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); /* j0(+0)=1 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); /* -0 */ - mpfr_j0 (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); /* -0 */ + mpfr_j0 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); /* j0(-0)=1 */ mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_j0 (y, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_j0 (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.1100001111100011111111101101111010111101110001111"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_j0 for x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_j0 for x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_j0 (y, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_j0 (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.1100001111100011111111101101111010111101110001111"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_j0 for x=-1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_j0 for x=-1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } /* Bug reported on 2007-07-03 by Sisyphus (assertion failed in r4619) */ - mpfr_set_si (x, 70000, GMP_RNDN); - mpfr_j0 (y, x, GMP_RNDN); + mpfr_set_si (x, 70000, MPFR_RNDN); + mpfr_j0 (y, x, MPFR_RNDN); /* Bug reported by Kevin Rauch on 27 Oct 2007 */ mpfr_set_prec (x, 7); mpfr_set_prec (y, 7); - mpfr_set_si (x, -100, GMP_RNDN); - mpfr_j0 (y, x, GMP_RNDN); + mpfr_set_si (x, -100, MPFR_RNDN); + mpfr_j0 (y, x, MPFR_RNDN); MPFR_ASSERTN (! mpfr_nan_p (y) && mpfr_cmp_ui_2exp (y, 41, -11) == 0); mpfr_clear (x); diff --git a/tests/tj1.c b/tests/tj1.c index c6be96dcd..4fe0b4bf9 100644 --- a/tests/tj1.c +++ b/tests/tj1.c @@ -42,35 +42,35 @@ main (int argc, char *argv[]) /* special values */ mpfr_set_nan (x); - mpfr_j1 (y, x, GMP_RNDN); + mpfr_j1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); mpfr_set_inf (x, 1); /* +Inf */ - mpfr_j1 (y, x, GMP_RNDN); + mpfr_j1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); mpfr_set_inf (x, -1); /* -Inf */ - mpfr_j1 (y, x, GMP_RNDN); + mpfr_j1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); - mpfr_set_ui (x, 0, GMP_RNDN); /* +0 */ - mpfr_j1 (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */ + mpfr_j1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j1(+0)=+0 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); /* -0 */ - mpfr_j1 (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); /* -0 */ + mpfr_j1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG (y)); /* j1(-0)=-0 */ mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_j1 (y, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_j1 (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.0111000010100111001001111011101001011100001100011011"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_j1 for x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_j1 for x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); diff --git a/tests/tjn.c b/tests/tjn.c index 8a8fc5119..2180a05f5 100644 --- a/tests/tjn.c +++ b/tests/tjn.c @@ -35,9 +35,9 @@ main (int argc, char *argv[]) if (argc > 1) { mpfr_init2 (x, atoi (argv[1])); - mpfr_set_str (x, argv[3], 10, GMP_RNDN); - mpfr_jn (x, atoi (argv[2]), x, GMP_RNDN); - mpfr_out_str (stdout, 10, 10, x, GMP_RNDN); + mpfr_set_str (x, argv[3], 10, MPFR_RNDN); + mpfr_jn (x, atoi (argv[2]), x, MPFR_RNDN); + mpfr_out_str (stdout, 10, 10, x, MPFR_RNDN); printf ("\n"); mpfr_clear (x); return 0; @@ -50,201 +50,201 @@ main (int argc, char *argv[]) /* special values */ mpfr_set_nan (x); - mpfr_jn (y, 17, x, GMP_RNDN); + mpfr_jn (y, 17, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); mpfr_set_inf (x, 1); /* +Inf */ - mpfr_jn (y, 17, x, GMP_RNDN); + mpfr_jn (y, 17, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); mpfr_set_inf (x, -1); /* -Inf */ - mpfr_jn (y, 17, x, GMP_RNDN); + mpfr_jn (y, 17, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); - mpfr_set_ui (x, 0, GMP_RNDN); /* +0 */ - mpfr_jn (y, 0, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */ + mpfr_jn (y, 0, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); /* j0(+0)=1 */ - mpfr_jn (y, 17, x, GMP_RNDN); + mpfr_jn (y, 17, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j17(+0)=+0 */ - mpfr_jn (y, -17, x, GMP_RNDN); + mpfr_jn (y, -17, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG (y)); /* j-17(+0)=-0 */ - mpfr_jn (y, 42, x, GMP_RNDN); + mpfr_jn (y, 42, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j42(+0)=+0 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); /* -0 */ - mpfr_jn (y, 0, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); /* -0 */ + mpfr_jn (y, 0, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); /* j0(-0)=1 */ - mpfr_jn (y, 17, x, GMP_RNDN); + mpfr_jn (y, 17, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG (y)); /* j17(-0)=-0 */ - mpfr_jn (y, -17, x, GMP_RNDN); + mpfr_jn (y, -17, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j-17(-0)=+0 */ - mpfr_jn (y, 42, x, GMP_RNDN); + mpfr_jn (y, 42, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j42(-0)=+0 */ mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_jn (y, 0, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_jn (y, 0, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.1100001111100011111111101101111010111101110001111"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=0, x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=0, x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_jn (y, 0, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_jn (y, 0, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.1100001111100011111111101101111010111101110001111"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=0, x=-1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=0, x=-1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_jn (y, 1, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_jn (y, 1, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.0111000010100111001001111011101001011100001100011011"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=1, x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=1, x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_jn (y, 17, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_jn (y, 17, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.1100011111001010101001001001000110110000010001011E-65"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=17, x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=17, x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_jn (y, 42, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_jn (y, 42, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.10000111100011010100111011100111101101000100000001001E-211"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=42, x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=42, x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_jn (y, -42, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_jn (y, -42, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.10000111100011010100111011100111101101000100000001001E-211"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=-42, x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=-42, x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_jn (y, 42, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_jn (y, 42, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.10000111100011010100111011100111101101000100000001001E-211"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=42, x=-1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=42, x=-1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_jn (y, -42, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_jn (y, -42, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.10000111100011010100111011100111101101000100000001001E-211"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=-42, x=-1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=-42, x=-1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_jn (y, 4, x, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_jn (y, 4, x, MPFR_RNDN); mpfr_set_str_binary (x, "-0.0001110001011001100010100111100111100000111110111011111"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=4, x=17, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=4, x=17, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_jn (y, 16, x, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_jn (y, 16, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.0011101111100111101111010100000111111001111001001010011"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=16, x=17, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=16, x=17, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_jn (y, 256, x, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_jn (y, 256, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.11111101111100110000000010111101101011101011110001011E-894"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=256, x=17, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=256, x=17, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_jn (y, 65536, x, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_jn (y, 65536, x, MPFR_RNDN); mpfr_set_str_binary (x, "100010010010011010110101100001000100011100010111011E-751747"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=65536, x=17, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=65536, x=17, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_jn (y, 131072, x, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_jn (y, 131072, x, MPFR_RNDN); mpfr_set_str_binary (x, "1000001001110011111001110110000010011010000001001101E-1634508"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=131072, x=17, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=131072, x=17, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_jn (y, 262144, x, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_jn (y, 262144, x, MPFR_RNDN); mpfr_set_str_binary (x, "1010011011000100111011001011110001000010000010111111E-3531100"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=262144, x=17, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=262144, x=17, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_jn (y, 524288, x, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_jn (y, 524288, x, MPFR_RNDN); mpfr_set_str_binary (x, "110000001010001111011011000011001011010100010001011E-7586426"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=524288, x=17, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_jn for n=524288, x=17, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); @@ -254,45 +254,45 @@ main (int argc, char *argv[]) /* ensures n is odd */ if (n % 2 == 0) n --; - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_jn (y, n, x, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_jn (y, n, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.0"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=%ld, x=17, rnd=GMP_RNDN\n", n); + printf ("Error in mpfr_jn for n=%ld, x=17, rnd=MPFR_RNDN\n", n); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_si (x, -17, GMP_RNDN); - mpfr_jn (y, n, x, GMP_RNDN); + mpfr_set_si (x, -17, MPFR_RNDN); + mpfr_jn (y, n, x, MPFR_RNDN); mpfr_set_str_binary (x, "-0.0"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=%ld, x=-17, rnd=GMP_RNDN\n", n); + printf ("Error in mpfr_jn for n=%ld, x=-17, rnd=MPFR_RNDN\n", n); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_jn (y, -n, x, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_jn (y, -n, x, MPFR_RNDN); mpfr_set_str_binary (x, "-0.0"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=%ld, x=17, rnd=GMP_RNDN\n", -n); + printf ("Error in mpfr_jn for n=%ld, x=17, rnd=MPFR_RNDN\n", -n); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_si (x, -17, GMP_RNDN); - mpfr_jn (y, -n, x, GMP_RNDN); + mpfr_set_si (x, -17, MPFR_RNDN); + mpfr_jn (y, -n, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.0"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_jn for n=%ld, x=-17, rnd=GMP_RNDN\n", -n); + printf ("Error in mpfr_jn for n=%ld, x=-17, rnd=MPFR_RNDN\n", -n); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); diff --git a/tests/tl2b.c b/tests/tl2b.c index 73f1d4487..08667cad2 100644 --- a/tests/tl2b.c +++ b/tests/tl2b.c @@ -96,16 +96,16 @@ compute_l2b (int output) { /* 23-bit upper approximation to log(b)/log(2) */ mpfr_init2 (p, 23); - mpfr_set_ui (p, beta, GMP_RNDU); - mpfr_log2 (p, p, GMP_RNDU); + mpfr_set_ui (p, beta, MPFR_RNDU); + mpfr_log2 (p, p, MPFR_RNDU); } else { /* 76-bit upper approximation to log(2)/log(b) */ mpfr_init2 (p, 77); - mpfr_set_ui (p, beta, GMP_RNDD); - mpfr_log2 (p, p, GMP_RNDD); - mpfr_ui_div (p, 1, p, GMP_RNDU); + mpfr_set_ui (p, beta, MPFR_RNDD); + mpfr_log2 (p, p, MPFR_RNDD); + mpfr_ui_div (p, 1, p, MPFR_RNDU); } sprintf (buffer, "mpfr_l2b_%d_%d", beta, i); diff --git a/tests/tlgamma.c b/tests/tlgamma.c index af4d089cb..b7829f8a0 100644 --- a/tests/tlgamma.c +++ b/tests/tlgamma.c @@ -34,15 +34,15 @@ mpfr_lgamma_nosign (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd) if (!MPFR_IS_SINGULAR (y)) { MPFR_ASSERTN (sign == 1 || sign == -1); - if (sign == -1 && (rnd == GMP_RNDN || rnd == GMP_RNDZ)) + if (sign == -1 && (rnd == MPFR_RNDN || rnd == MPFR_RNDZ)) { - mpfr_neg (y, y, GMP_RNDN); + mpfr_neg (y, y, MPFR_RNDN); inex = -inex; /* This is a way to check with the generic tests, that the value returned in the sign variable is consistent, but warning! The tested function depends on the rounding mode: it is - * lgamma(x) = log(|Gamma(x)|) in GMP_RNDD and GMP_RNDU; - * lgamma(x) * sign(Gamma(x)) in GMP_RNDN and GMP_RNDZ. */ + * lgamma(x) = log(|Gamma(x)|) in MPFR_RNDD and MPFR_RNDU; + * lgamma(x) * sign(Gamma(x)) in MPFR_RNDN and MPFR_RNDZ. */ } } @@ -64,7 +64,7 @@ special (void) mpfr_init (y); mpfr_set_nan (x); - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error for lgamma(NaN)\n"); @@ -72,7 +72,7 @@ special (void) } mpfr_set_inf (x, -1); - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error for lgamma(-Inf)\n"); @@ -81,52 +81,52 @@ special (void) mpfr_set_inf (x, 1); sign = -17; - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || sign != 1) { printf ("Error for lgamma(+Inf)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); sign = -17; - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || sign != 1) { printf ("Error for lgamma(+0)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); sign = -17; - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || sign != -1) { printf ("Error for lgamma(-0)\n"); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); sign = -17; - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y) || sign != 1) { printf ("Error for lgamma(1)\n"); exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error for lgamma(-1)\n"); exit (1); } - mpfr_set_ui (x, 2, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); sign = -17; - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y) || sign != 1) { printf ("Error for lgamma(2)\n"); @@ -139,10 +139,10 @@ special (void) #define CHECK_X1 "1.0762904832837976166" #define CHECK_Y1 "-0.039418362817587634939" - mpfr_set_str (x, CHECK_X1, 10, GMP_RNDN); + mpfr_set_str (x, CHECK_X1, 10, MPFR_RNDN); sign = -17; - mpfr_lgamma (y, &sign, x, GMP_RNDN); - mpfr_set_str (x, CHECK_Y1, 10, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); + mpfr_set_str (x, CHECK_Y1, 10, MPFR_RNDN); if (mpfr_equal_p (y, x) == 0 || sign != 1) { printf ("mpfr_lgamma("CHECK_X1") is wrong:\n" @@ -155,10 +155,10 @@ special (void) #define CHECK_X2 "9.23709516716202383435e-01" #define CHECK_Y2 "0.049010669407893718563" - mpfr_set_str (x, CHECK_X2, 10, GMP_RNDN); + mpfr_set_str (x, CHECK_X2, 10, MPFR_RNDN); sign = -17; - mpfr_lgamma (y, &sign, x, GMP_RNDN); - mpfr_set_str (x, CHECK_Y2, 10, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); + mpfr_set_str (x, CHECK_Y2, 10, MPFR_RNDN); if (mpfr_equal_p (y, x) == 0 || sign != 1) { printf ("mpfr_lgamma("CHECK_X2") is wrong:\n" @@ -171,9 +171,9 @@ special (void) mpfr_set_prec (x, 8); mpfr_set_prec (y, 175); - mpfr_set_ui (x, 33, GMP_RNDN); + mpfr_set_ui (x, 33, MPFR_RNDN); sign = -17; - mpfr_lgamma (y, &sign, x, GMP_RNDU); + mpfr_lgamma (y, &sign, x, MPFR_RNDU); mpfr_set_prec (x, 175); mpfr_set_str_binary (x, "0.1010001100011101101011001101110010100001000001000001110011000001101100001111001001000101011011100100010101011110100111110101010100010011010010000101010111001100011000101111E7"); if (mpfr_equal_p (x, y) == 0 || sign != 1) @@ -184,9 +184,9 @@ special (void) mpfr_set_prec (x, 21); mpfr_set_prec (y, 8); - mpfr_set_ui (y, 120, GMP_RNDN); + mpfr_set_ui (y, 120, MPFR_RNDN); sign = -17; - mpfr_lgamma (x, &sign, y, GMP_RNDZ); + mpfr_lgamma (x, &sign, y, MPFR_RNDZ); mpfr_set_prec (y, 21); mpfr_set_str_binary (y, "0.111000101000001100101E9"); if (mpfr_equal_p (x, y) == 0 || sign != 1) @@ -201,7 +201,7 @@ special (void) mpfr_set_prec (y, 206); mpfr_set_str_binary (x, "0.110e10"); sign = -17; - inex = mpfr_lgamma (y, &sign, x, GMP_RNDN); + inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_prec (x, 206); mpfr_set_str_binary (x, "0.10000111011000000011100010101001100110001110000111100011000100100110110010001011011110101001111011110110000001010100111011010000000011100110110101100111000111010011110010000100010111101010001101000110101001E13"); if (mpfr_equal_p (x, y) == 0 || sign != 1) @@ -219,7 +219,7 @@ special (void) mpfr_set_prec (y, 4); mpfr_set_str_binary (x, "0.1100E-66"); sign = -17; - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.1100E6"); if (mpfr_equal_p (x, y) == 0 || sign != 1) { @@ -233,11 +233,11 @@ special (void) mpfr_set_prec (x, 256); mpfr_set_prec (y, 32); - mpfr_set_si_2exp (x, -1, 200, GMP_RNDN); - mpfr_add_ui (x, x, 1, GMP_RNDN); - mpfr_div_2ui (x, x, 1, GMP_RNDN); + mpfr_set_si_2exp (x, -1, 200, MPFR_RNDN); + mpfr_add_ui (x, x, 1, MPFR_RNDN); + mpfr_div_2ui (x, x, 1, MPFR_RNDN); sign = -17; - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_prec (x, 32); mpfr_set_str_binary (x, "-0.10001000111011111011000010100010E207"); if (mpfr_equal_p (x, y) == 0 || sign != 1) @@ -252,11 +252,11 @@ special (void) mpfr_set_prec (x, 256); mpfr_set_prec (y, 32); - mpfr_set_si_2exp (x, -1, 200, GMP_RNDN); - mpfr_sub_ui (x, x, 1, GMP_RNDN); - mpfr_div_2ui (x, x, 1, GMP_RNDN); + mpfr_set_si_2exp (x, -1, 200, MPFR_RNDN); + mpfr_sub_ui (x, x, 1, MPFR_RNDN); + mpfr_div_2ui (x, x, 1, MPFR_RNDN); sign = -17; - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_prec (x, 32); mpfr_set_str_binary (x, "-0.10001000111011111011000010100010E207"); if (mpfr_equal_p (x, y) == 0 || sign != -1) @@ -273,7 +273,7 @@ special (void) mpfr_set_prec (x, 10); mpfr_set_prec (y, 10); mpfr_set_str_binary (x, "-0.1101111000E-3"); - inex = mpfr_lgamma (y, &sign, x, GMP_RNDN); + inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_str_binary (x, "10.01001011"); if (mpfr_equal_p (x, y) == 0 || sign != -1 || inex >= 0) { @@ -289,7 +289,7 @@ special (void) mpfr_set_prec (x, 18); mpfr_set_prec (y, 28); mpfr_set_str_binary (x, "-1.10001101010001101e-196"); - inex = mpfr_lgamma (y, &sign, x, GMP_RNDN); + inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_prec (x, 28); mpfr_set_str_binary (x, "0.100001110110101011011010011E8"); MPFR_ASSERTN (mpfr_equal_p (x, y) && inex < 0); @@ -313,38 +313,38 @@ special (void) mpfr_set_prec (y, 53); mpfr_set_str_binary (x, VAL1); - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_str_binary (x, OUT1); MPFR_ASSERTN(sign == -1 && mpfr_equal_p(x, y)); mpfr_set_str_binary (x, VAL2); - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_str_binary (x, OUT2); MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y)); mpfr_set_str_binary (x, VAL3); - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_str_binary (x, OUT3); MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y)); mpfr_set_str_binary (x, VAL4); - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_str_binary (x, OUT4); MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y)); mpfr_set_str_binary (x, VAL5); - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_str_binary (x, OUT5); MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y)); mpfr_set_str_binary (x, VAL6); - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_str_binary (x, OUT6); MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y)); /* further test from Kaveh Ghazi */ mpfr_set_str_binary (x, "-0.10011010101001010010001110010111010111011101010111001E-53"); - mpfr_lgamma (y, &sign, x, GMP_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_str_binary (x, "100101.00111101101010000000101010111010001111001101111"); MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y)); @@ -353,8 +353,8 @@ special (void) emax = mpfr_get_emax (); mpfr_set_emin (-1000000000); mpfr_set_emax (1000000000); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_lgamma (x, &sign, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_lgamma (x, &sign, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_get_emin () == -1000000000); MPFR_ASSERTN(mpfr_get_emax () == 1000000000); mpfr_set_emin (emin); @@ -364,16 +364,16 @@ special (void) mpfr_set_prec (x, 128); mpfr_set_prec (y, 128); mpfr_set_str_binary (x, "0.11000110011110111111110010100110000000000000000000000000000000000000000000000000000000000000000001000011000110100100110111101010E-765689"); - inex = mpfr_lgamma (y, &sign, x, GMP_RNDN); + inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_str_binary (x, "10000001100100101111011011010000111010001001110000111010011000101001011111011111110011011010110100101111110111001001010100011101E-108"); MPFR_ASSERTN(inex < 0 && mpfr_cmp (y, x) == 0 && sign > 0); mpfr_set_prec (x, 128); mpfr_set_prec (y, 256); mpfr_set_str_binary (x, "0.1011111111111111100000111011111E-31871"); - inex = mpfr_lgamma (y, &sign, x, GMP_RNDN); + inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN); mpfr_set_prec (x, 256); - mpfr_set_str (x, "AC9729B83707E6797612D0D76DAF42B1240A677FF1B6E3783FD4E53037143B1P-237", 16, GMP_RNDN); + mpfr_set_str (x, "AC9729B83707E6797612D0D76DAF42B1240A677FF1B6E3783FD4E53037143B1P-237", 16, MPFR_RNDN); MPFR_ASSERTN(inex < 0 && mpfr_cmp (y, x) == 0 && sign > 0); mpfr_clear (x); diff --git a/tests/tli2.c b/tests/tli2.c index 258248e6f..99fa80a86 100644 --- a/tests/tli2.c +++ b/tests/tli2.c @@ -36,7 +36,7 @@ special (void) mpfr_init (y); mpfr_set_nan (x); - mpfr_li2 (y, x, GMP_RNDN); + mpfr_li2 (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error for li2(NaN)\n"); @@ -44,7 +44,7 @@ special (void) } mpfr_set_inf (x, -1); - mpfr_li2 (y, x, GMP_RNDN); + mpfr_li2 (y, x, MPFR_RNDN); if (!MPFR_IS_INF (y) || MPFR_IS_POS (y)) { printf ("Error for li2(-Inf)\n"); @@ -52,24 +52,24 @@ special (void) } mpfr_set_inf (x, 1); - mpfr_li2 (y, x, GMP_RNDN); + mpfr_li2 (y, x, MPFR_RNDN); if (!MPFR_IS_INF (y) || MPFR_IS_POS (y)) { printf ("Error for li2(+Inf)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_li2 (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_li2 (y, x, MPFR_RNDN); if (!MPFR_IS_ZERO (y) || MPFR_IS_NEG (y)) { printf ("Error for li2(+0)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - mpfr_li2 (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_li2 (y, x, MPFR_RNDN); if (!MPFR_IS_ZERO (y) || MPFR_IS_POS (y)) { printf ("Error for li2(-0)\n"); @@ -89,9 +89,9 @@ normal (void) mpfr_init (y); /* x1 = 2^-3 */ - mpfr_set_str (x, "1p-3", 2, GMP_RNDD); - mpfr_li2 (x, x, GMP_RNDN); - if (mpfr_cmp_str (x, "0x1087a7a9e42141p-55", 16, GMP_RNDN) != 0) + mpfr_set_str (x, "1p-3", 2, MPFR_RNDD); + mpfr_li2 (x, x, MPFR_RNDN); + if (mpfr_cmp_str (x, "0x1087a7a9e42141p-55", 16, MPFR_RNDN) != 0) { printf ("Error for li2(x1)\n"); exit (1); @@ -100,25 +100,25 @@ normal (void) /* check MPFR_FAST_COMPUTE_IF_SMALL_INPUT */ mpfr_set_prec (x, 2); mpfr_set_prec (y, 20); - mpfr_set_ui_2exp (x, 1, -21, GMP_RNDN); - mpfr_li2 (y, x, GMP_RNDN); + mpfr_set_ui_2exp (x, 1, -21, MPFR_RNDN); + mpfr_li2 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp (y, x) == 0); - mpfr_set_si_2exp (x, -1, -21, GMP_RNDN); - mpfr_li2 (y, x, GMP_RNDN); + mpfr_set_si_2exp (x, -1, -21, MPFR_RNDN); + mpfr_li2 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp (y, x) == 0); /* worst case */ /* x2 = 0x7F18EA6537E00E983196CDDC6EFAC57Fp-129 Li2(x2) = 2^-2 + 2^-6 + 2^-120 */ mpfr_set_prec (x, 128); - mpfr_set_str (x, "7F18EA6537E00E983196CDDC6EFAC57Fp-129", 16, GMP_RNDN); + mpfr_set_str (x, "7F18EA6537E00E983196CDDC6EFAC57Fp-129", 16, MPFR_RNDN); /* round to nearest mode and 4 bits of precision, it should be rounded to 2^-2 + 2^-5 and */ mpfr_set_prec (y, 4); - inexact = mpfr_li2 (y, x, GMP_RNDN); - if (inexact != 1 || mpfr_cmp_str (y, "0.1001p-1", 2, GMP_RNDN) != 0) + inexact = mpfr_li2 (y, x, MPFR_RNDN); + if (inexact != 1 || mpfr_cmp_str (y, "0.1001p-1", 2, MPFR_RNDN) != 0) { printf ("Error for li2(x2, RNDN)\n"); exit (1); @@ -127,8 +127,8 @@ normal (void) /* round towards zero mode and 5 bits of precision, it should be rounded to 2^-2 + 2^-6 */ mpfr_set_prec (y, 5); - inexact = mpfr_li2 (y, x, GMP_RNDZ); - if (inexact != -1 || mpfr_cmp_str (y, "0.10001p-1", 2, GMP_RNDN) != 0) + inexact = mpfr_li2 (y, x, MPFR_RNDZ); + if (inexact != -1 || mpfr_cmp_str (y, "0.10001p-1", 2, MPFR_RNDN) != 0) { printf ("Error for li2(x2, RNDZ)\n"); exit (1); @@ -136,8 +136,8 @@ normal (void) /* round away from zero mode and 5 bits of precision, it should be rounded to 2^-2 + 2^-5 */ - inexact = mpfr_li2 (y, x, GMP_RNDU); - if (inexact != 1 || mpfr_cmp_str (y, "0.10010p-1", 2, GMP_RNDN) != 0) + inexact = mpfr_li2 (y, x, MPFR_RNDU); + if (inexact != 1 || mpfr_cmp_str (y, "0.10010p-1", 2, MPFR_RNDN) != 0) { printf ("Error for li2(x2, RNDU)\n"); exit (1); diff --git a/tests/tlngamma.c b/tests/tlngamma.c index e67721535..fff8aad20 100644 --- a/tests/tlngamma.c +++ b/tests/tlngamma.c @@ -39,7 +39,7 @@ special (void) mpfr_init (y); mpfr_set_nan (x); - mpfr_lngamma (y, x, GMP_RNDN); + mpfr_lngamma (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error for lngamma(NaN)\n"); @@ -47,7 +47,7 @@ special (void) } mpfr_set_inf (x, -1); - mpfr_lngamma (y, x, GMP_RNDN); + mpfr_lngamma (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error for lngamma(-Inf)\n"); @@ -55,48 +55,48 @@ special (void) } mpfr_set_inf (x, 1); - mpfr_lngamma (y, x, GMP_RNDN); + mpfr_lngamma (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error for lngamma(+Inf)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_lngamma (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_lngamma (y, x, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error for lngamma(+0)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - mpfr_lngamma (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_lngamma (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error for lngamma(-0)\n"); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_lngamma (y, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_lngamma (y, x, MPFR_RNDN); if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y)) { printf ("Error for lngamma(1)\n"); exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_lngamma (y, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_lngamma (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error for lngamma(-1)\n"); exit (1); } - mpfr_set_ui (x, 2, GMP_RNDN); - mpfr_lngamma (y, x, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); + mpfr_lngamma (y, x, MPFR_RNDN); if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y)) { printf ("Error for lngamma(2)\n"); @@ -109,9 +109,9 @@ special (void) #define CHECK_X1 "1.0762904832837976166" #define CHECK_Y1 "-0.039418362817587634939" - mpfr_set_str (x, CHECK_X1, 10, GMP_RNDN); - mpfr_lngamma (y, x, GMP_RNDN); - mpfr_set_str (x, CHECK_Y1, 10, GMP_RNDN); + mpfr_set_str (x, CHECK_X1, 10, MPFR_RNDN); + mpfr_lngamma (y, x, MPFR_RNDN); + mpfr_set_str (x, CHECK_Y1, 10, MPFR_RNDN); if (MPFR_IS_NAN (y) || mpfr_cmp (y, x)) { printf ("mpfr_lngamma("CHECK_X1") is wrong:\n" @@ -124,9 +124,9 @@ special (void) #define CHECK_X2 "9.23709516716202383435e-01" #define CHECK_Y2 "0.049010669407893718563" - mpfr_set_str (x, CHECK_X2, 10, GMP_RNDN); - mpfr_lngamma (y, x, GMP_RNDN); - mpfr_set_str (x, CHECK_Y2, 10, GMP_RNDN); + mpfr_set_str (x, CHECK_X2, 10, MPFR_RNDN); + mpfr_lngamma (y, x, MPFR_RNDN); + mpfr_set_str (x, CHECK_Y2, 10, MPFR_RNDN); if (MPFR_IS_NAN (y) || mpfr_cmp (y, x)) { printf ("mpfr_lngamma("CHECK_X2") is wrong:\n" @@ -139,8 +139,8 @@ special (void) mpfr_set_prec (x, 8); mpfr_set_prec (y, 175); - mpfr_set_ui (x, 33, GMP_RNDN); - mpfr_lngamma (y, x, GMP_RNDU); + mpfr_set_ui (x, 33, MPFR_RNDN); + mpfr_lngamma (y, x, MPFR_RNDU); mpfr_set_prec (x, 175); mpfr_set_str_binary (x, "0.1010001100011101101011001101110010100001000001000001110011000001101100001111001001000101011011100100010101011110100111110101010100010011010010000101010111001100011000101111E7"); if (MPFR_IS_NAN (y) || mpfr_cmp (x, y)) @@ -151,8 +151,8 @@ special (void) mpfr_set_prec (x, 21); mpfr_set_prec (y, 8); - mpfr_set_ui (y, 120, GMP_RNDN); - mpfr_lngamma (x, y, GMP_RNDZ); + mpfr_set_ui (y, 120, MPFR_RNDN); + mpfr_lngamma (x, y, MPFR_RNDZ); mpfr_set_prec (y, 21); mpfr_set_str_binary (y, "0.111000101000001100101E9"); if (MPFR_IS_NAN (x) || mpfr_cmp (x, y)) @@ -166,7 +166,7 @@ special (void) mpfr_set_prec (x, 3); mpfr_set_prec (y, 206); mpfr_set_str_binary (x, "0.110e10"); - inex = mpfr_lngamma (y, x, GMP_RNDN); + inex = mpfr_lngamma (y, x, MPFR_RNDN); mpfr_set_prec (x, 206); mpfr_set_str_binary (x, "0.10000111011000000011100010101001100110001110000111100011000100100110110010001011011110101001111011110110000001010100111011010000000011100110110101100111000111010011110010000100010111101010001101000110101001E13"); if (MPFR_IS_NAN (y) || mpfr_cmp (x, y)) @@ -183,7 +183,7 @@ special (void) mpfr_set_prec (x, 4); mpfr_set_prec (y, 4); mpfr_set_str_binary (x, "0.1100E-66"); - mpfr_lngamma (y, x, GMP_RNDN); + mpfr_lngamma (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.1100E6"); if (MPFR_IS_NAN (y) || mpfr_cmp (x, y)) { @@ -193,10 +193,10 @@ special (void) mpfr_set_prec (x, 256); mpfr_set_prec (y, 32); - mpfr_set_si_2exp (x, -1, 200, GMP_RNDN); - mpfr_add_ui (x, x, 1, GMP_RNDN); - mpfr_div_2ui (x, x, 1, GMP_RNDN); - mpfr_lngamma (y, x, GMP_RNDN); + mpfr_set_si_2exp (x, -1, 200, MPFR_RNDN); + mpfr_add_ui (x, x, 1, MPFR_RNDN); + mpfr_div_2ui (x, x, 1, MPFR_RNDN); + mpfr_lngamma (y, x, MPFR_RNDN); mpfr_set_prec (x, 32); mpfr_set_str_binary (x, "-0.10001000111011111011000010100010E207"); if (MPFR_IS_NAN (y) || mpfr_cmp (x, y)) @@ -211,10 +211,10 @@ special (void) mpfr_set_prec (x, 256); mpfr_set_prec (y, 32); - mpfr_set_si_2exp (x, -1, 200, GMP_RNDN); - mpfr_sub_ui (x, x, 1, GMP_RNDN); - mpfr_div_2ui (x, x, 1, GMP_RNDN); - mpfr_lngamma (y, x, GMP_RNDN); + mpfr_set_si_2exp (x, -1, 200, MPFR_RNDN); + mpfr_sub_ui (x, x, 1, MPFR_RNDN); + mpfr_div_2ui (x, x, 1, MPFR_RNDN); + mpfr_lngamma (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error for lngamma(-2^199-0.5)\n"); diff --git a/tests/tlog.c b/tests/tlog.c index 990255d2f..ce615c561 100644 --- a/tests/tlog.c +++ b/tests/tlog.c @@ -30,7 +30,7 @@ static int test_log (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode) { int res; - int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53; + int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53; if (ok) { mpfr_print_raw (b); @@ -63,7 +63,7 @@ check2 (const char *as, mp_rnd_t rnd_mode, const char *res1s) as, mpfr_print_rnd_mode (rnd_mode)); printf ("correct result is %s\n mpfr_log gives ", res1s); - mpfr_out_str(stdout, 10, 0, tres, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, tres, MPFR_RNDN); exit (1); } mpfr_clears (ta, tres, (mpfr_ptr) 0); @@ -93,85 +93,85 @@ check3 (double d, unsigned long prec, mp_rnd_t rnd) static void check_worst_cases (void) { - check2("1.00089971802309629645", GMP_RNDD, "8.99313519443722736088e-04"); - check2("1.00089971802309629645", GMP_RNDN, "8.99313519443722844508e-04"); - check2("1.00089971802309629645", GMP_RNDU, "8.99313519443722844508e-04"); + check2("1.00089971802309629645", MPFR_RNDD, "8.99313519443722736088e-04"); + check2("1.00089971802309629645", MPFR_RNDN, "8.99313519443722844508e-04"); + check2("1.00089971802309629645", MPFR_RNDU, "8.99313519443722844508e-04"); - check2("1.01979300812244555452", GMP_RNDD, "1.95996734891603630047e-02"); - check2("1.01979300812244555452", GMP_RNDN, "1.95996734891603664741e-02"); - check2("1.01979300812244555452", GMP_RNDU, "1.95996734891603664741e-02"); + check2("1.01979300812244555452", MPFR_RNDD, "1.95996734891603630047e-02"); + check2("1.01979300812244555452", MPFR_RNDN, "1.95996734891603664741e-02"); + check2("1.01979300812244555452", MPFR_RNDU, "1.95996734891603664741e-02"); - check2("1.02900871924604464525", GMP_RNDD, "2.85959303301472726744e-02"); - check2("1.02900871924604464525", GMP_RNDN, "2.85959303301472761438e-02"); - check2("1.02900871924604464525", GMP_RNDU, "2.85959303301472761438e-02"); + check2("1.02900871924604464525", MPFR_RNDD, "2.85959303301472726744e-02"); + check2("1.02900871924604464525", MPFR_RNDN, "2.85959303301472761438e-02"); + check2("1.02900871924604464525", MPFR_RNDU, "2.85959303301472761438e-02"); - check2("1.27832870030418943585", GMP_RNDD, "2.45553521871417795852e-01"); - check2("1.27832870030418943585", GMP_RNDN, "2.45553521871417823608e-01"); - check2("1.27832870030418943585", GMP_RNDU, "2.45553521871417823608e-01"); + check2("1.27832870030418943585", MPFR_RNDD, "2.45553521871417795852e-01"); + check2("1.27832870030418943585", MPFR_RNDN, "2.45553521871417823608e-01"); + check2("1.27832870030418943585", MPFR_RNDU, "2.45553521871417823608e-01"); - check2("1.31706530746788241792", GMP_RNDD, "2.75406009586277422674e-01"); - check2("1.31706530746788241792", GMP_RNDN, "2.75406009586277478185e-01"); - check2("1.31706530746788241792", GMP_RNDU, "2.75406009586277478185e-01"); + check2("1.31706530746788241792", MPFR_RNDD, "2.75406009586277422674e-01"); + check2("1.31706530746788241792", MPFR_RNDN, "2.75406009586277478185e-01"); + check2("1.31706530746788241792", MPFR_RNDU, "2.75406009586277478185e-01"); - check2("1.47116981099449883885", GMP_RNDD, "3.86057874110010412760e-01"); - check2("1.47116981099449883885", GMP_RNDN, "3.86057874110010412760e-01"); - check2("1.47116981099449883885", GMP_RNDU, "3.86057874110010468272e-01"); + check2("1.47116981099449883885", MPFR_RNDD, "3.86057874110010412760e-01"); + check2("1.47116981099449883885", MPFR_RNDN, "3.86057874110010412760e-01"); + check2("1.47116981099449883885", MPFR_RNDU, "3.86057874110010468272e-01"); - check2("1.58405446812987782401", GMP_RNDD, "4.59987679246663727639e-01"); - check2("1.58405446812987782401", GMP_RNDN, "4.59987679246663783150e-01"); - check2("1.58405446812987782401", GMP_RNDU, "4.59987679246663783150e-01"); + check2("1.58405446812987782401", MPFR_RNDD, "4.59987679246663727639e-01"); + check2("1.58405446812987782401", MPFR_RNDN, "4.59987679246663783150e-01"); + check2("1.58405446812987782401", MPFR_RNDU, "4.59987679246663783150e-01"); - check2("1.67192331263391547047", GMP_RNDD, "5.13974647961076613889e-01"); - check2("1.67192331263391547047", GMP_RNDN, "5.13974647961076724911e-01"); - check2("1.67192331263391547047", GMP_RNDU, "5.13974647961076724911e-01"); + check2("1.67192331263391547047", MPFR_RNDD, "5.13974647961076613889e-01"); + check2("1.67192331263391547047", MPFR_RNDN, "5.13974647961076724911e-01"); + check2("1.67192331263391547047", MPFR_RNDU, "5.13974647961076724911e-01"); - check2("1.71101198068990645318", GMP_RNDD, "5.37084997042120315669e-01"); - check2("1.71101198068990645318", GMP_RNDN, "5.37084997042120315669e-01"); - check2("1.71101198068990645318", GMP_RNDU, "5.37084997042120426691e-01"); + check2("1.71101198068990645318", MPFR_RNDD, "5.37084997042120315669e-01"); + check2("1.71101198068990645318", MPFR_RNDN, "5.37084997042120315669e-01"); + check2("1.71101198068990645318", MPFR_RNDU, "5.37084997042120426691e-01"); - check2("1.72634853551388700588", GMP_RNDD, "5.46008504786553605648e-01"); - check2("1.72634853551388700588", GMP_RNDN, "5.46008504786553716670e-01"); - check2("1.72634853551388700588", GMP_RNDU, "5.46008504786553716670e-01"); + check2("1.72634853551388700588", MPFR_RNDD, "5.46008504786553605648e-01"); + check2("1.72634853551388700588", MPFR_RNDN, "5.46008504786553716670e-01"); + check2("1.72634853551388700588", MPFR_RNDU, "5.46008504786553716670e-01"); - check2("2.00028876593004323325", GMP_RNDD, "6.93291553102749702475e-01"); - check2("2.00028876593004323325", GMP_RNDN, "6.93291553102749813497e-01"); - check2("2.00028876593004323325", GMP_RNDU, "6.93291553102749813497e-01"); + check2("2.00028876593004323325", MPFR_RNDD, "6.93291553102749702475e-01"); + check2("2.00028876593004323325", MPFR_RNDN, "6.93291553102749813497e-01"); + check2("2.00028876593004323325", MPFR_RNDU, "6.93291553102749813497e-01"); - check2("6.27593230200363105808", GMP_RNDD, "1.83672204800630312072"); - check2("6.27593230200363105808", GMP_RNDN, "1.83672204800630334276"); - check2("6.27593230200363105808", GMP_RNDU, "1.83672204800630334276"); + check2("6.27593230200363105808", MPFR_RNDD, "1.83672204800630312072"); + check2("6.27593230200363105808", MPFR_RNDN, "1.83672204800630334276"); + check2("6.27593230200363105808", MPFR_RNDU, "1.83672204800630334276"); - check2("7.47216682321367997588", GMP_RNDD, "2.01118502712453661729"); - check2("7.47216682321367997588", GMP_RNDN, "2.01118502712453706138"); - check2("7.47216682321367997588", GMP_RNDU, "2.01118502712453706138"); + check2("7.47216682321367997588", MPFR_RNDD, "2.01118502712453661729"); + check2("7.47216682321367997588", MPFR_RNDN, "2.01118502712453706138"); + check2("7.47216682321367997588", MPFR_RNDU, "2.01118502712453706138"); - check2("9.34589857718275318632", GMP_RNDD, "2.23493759221664944903"); - check2("9.34589857718275318632", GMP_RNDN, "2.23493759221664989312"); - check2("9.34589857718275318632", GMP_RNDU, "2.23493759221664989312"); + check2("9.34589857718275318632", MPFR_RNDD, "2.23493759221664944903"); + check2("9.34589857718275318632", MPFR_RNDN, "2.23493759221664989312"); + check2("9.34589857718275318632", MPFR_RNDU, "2.23493759221664989312"); - check2("10.6856587560831854944", GMP_RNDD, "2.36890253928838445674"); - check2("10.6856587560831854944", GMP_RNDN, "2.36890253928838445674"); - check2("10.6856587560831854944", GMP_RNDU, "2.36890253928838490083"); + check2("10.6856587560831854944", MPFR_RNDD, "2.36890253928838445674"); + check2("10.6856587560831854944", MPFR_RNDN, "2.36890253928838445674"); + check2("10.6856587560831854944", MPFR_RNDU, "2.36890253928838490083"); - check2("12.4646345033981766903", GMP_RNDD, "2.52289539471636015122"); - check2("12.4646345033981766903", GMP_RNDN, "2.52289539471636015122"); - check2("12.4646345033981766903", GMP_RNDU, "2.52289539471636059531"); + check2("12.4646345033981766903", MPFR_RNDD, "2.52289539471636015122"); + check2("12.4646345033981766903", MPFR_RNDN, "2.52289539471636015122"); + check2("12.4646345033981766903", MPFR_RNDU, "2.52289539471636059531"); - check2("17.0953275851761752335", GMP_RNDD, "2.83880518553861849185"); - check2("17.0953275851761752335", GMP_RNDN, "2.83880518553861893594"); - check2("17.0953275851761752335", GMP_RNDU, "2.83880518553861893594"); + check2("17.0953275851761752335", MPFR_RNDD, "2.83880518553861849185"); + check2("17.0953275851761752335", MPFR_RNDN, "2.83880518553861893594"); + check2("17.0953275851761752335", MPFR_RNDU, "2.83880518553861893594"); - check2("19.8509496207496916043", GMP_RNDD, "2.98825184582516722998"); - check2("19.8509496207496916043", GMP_RNDN, "2.98825184582516722998"); - check2("19.8509496207496916043", GMP_RNDU, "2.98825184582516767406"); + check2("19.8509496207496916043", MPFR_RNDD, "2.98825184582516722998"); + check2("19.8509496207496916043", MPFR_RNDN, "2.98825184582516722998"); + check2("19.8509496207496916043", MPFR_RNDU, "2.98825184582516767406"); - check2("23.9512076062771335216", GMP_RNDD, "3.17601874455977206679"); - check2("23.9512076062771335216", GMP_RNDN, "3.17601874455977206679"); - check2("23.9512076062771335216", GMP_RNDU, "3.17601874455977251088"); + check2("23.9512076062771335216", MPFR_RNDD, "3.17601874455977206679"); + check2("23.9512076062771335216", MPFR_RNDN, "3.17601874455977206679"); + check2("23.9512076062771335216", MPFR_RNDU, "3.17601874455977251088"); - check2("428.315247165198229595", GMP_RNDD, "6.05985948325268264369"); - check2("428.315247165198229595", GMP_RNDN, "6.05985948325268353187"); - check2("428.315247165198229595", GMP_RNDU, "6.05985948325268353187"); + check2("428.315247165198229595", MPFR_RNDD, "6.05985948325268264369"); + check2("428.315247165198229595", MPFR_RNDN, "6.05985948325268353187"); + check2("428.315247165198229595", MPFR_RNDU, "6.05985948325268353187"); } static void @@ -193,30 +193,30 @@ special (void) mpfr_set_prec (y, 24*2); mpfr_set_prec (x, 24); mpfr_set_str_binary (x, "0.111110101010101011110101E0"); - test_log (y, x, GMP_RNDN); + test_log (y, x, MPFR_RNDN); set_emin (emin); set_emax (emax); mpfr_set_prec (y, 53); mpfr_set_prec (x, 53); - mpfr_set_ui (x, 3, GMP_RNDD); - test_log (y, x, GMP_RNDD); + mpfr_set_ui (x, 3, MPFR_RNDD); + test_log (y, x, MPFR_RNDD); if (mpfr_cmp_str1 (y, "1.09861228866810956")) { - printf ("Error in mpfr_log(3) for GMP_RNDD\n"); + printf ("Error in mpfr_log(3) for MPFR_RNDD\n"); exit (1); } /* check large precision */ mpfr_set_prec (x, 3322); mpfr_set_prec (y, 3322); - mpfr_set_ui (x, 3, GMP_RNDN); - mpfr_sqrt (x, x, GMP_RNDN); - test_log (y, x, GMP_RNDN); + mpfr_set_ui (x, 3, MPFR_RNDN); + mpfr_sqrt (x, x, MPFR_RNDN); + test_log (y, x, MPFR_RNDN); /* negative argument */ - mpfr_set_si (x, -1, GMP_RNDN); - test_log (y, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + test_log (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); /* infinite loop when */ @@ -225,19 +225,19 @@ special (void) mpfr_set_prec (y, 251); mpfr_set_str_binary (x, "0.10010111000000000001101E8"); /* x = 4947981/32768, log(x) ~ 5.017282... */ - test_log (y, x, GMP_RNDN); + test_log (y, x, MPFR_RNDN); set_emax (emax); - mpfr_set_ui (x, 0, GMP_RNDN); - inex = test_log (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + inex = test_log (y, x, MPFR_RNDN); MPFR_ASSERTN (inex == 0); MPFR_ASSERTN (mpfr_inf_p (y)); MPFR_ASSERTN (mpfr_sgn (y) < 0); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - inex = test_log (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + inex = test_log (y, x, MPFR_RNDN); MPFR_ASSERTN (inex == 0); MPFR_ASSERTN (mpfr_inf_p (y)); MPFR_ASSERTN (mpfr_sgn (y) < 0); @@ -255,10 +255,10 @@ x_near_one (void) mpfr_init2 (x, 32); mpfr_init2 (y, 16); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_nextbelow (x); - inex = mpfr_log (y, x, GMP_RNDD); - if (mpfr_cmp_str (y, "-0.1000000000000001E-31", 2, GMP_RNDN) + inex = mpfr_log (y, x, MPFR_RNDD); + if (mpfr_cmp_str (y, "-0.1000000000000001E-31", 2, MPFR_RNDN) || inex >= 0) { printf ("Failure in x_near_one, got inex = %d and\ny = ", inex); @@ -286,67 +286,67 @@ main (int argc, char *argv[]) special (); check_worst_cases(); - check2("1.01979300812244555452", GMP_RNDN, "1.95996734891603664741e-02"); - check2("10.0",GMP_RNDU,"2.30258509299404590110e+00"); - check2("6.0",GMP_RNDU,"1.79175946922805517936"); - check2("1.0",GMP_RNDZ,"0.0"); - check2("62.0",GMP_RNDU,"4.12713438504509166905"); - check2("0.5",GMP_RNDZ,"-6.93147180559945286226e-01"); - check2("3.0",GMP_RNDZ,"1.09861228866810956006e+00"); - check2("234375765.0",GMP_RNDU,"1.92724362186836231104e+01"); - check2("8.0",GMP_RNDZ,"2.07944154167983574765e+00"); - check2("44.0",GMP_RNDU,"3.78418963391826146392e+00"); - check2("1.01979300812244555452", GMP_RNDN, "1.95996734891603664741e-02"); + check2("1.01979300812244555452", MPFR_RNDN, "1.95996734891603664741e-02"); + check2("10.0",MPFR_RNDU,"2.30258509299404590110e+00"); + check2("6.0",MPFR_RNDU,"1.79175946922805517936"); + check2("1.0",MPFR_RNDZ,"0.0"); + check2("62.0",MPFR_RNDU,"4.12713438504509166905"); + check2("0.5",MPFR_RNDZ,"-6.93147180559945286226e-01"); + check2("3.0",MPFR_RNDZ,"1.09861228866810956006e+00"); + check2("234375765.0",MPFR_RNDU,"1.92724362186836231104e+01"); + check2("8.0",MPFR_RNDZ,"2.07944154167983574765e+00"); + check2("44.0",MPFR_RNDU,"3.78418963391826146392e+00"); + check2("1.01979300812244555452", MPFR_RNDN, "1.95996734891603664741e-02"); /* bugs found by Vincent Lefe`vre */ - check2("0.99999599881598921769", GMP_RNDN, "-0.0000040011920155404072924737977900999652547398000024259090423583984375"); - check2("9.99995576063808955247e-01",GMP_RNDZ,"-4.42394597667932383816e-06"); - check2("9.99993687357856209097e-01",GMP_RNDN,"-6.31266206860017342601e-06"); - check2("9.99995223520736886691e-01",GMP_RNDN,"-4.77649067052670982220e-06"); - check2("9.99993025794720935551e-01",GMP_RNDN,"-6.97422959894716163837e-06"); - check2("9.99987549017837484833e-01",GMP_RNDN,"-1.24510596766369924330e-05"); - check2("9.99985901426543311032e-01",GMP_RNDN,"-1.40986728425098585229e-05"); - check2("9.99986053947420794330e-01",GMP_RNDN, "-0.000013946149826301084938555592540598837558718514628708362579345703125"); - check2("9.99971938247442126979e-01",GMP_RNDN,"-2.80621462962173414790e-05"); + check2("0.99999599881598921769", MPFR_RNDN, "-0.0000040011920155404072924737977900999652547398000024259090423583984375"); + check2("9.99995576063808955247e-01",MPFR_RNDZ,"-4.42394597667932383816e-06"); + check2("9.99993687357856209097e-01",MPFR_RNDN,"-6.31266206860017342601e-06"); + check2("9.99995223520736886691e-01",MPFR_RNDN,"-4.77649067052670982220e-06"); + check2("9.99993025794720935551e-01",MPFR_RNDN,"-6.97422959894716163837e-06"); + check2("9.99987549017837484833e-01",MPFR_RNDN,"-1.24510596766369924330e-05"); + check2("9.99985901426543311032e-01",MPFR_RNDN,"-1.40986728425098585229e-05"); + check2("9.99986053947420794330e-01",MPFR_RNDN, "-0.000013946149826301084938555592540598837558718514628708362579345703125"); + check2("9.99971938247442126979e-01",MPFR_RNDN,"-2.80621462962173414790e-05"); /* other bugs found by Vincent Lefe`vre */ - check2("1.18615436389927785905e+77",GMP_RNDN,"1.77469768607706015473e+02"); - check2("9.48868723578399476187e+77",GMP_RNDZ,"1.79549152432275803903e+02"); - check2("2.31822210096938820854e+89",GMP_RNDN,"2.05770873832573869322e+02"); + check2("1.18615436389927785905e+77",MPFR_RNDN,"1.77469768607706015473e+02"); + check2("9.48868723578399476187e+77",MPFR_RNDZ,"1.79549152432275803903e+02"); + check2("2.31822210096938820854e+89",MPFR_RNDN,"2.05770873832573869322e+02"); /* further bugs found by Vincent Lefe`vre */ - check2("9.99999989485669482647e-01",GMP_RNDZ,"-1.05143305726283042331e-08"); - check2("9.99999989237970177136e-01",GMP_RNDZ,"-1.07620298807745377934e-08"); - check2("9.99999989239339082125e-01",GMP_RNDN,"-1.07606609757704445430e-08"); - - check2("7.3890560989306504",GMP_RNDU,"2.0000000000000004"); /* exp(2.0) */ - check2("7.3890560989306495",GMP_RNDU,"2.0"); /* exp(2.0) */ - check2("7.53428236571286402512e+34",GMP_RNDZ,"8.03073567492226345621e+01"); - check2("6.18784121531737948160e+19",GMP_RNDZ,"4.55717030391710693493e+01"); - check2("1.02560267603047283735e+00",GMP_RNDD,"2.52804164149448735987e-02"); - check2("7.53428236571286402512e+34",GMP_RNDZ,"8.03073567492226345621e+01"); - check2("1.42470900831881198052e+49",GMP_RNDZ,"113.180637144887668910087086260318756103515625"); - - check2("1.08013816255293777466e+11",GMP_RNDN,"2.54055249841782604392e+01"); - check2("6.72783635300509015581e-37",GMP_RNDU,"-8.32893948416799503320e+01"); - check2("2.25904918906057891180e-52",GMP_RNDU,"-1.18919480823735682406e+02"); - check2("1.48901209246462951085e+00",GMP_RNDD,"3.98112874867437460668e-01"); - check2("1.70322470467612341327e-01",GMP_RNDN,"-1.77006175364294615626"); - check2("1.94572026316065240791e+01",GMP_RNDD,"2.96821731676437838842"); - check2("4.01419512207026418764e+04",GMP_RNDD,"1.06001772315501128218e+01"); - check2("9.47077365236487591672e-04",GMP_RNDZ,"-6.96212977303956748187e+00"); - check2("3.95906157687589643802e-109",GMP_RNDD,"-2.49605768114704119399e+02"); - check2("2.73874914516503004113e-02",GMP_RNDD,"-3.59766888618655977794e+00"); - check2("9.18989072589566467669e-17",GMP_RNDZ,"-3.69258425351464083519e+01"); - check2("7706036453608191045959753324430048151991964994788917248.0",GMP_RNDZ,"126.3815989984199177342816255986690521240234375"); - check2("1.74827399630587801934e-23",GMP_RNDZ,"-5.24008281254547156891e+01"); - check2("4.35302958401482307665e+22",GMP_RNDD,"5.21277441046519527390e+01"); - check2("9.70791868689332915209e+00",GMP_RNDD,"2.27294191194272210410e+00"); - check2("2.22183639799464011100e-01",GMP_RNDN,"-1.50425103275253957413e+00"); - check2("2.27313466156682375540e+00",GMP_RNDD,"8.21159787095675608448e-01"); - check2("6.58057413965851156767e-01",GMP_RNDZ,"-4.18463096196088235600e-01"); - check2 ("7.34302197248998461006e+43",GMP_RNDZ,"101.0049094695131799426235374994575977325439453125"); - check2("6.09969788341579732815e+00",GMP_RNDD,"1.80823924264386204363e+00"); + check2("9.99999989485669482647e-01",MPFR_RNDZ,"-1.05143305726283042331e-08"); + check2("9.99999989237970177136e-01",MPFR_RNDZ,"-1.07620298807745377934e-08"); + check2("9.99999989239339082125e-01",MPFR_RNDN,"-1.07606609757704445430e-08"); + + check2("7.3890560989306504",MPFR_RNDU,"2.0000000000000004"); /* exp(2.0) */ + check2("7.3890560989306495",MPFR_RNDU,"2.0"); /* exp(2.0) */ + check2("7.53428236571286402512e+34",MPFR_RNDZ,"8.03073567492226345621e+01"); + check2("6.18784121531737948160e+19",MPFR_RNDZ,"4.55717030391710693493e+01"); + check2("1.02560267603047283735e+00",MPFR_RNDD,"2.52804164149448735987e-02"); + check2("7.53428236571286402512e+34",MPFR_RNDZ,"8.03073567492226345621e+01"); + check2("1.42470900831881198052e+49",MPFR_RNDZ,"113.180637144887668910087086260318756103515625"); + + check2("1.08013816255293777466e+11",MPFR_RNDN,"2.54055249841782604392e+01"); + check2("6.72783635300509015581e-37",MPFR_RNDU,"-8.32893948416799503320e+01"); + check2("2.25904918906057891180e-52",MPFR_RNDU,"-1.18919480823735682406e+02"); + check2("1.48901209246462951085e+00",MPFR_RNDD,"3.98112874867437460668e-01"); + check2("1.70322470467612341327e-01",MPFR_RNDN,"-1.77006175364294615626"); + check2("1.94572026316065240791e+01",MPFR_RNDD,"2.96821731676437838842"); + check2("4.01419512207026418764e+04",MPFR_RNDD,"1.06001772315501128218e+01"); + check2("9.47077365236487591672e-04",MPFR_RNDZ,"-6.96212977303956748187e+00"); + check2("3.95906157687589643802e-109",MPFR_RNDD,"-2.49605768114704119399e+02"); + check2("2.73874914516503004113e-02",MPFR_RNDD,"-3.59766888618655977794e+00"); + check2("9.18989072589566467669e-17",MPFR_RNDZ,"-3.69258425351464083519e+01"); + check2("7706036453608191045959753324430048151991964994788917248.0",MPFR_RNDZ,"126.3815989984199177342816255986690521240234375"); + check2("1.74827399630587801934e-23",MPFR_RNDZ,"-5.24008281254547156891e+01"); + check2("4.35302958401482307665e+22",MPFR_RNDD,"5.21277441046519527390e+01"); + check2("9.70791868689332915209e+00",MPFR_RNDD,"2.27294191194272210410e+00"); + check2("2.22183639799464011100e-01",MPFR_RNDN,"-1.50425103275253957413e+00"); + check2("2.27313466156682375540e+00",MPFR_RNDD,"8.21159787095675608448e-01"); + check2("6.58057413965851156767e-01",MPFR_RNDZ,"-4.18463096196088235600e-01"); + check2 ("7.34302197248998461006e+43",MPFR_RNDZ,"101.0049094695131799426235374994575977325439453125"); + check2("6.09969788341579732815e+00",MPFR_RNDD,"1.80823924264386204363e+00"); x_near_one (); diff --git a/tests/tlog10.c b/tests/tlog10.c index dc938ce66..4017b8a08 100644 --- a/tests/tlog10.c +++ b/tests/tlog10.c @@ -30,7 +30,7 @@ static int test_log10 (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode) { int res; - int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53; + int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53; if (ok) { mpfr_print_raw (b); @@ -68,42 +68,42 @@ main (int argc, char *argv[]) /* check NaN */ mpfr_set_nan (x); - inex = test_log10 (y, x, GMP_RNDN); + inex = test_log10 (y, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (y) && inex == 0); /* check Inf */ mpfr_set_inf (x, -1); - inex = test_log10 (y, x, GMP_RNDN); + inex = test_log10 (y, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (y) && inex == 0); mpfr_set_inf (x, 1); - inex = test_log10 (y, x, GMP_RNDN); + inex = test_log10 (y, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (y) && mpfr_sgn (y) > 0 && inex == 0); - mpfr_set_ui (x, 0, GMP_RNDN); - inex = test_log10 (x, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + inex = test_log10 (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - inex = test_log10 (x, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + inex = test_log10 (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0); /* check negative argument */ - mpfr_set_si (x, -1, GMP_RNDN); - inex = test_log10 (y, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + inex = test_log10 (y, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (y) && inex == 0); /* check log10(1) = 0 */ - mpfr_set_ui (x, 1, GMP_RNDN); - inex = test_log10 (y, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + inex = test_log10 (y, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y) && inex == 0); /* check log10(10^n)=n */ - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); for (n = 1; n <= 15; n++) { - mpfr_mul_ui (x, x, 10, GMP_RNDN); /* x = 10^n */ - inex = test_log10 (y, x, GMP_RNDN); + mpfr_mul_ui (x, x, 10, MPFR_RNDN); /* x = 10^n */ + inex = test_log10 (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, n)) { printf ("log10(10^n) <> n for n=%u\n", n); diff --git a/tests/tlog1p.c b/tests/tlog1p.c index 8ac833934..7c913b3a6 100644 --- a/tests/tlog1p.c +++ b/tests/tlog1p.c @@ -30,7 +30,7 @@ static int test_log1p (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode) { int res; - int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53; + int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53; if (ok) { mpfr_print_raw (b); @@ -61,30 +61,30 @@ special (void) mpfr_init (x); mpfr_set_nan (x); - inex = test_log1p (x, x, GMP_RNDN); + inex = test_log1p (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0); mpfr_set_inf (x, -1); - inex = test_log1p (x, x, GMP_RNDN); + inex = test_log1p (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0); mpfr_set_inf (x, 1); - inex = test_log1p (x, x, GMP_RNDN); + inex = test_log1p (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) > 0 && inex == 0); - mpfr_set_ui (x, 0, GMP_RNDN); - inex = test_log1p (x, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + inex = test_log1p (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x) && inex == 0); - mpfr_neg (x, x, GMP_RNDN); - inex = test_log1p (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + inex = test_log1p (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_NEG (x) && inex == 0); - mpfr_set_si (x, -1, GMP_RNDN); - inex = test_log1p (x, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + inex = test_log1p (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0); - mpfr_set_si (x, -2, GMP_RNDN); - inex = test_log1p (x, x, GMP_RNDN); + mpfr_set_si (x, -2, MPFR_RNDN); + inex = test_log1p (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0); mpfr_clear (x); @@ -97,17 +97,17 @@ other (void) /* Bug reported by Guillaume Melquiond on 2006-08-14. */ mpfr_init2 (x, 53); - mpfr_set_str (x, "-1.5e4f72873ed9a@-100", 16, GMP_RNDN); + mpfr_set_str (x, "-1.5e4f72873ed9a@-100", 16, MPFR_RNDN); mpfr_init2 (y, 57); - mpfr_log1p (y, x, GMP_RNDU); + mpfr_log1p (y, x, MPFR_RNDU); if (mpfr_cmp (x, y) != 0) { printf ("Error in tlog1p for x = "); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); - printf (", rnd = GMP_RNDU\nExpected "); - mpfr_out_str (stdout, 16, 15, x, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); + printf (", rnd = MPFR_RNDU\nExpected "); + mpfr_out_str (stdout, 16, 15, x, MPFR_RNDN); printf ("\nGot "); - mpfr_out_str (stdout, 16, 15, y, GMP_RNDN); + mpfr_out_str (stdout, 16, 15, y, MPFR_RNDN); printf ("\n"); exit (1); } diff --git a/tests/tlog2.c b/tests/tlog2.c index 09a0afbd0..16a5e3f99 100644 --- a/tests/tlog2.c +++ b/tests/tlog2.c @@ -38,31 +38,31 @@ special (void) mpfr_init (x); mpfr_set_nan (x); - inex = mpfr_log2 (x, x, GMP_RNDN); + inex = mpfr_log2 (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0); mpfr_set_inf (x, -1); - inex = mpfr_log2 (x, x, GMP_RNDN); + inex = mpfr_log2 (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0); mpfr_set_inf (x, 1); - inex = mpfr_log2 (x, x, GMP_RNDN); + inex = mpfr_log2 (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) > 0 && inex == 0); - mpfr_set_ui (x, 0, GMP_RNDN); - inex = mpfr_log2 (x, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + inex = mpfr_log2 (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - inex = mpfr_log2 (x, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + inex = mpfr_log2 (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0); - mpfr_set_si (x, -1, GMP_RNDN); - inex = mpfr_log2 (x, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + inex = mpfr_log2 (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0); - mpfr_set_si (x, 1, GMP_RNDN); - inex = mpfr_log2 (x, x, GMP_RNDN); + mpfr_set_si (x, 1, MPFR_RNDN); + inex = mpfr_log2 (x, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x) && inex == 0); mpfr_clear (x); diff --git a/tests/tminmax.c b/tests/tminmax.c index a2c5fb6e4..8563d1d8c 100644 --- a/tests/tminmax.c +++ b/tests/tminmax.c @@ -39,13 +39,13 @@ main (void) /* case x=NaN && y=NAN */ mpfr_set_nan (x); mpfr_set_nan (y); - mpfr_min (z, x, y, GMP_RNDN); + mpfr_min (z, x, y, MPFR_RNDN); if (!mpfr_nan_p (z)) { printf ("Error in mpfr_min (NaN, NaN)\n"); exit (1); } - mpfr_max (z, x, y, GMP_RNDN); + mpfr_max (z, x, y, MPFR_RNDN); if (!mpfr_nan_p (z)) { printf ("Error in mpfr_max (NaN, NaN)\n"); @@ -53,56 +53,56 @@ main (void) } /* case x=NaN */ mpfr_set_nan (x); - mpfr_set_ui (y, 0, GMP_RNDN); - mpfr_min (z, x, y, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); + mpfr_min (z, x, y, MPFR_RNDN); if (mpfr_cmp_ui (z, 0)) { printf ("Error in mpfr_min (NaN, 0)\n"); exit (1); } - mpfr_min (z, y, x, GMP_RNDN); + mpfr_min (z, y, x, MPFR_RNDN); if (mpfr_cmp_ui (z, 0)) { printf ("Error in mpfr_min (0, NaN)\n"); exit (1); } - mpfr_max (z, x, y, GMP_RNDN); + mpfr_max (z, x, y, MPFR_RNDN); if (mpfr_cmp_ui (z, 0)) { printf ("Error in mpfr_max (NaN, 0)\n"); exit (1); } - mpfr_max (z, y, x, GMP_RNDN); + mpfr_max (z, y, x, MPFR_RNDN); if (mpfr_cmp_ui (z, 0)) { printf ("Error in mpfr_max (0, NaN)\n"); exit (1); } /* Case x=0+ and x=0- */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_set_ui (y, 0, GMP_RNDN); MPFR_SET_NEG(y); - mpfr_max (z, x, y, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); MPFR_SET_NEG(y); + mpfr_max (z, x, y, MPFR_RNDN); if (!MPFR_IS_ZERO(z) || MPFR_IS_NEG(z)) { printf ("Error in mpfr_max (0+, 0-)\n"); exit (1); } - mpfr_min (z, x, y, GMP_RNDN); + mpfr_min (z, x, y, MPFR_RNDN); if (!MPFR_IS_ZERO(z) || MPFR_IS_POS(z)) { printf ("Error in mpfr_min (0+, 0-)\n"); exit (1); } /* Case x=0- and y=0+ */ - mpfr_set_ui (x, 0, GMP_RNDN); MPFR_SET_NEG(x); - mpfr_set_ui (y, 0, GMP_RNDN); - mpfr_max (z, x, y, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); MPFR_SET_NEG(x); + mpfr_set_ui (y, 0, MPFR_RNDN); + mpfr_max (z, x, y, MPFR_RNDN); if (!MPFR_IS_ZERO(z) || MPFR_IS_NEG(z)) { printf ("Error in mpfr_max (0+, 0-)\n"); exit (1); } - mpfr_min (z, x, y, GMP_RNDN); + mpfr_min (z, x, y, MPFR_RNDN); if (!MPFR_IS_ZERO(z) || MPFR_IS_POS(z)) { printf ("Error in mpfr_min (0+, 0-)\n"); @@ -111,14 +111,14 @@ main (void) /* case x=+Inf */ mpfr_set_inf (x, 1); - mpfr_set_si (y, -12, GMP_RNDN); - mpfr_min (z, x, y, GMP_RNDN); + mpfr_set_si (y, -12, MPFR_RNDN); + mpfr_min (z, x, y, MPFR_RNDN); if ( mpfr_cmp_si (z, -12) ) { printf ("Error in mpfr_min (+Inf, -12)\n"); exit (1); } - mpfr_max (z, x, y, GMP_RNDN); + mpfr_max (z, x, y, MPFR_RNDN); if ( !MPFR_IS_INF(z) || MPFR_IS_NEG(z) ) { printf ("Error in mpfr_max (+Inf, 12)\n"); @@ -126,14 +126,14 @@ main (void) } /* case x=-Inf */ mpfr_set_inf (x, -1); - mpfr_set_ui (y, 12, GMP_RNDN); - mpfr_max (z, x, y, GMP_RNDN); + mpfr_set_ui (y, 12, MPFR_RNDN); + mpfr_max (z, x, y, MPFR_RNDN); if ( mpfr_cmp_ui (z, 12) ) { printf ("Error in mpfr_max (-Inf, 12)\n"); exit (1); } - mpfr_min (z, x, y, GMP_RNDN); + mpfr_min (z, x, y, MPFR_RNDN); if ( !MPFR_IS_INF(z) || MPFR_IS_POS(z) ) { printf ("Error in mpfr_min (-Inf, 12)\n"); @@ -141,21 +141,21 @@ main (void) } /* case x=17 and y=42 */ - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_set_ui (y, 42, GMP_RNDN); - mpfr_max (z, x, y, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_set_ui (y, 42, MPFR_RNDN); + mpfr_max (z, x, y, MPFR_RNDN); if ( mpfr_cmp_ui (z, 42) ) { printf ("Error in mpfr_max (17, 42)\n"); exit (1); } - mpfr_max (z, y, x, GMP_RNDN); + mpfr_max (z, y, x, MPFR_RNDN); if ( mpfr_cmp_ui (z, 42) ) { printf ("Error in mpfr_max (42, 17)\n"); exit (1); } - mpfr_min (z, y, x, GMP_RNDN); + mpfr_min (z, y, x, MPFR_RNDN); if ( mpfr_cmp_ui (z, 17) ) { printf ("Error in mpfr_min (42, 17)\n"); diff --git a/tests/tmodf.c b/tests/tmodf.c index 358e14b2a..68690e20d 100644 --- a/tests/tmodf.c +++ b/tests/tmodf.c @@ -45,7 +45,7 @@ check (const char *xis, const char *xfs, const char *xs, printf ("mpfr_mof failed for x=%s, rnd=%s\n", xs, mpfr_print_rnd_mode(rnd_mode)); printf ("got integer value: "); - mpfr_out_str (stdout, 10, 0, xi, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, xi, MPFR_RNDN); printf ("\nexpected %s\n", xis); exit (1); } @@ -54,7 +54,7 @@ check (const char *xis, const char *xfs, const char *xs, printf ("mpfr_mof failed for x=%s, rnd=%s\n", xs, mpfr_print_rnd_mode(rnd_mode)); printf ("got fractional value: "); - mpfr_out_str (stdout, 10, 0, xf, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, xf, MPFR_RNDN); printf ("\nexpected %s\n", xfs); exit (1); } @@ -79,20 +79,20 @@ check_nans (void) /* nan */ mpfr_set_nan (x); - mpfr_modf (xi, xf, x, GMP_RNDN); + mpfr_modf (xi, xf, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (xi)); MPFR_ASSERTN (mpfr_nan_p (xf)); /* +inf */ mpfr_set_inf (x, 1); - mpfr_modf (xi, xf, x, GMP_RNDN); + mpfr_modf (xi, xf, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (xi)); MPFR_ASSERTN (mpfr_sgn (xi) > 0); MPFR_ASSERTN (mpfr_zero_p (xf)); /* -inf */ mpfr_set_inf (x, -1); - mpfr_modf (xi ,xf, x, GMP_RNDN); + mpfr_modf (xi ,xf, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (xi)); MPFR_ASSERTN (mpfr_sgn (xi) < 0); MPFR_ASSERTN (mpfr_zero_p (xf)); @@ -110,16 +110,16 @@ main (int argc, char *argv[]) check_nans (); check ("61680","3.52935791015625e-1", "61680.352935791015625", - 53, 53, 53, 0, GMP_RNDZ); + 53, 53, 53, 0, MPFR_RNDZ); check ("-53968","-3.529052734375e-1", "-53970.352935791015625", - 13, 13, 53, 2, GMP_RNDZ); + 13, 13, 53, 2, MPFR_RNDZ); check ("61632","3.525390625e-1", "61648.352935791015625", - 10, 10, 53, -2, GMP_RNDZ); - check ("61680", "0", "61680", 53, 53, 53, 0, GMP_RNDZ); - check ("-53968","0", "-53970", 13, 13, 53, 1, GMP_RNDZ); - check ("-43392","0", "-43399", 13, 13, 53, 1, GMP_RNDU); - check ("-52720","0", "-52719", 13, 13, 53, -1, GMP_RNDD); - check ("61632", "0", "61648", 10, 10, 53, -1, GMP_RNDZ); + 10, 10, 53, -2, MPFR_RNDZ); + check ("61680", "0", "61680", 53, 53, 53, 0, MPFR_RNDZ); + check ("-53968","0", "-53970", 13, 13, 53, 1, MPFR_RNDZ); + check ("-43392","0", "-43399", 13, 13, 53, 1, MPFR_RNDU); + check ("-52720","0", "-52719", 13, 13, 53, -1, MPFR_RNDD); + check ("61632", "0", "61648", 10, 10, 53, -1, MPFR_RNDZ); tests_end_mpfr (); return 0; diff --git a/tests/tmul.c b/tests/tmul.c index cea39326b..4e3c39c46 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -36,7 +36,7 @@ static int test_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) { int res; - int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_number_p (c); + int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c); if (ok) { mpfr_print_raw (b); @@ -77,7 +77,7 @@ pcheck (const char *xs, const char *ys, const char *res, mp_rnd_t rnd_mode, printf ("(1)mpfr_mul failed for x=%s y=%s with rnd=%s\n", xs, ys, mpfr_print_rnd_mode (rnd_mode)); printf ("correct is %s, mpfr_mul gives ", res); - mpfr_out_str(stdout, 10, 0, zz, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN); /* printf("\nBinary forms:\nxx="); mpfr_print_binary (xx); @@ -108,7 +108,7 @@ check53 (const char *xs, const char *ys, mp_rnd_t rnd_mode, const char *zs) printf ("(2) mpfr_mul failed for x=%s y=%s with rnd=%s\n", xs, ys, mpfr_print_rnd_mode(rnd_mode)); printf ("correct result is %s,\n mpfr_mul gives ", zs); - mpfr_out_str(stdout, 10, 0, zz, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN); /* printf("\nBinary forms:\nxx="); mpfr_print_binary (xx); @@ -140,7 +140,7 @@ check24 (const char *xs, const char *ys, mp_rnd_t rnd_mode, const char *zs) printf ("(3) mpfr_mul failed for x=%s y=%s with " "rnd=%s\n", xs, ys, mpfr_print_rnd_mode(rnd_mode)); printf ("correct result is gives %s, mpfr_mul gives ", zs); - mpfr_out_str(stdout, 10, 0, zz, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN); putchar('\n'); exit (1); } @@ -152,45 +152,45 @@ check24 (const char *xs, const char *ys, mp_rnd_t rnd_mode, const char *zs) static void check_float (void) { - check24("8388609.0", "8388609.0", GMP_RNDN, "70368760954880.0"); - check24("16777213.0", "8388609.0", GMP_RNDN, "140737479966720.0"); - check24("8388611.0", "8388609.0", GMP_RNDN, "70368777732096.0"); - check24("12582911.0", "8388610.0", GMP_RNDN, "105553133043712.0"); - check24("12582914.0", "8388610.0", GMP_RNDN, "105553158209536.0"); - check24("13981013.0", "8388611.0", GMP_RNDN, "117281279442944.0"); - check24("11184811.0", "8388611.0", GMP_RNDN, "93825028587520.0"); - check24("11184810.0", "8388611.0", GMP_RNDN, "93825020198912.0"); - check24("13981014.0", "8388611.0", GMP_RNDN, "117281287831552.0"); - - check24("8388609.0", "8388609.0", GMP_RNDZ, "70368760954880.0"); - check24("16777213.0", "8388609.0", GMP_RNDZ, "140737471578112.0"); - check24("8388611.0", "8388609.0", GMP_RNDZ, "70368777732096.0"); - check24("12582911.0", "8388610.0", GMP_RNDZ, "105553124655104.0"); - check24("12582914.0", "8388610.0", GMP_RNDZ, "105553158209536.0"); - check24("13981013.0", "8388611.0", GMP_RNDZ, "117281271054336.0"); - check24("11184811.0", "8388611.0", GMP_RNDZ, "93825028587520.0"); - check24("11184810.0", "8388611.0", GMP_RNDZ, "93825011810304.0"); - check24("13981014.0", "8388611.0", GMP_RNDZ, "117281287831552.0"); - - check24("8388609.0", "8388609.0", GMP_RNDU, "70368769343488.0"); - check24("16777213.0", "8388609.0", GMP_RNDU, "140737479966720.0"); - check24("8388611.0", "8388609.0", GMP_RNDU, "70368786120704.0"); - check24("12582911.0", "8388610.0", GMP_RNDU, "105553133043712.0"); - check24("12582914.0", "8388610.0", GMP_RNDU, "105553166598144.0"); - check24("13981013.0", "8388611.0", GMP_RNDU, "117281279442944.0"); - check24("11184811.0", "8388611.0", GMP_RNDU, "93825036976128.0"); - check24("11184810.0", "8388611.0", GMP_RNDU, "93825020198912.0"); - check24("13981014.0", "8388611.0", GMP_RNDU, "117281296220160.0"); - - check24("8388609.0", "8388609.0", GMP_RNDD, "70368760954880.0"); - check24("16777213.0", "8388609.0", GMP_RNDD, "140737471578112.0"); - check24("8388611.0", "8388609.0", GMP_RNDD, "70368777732096.0"); - check24("12582911.0", "8388610.0", GMP_RNDD, "105553124655104.0"); - check24("12582914.0", "8388610.0", GMP_RNDD, "105553158209536.0"); - check24("13981013.0", "8388611.0", GMP_RNDD, "117281271054336.0"); - check24("11184811.0", "8388611.0", GMP_RNDD, "93825028587520.0"); - check24("11184810.0", "8388611.0", GMP_RNDD, "93825011810304.0"); - check24("13981014.0", "8388611.0", GMP_RNDD, "117281287831552.0"); + check24("8388609.0", "8388609.0", MPFR_RNDN, "70368760954880.0"); + check24("16777213.0", "8388609.0", MPFR_RNDN, "140737479966720.0"); + check24("8388611.0", "8388609.0", MPFR_RNDN, "70368777732096.0"); + check24("12582911.0", "8388610.0", MPFR_RNDN, "105553133043712.0"); + check24("12582914.0", "8388610.0", MPFR_RNDN, "105553158209536.0"); + check24("13981013.0", "8388611.0", MPFR_RNDN, "117281279442944.0"); + check24("11184811.0", "8388611.0", MPFR_RNDN, "93825028587520.0"); + check24("11184810.0", "8388611.0", MPFR_RNDN, "93825020198912.0"); + check24("13981014.0", "8388611.0", MPFR_RNDN, "117281287831552.0"); + + check24("8388609.0", "8388609.0", MPFR_RNDZ, "70368760954880.0"); + check24("16777213.0", "8388609.0", MPFR_RNDZ, "140737471578112.0"); + check24("8388611.0", "8388609.0", MPFR_RNDZ, "70368777732096.0"); + check24("12582911.0", "8388610.0", MPFR_RNDZ, "105553124655104.0"); + check24("12582914.0", "8388610.0", MPFR_RNDZ, "105553158209536.0"); + check24("13981013.0", "8388611.0", MPFR_RNDZ, "117281271054336.0"); + check24("11184811.0", "8388611.0", MPFR_RNDZ, "93825028587520.0"); + check24("11184810.0", "8388611.0", MPFR_RNDZ, "93825011810304.0"); + check24("13981014.0", "8388611.0", MPFR_RNDZ, "117281287831552.0"); + + check24("8388609.0", "8388609.0", MPFR_RNDU, "70368769343488.0"); + check24("16777213.0", "8388609.0", MPFR_RNDU, "140737479966720.0"); + check24("8388611.0", "8388609.0", MPFR_RNDU, "70368786120704.0"); + check24("12582911.0", "8388610.0", MPFR_RNDU, "105553133043712.0"); + check24("12582914.0", "8388610.0", MPFR_RNDU, "105553166598144.0"); + check24("13981013.0", "8388611.0", MPFR_RNDU, "117281279442944.0"); + check24("11184811.0", "8388611.0", MPFR_RNDU, "93825036976128.0"); + check24("11184810.0", "8388611.0", MPFR_RNDU, "93825020198912.0"); + check24("13981014.0", "8388611.0", MPFR_RNDU, "117281296220160.0"); + + check24("8388609.0", "8388609.0", MPFR_RNDD, "70368760954880.0"); + check24("16777213.0", "8388609.0", MPFR_RNDD, "140737471578112.0"); + check24("8388611.0", "8388609.0", MPFR_RNDD, "70368777732096.0"); + check24("12582911.0", "8388610.0", MPFR_RNDD, "105553124655104.0"); + check24("12582914.0", "8388610.0", MPFR_RNDD, "105553158209536.0"); + check24("13981013.0", "8388611.0", MPFR_RNDD, "117281271054336.0"); + check24("11184811.0", "8388611.0", MPFR_RNDD, "93825028587520.0"); + check24("11184810.0", "8388611.0", MPFR_RNDD, "93825011810304.0"); + check24("13981014.0", "8388611.0", MPFR_RNDD, "117281287831552.0"); } /* check sign of result */ @@ -201,13 +201,13 @@ check_sign (void) mpfr_init2 (a, 53); mpfr_init2 (b, 53); - mpfr_set_si (a, -1, GMP_RNDN); - mpfr_set_ui (b, 2, GMP_RNDN); - test_mul(a, b, b, GMP_RNDN); + mpfr_set_si (a, -1, MPFR_RNDN); + mpfr_set_ui (b, 2, MPFR_RNDN); + test_mul(a, b, b, MPFR_RNDN); if (mpfr_cmp_ui (a, 4) ) { printf ("2.0*2.0 gives \n"); - mpfr_out_str(stdout, 10, 0, a, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, a, MPFR_RNDN); putchar('\n'); exit (1); } @@ -233,7 +233,7 @@ check_exact (void) mpfr_set_prec (c, 32); mpfr_set_str_binary (a, "1.1000111011000100e-1"); mpfr_set_str_binary (b, "1.0010001111100111e-1"); - if (test_mul (c, a, b, GMP_RNDZ)) + if (test_mul (c, a, b, MPFR_RNDZ)) { printf ("wrong return value (1)\n"); exit (1); @@ -295,11 +295,11 @@ check_max(void) mpfr_init2(yy, 4); mpfr_init2(zz, 4); mpfr_set_str1 (xx, "0.68750"); - mpfr_mul_2si(xx, xx, MPFR_EMAX_DEFAULT/2, GMP_RNDN); + mpfr_mul_2si(xx, xx, MPFR_EMAX_DEFAULT/2, MPFR_RNDN); mpfr_set_str1 (yy, "0.68750"); - mpfr_mul_2si(yy, yy, MPFR_EMAX_DEFAULT - MPFR_EMAX_DEFAULT/2 + 1, GMP_RNDN); + mpfr_mul_2si(yy, yy, MPFR_EMAX_DEFAULT - MPFR_EMAX_DEFAULT/2 + 1, MPFR_RNDN); mpfr_clear_flags(); - test_mul(zz, xx, yy, GMP_RNDU); + test_mul(zz, xx, yy, MPFR_RNDU); if (!(mpfr_overflow_p() && MPFR_IS_INF(zz))) { printf("check_max failed (should be an overflow)\n"); @@ -307,14 +307,14 @@ check_max(void) } mpfr_clear_flags(); - test_mul(zz, xx, yy, GMP_RNDD); + test_mul(zz, xx, yy, MPFR_RNDD); if (mpfr_overflow_p() || MPFR_IS_INF(zz)) { printf("check_max failed (should NOT be an overflow)\n"); exit(1); } mpfr_set_str1 (xx, "0.93750"); - mpfr_mul_2si(xx, xx, MPFR_EMAX_DEFAULT, GMP_RNDN); + mpfr_mul_2si(xx, xx, MPFR_EMAX_DEFAULT, MPFR_RNDN); if (!(MPFR_IS_FP(xx) && MPFR_IS_FP(zz))) { printf("check_max failed (internal error)\n"); @@ -323,9 +323,9 @@ check_max(void) if (mpfr_cmp(xx, zz) != 0) { printf("check_max failed: got "); - mpfr_out_str(stdout, 2, 0, zz, GMP_RNDZ); + mpfr_out_str(stdout, 2, 0, zz, MPFR_RNDZ); printf(" instead of "); - mpfr_out_str(stdout, 2, 0, xx, GMP_RNDZ); + mpfr_out_str(stdout, 2, 0, xx, MPFR_RNDZ); printf("\n"); exit(1); } @@ -335,7 +335,7 @@ check_max(void) set_emin (0); mpfr_set_str_binary (xx, "0.1E0"); mpfr_set_str_binary (yy, "0.1E0"); - test_mul (zz, xx, yy, GMP_RNDN); + test_mul (zz, xx, yy, MPFR_RNDN); /* exact result is 0.1E-1, which should round to 0 */ MPFR_ASSERTN(mpfr_cmp_ui (zz, 0) == 0 && MPFR_IS_POS(zz)); set_emin (emin); @@ -347,7 +347,7 @@ check_max(void) mpfr_set_str_binary (xx, "0.1E0"); mpfr_nextabove (xx); mpfr_set_str_binary (yy, "0.1E0"); - test_mul (zz, xx, yy, GMP_RNDN); + test_mul (zz, xx, yy, MPFR_RNDN); /* exact result is just above 0.1E-1, which should round to minfloat */ MPFR_ASSERTN(mpfr_cmp (zz, yy) == 0); set_emin (emin); @@ -366,21 +366,21 @@ check_min(void) mpfr_init2(yy, 4); mpfr_init2(zz, 3); mpfr_set_str1(xx, "0.9375"); - mpfr_mul_2si(xx, xx, MPFR_EMIN_DEFAULT/2, GMP_RNDN); + mpfr_mul_2si(xx, xx, MPFR_EMIN_DEFAULT/2, MPFR_RNDN); mpfr_set_str1(yy, "0.9375"); - mpfr_mul_2si(yy, yy, MPFR_EMIN_DEFAULT - MPFR_EMIN_DEFAULT/2 - 1, GMP_RNDN); - test_mul(zz, xx, yy, GMP_RNDD); + mpfr_mul_2si(yy, yy, MPFR_EMIN_DEFAULT - MPFR_EMIN_DEFAULT/2 - 1, MPFR_RNDN); + test_mul(zz, xx, yy, MPFR_RNDD); if (mpfr_sgn(zz) != 0) { printf("check_min failed: got "); - mpfr_out_str(stdout, 2, 0, zz, GMP_RNDZ); + mpfr_out_str(stdout, 2, 0, zz, MPFR_RNDZ); printf(" instead of 0\n"); exit(1); } - test_mul(zz, xx, yy, GMP_RNDU); + test_mul(zz, xx, yy, MPFR_RNDU); mpfr_set_str1 (xx, "0.5"); - mpfr_mul_2si(xx, xx, MPFR_EMIN_DEFAULT, GMP_RNDN); + mpfr_mul_2si(xx, xx, MPFR_EMIN_DEFAULT, MPFR_RNDN); if (mpfr_sgn(xx) <= 0) { printf("check_min failed (internal error)\n"); @@ -389,9 +389,9 @@ check_min(void) if (mpfr_cmp(xx, zz) != 0) { printf("check_min failed: got "); - mpfr_out_str(stdout, 2, 0, zz, GMP_RNDZ); + mpfr_out_str(stdout, 2, 0, zz, MPFR_RNDZ); printf(" instead of "); - mpfr_out_str(stdout, 2, 0, xx, GMP_RNDZ); + mpfr_out_str(stdout, 2, 0, xx, MPFR_RNDZ); printf("\n"); exit(1); } @@ -412,33 +412,33 @@ check_nans (void) /* nan * 0 == nan */ mpfr_set_nan (x); - mpfr_set_ui (y, 0L, GMP_RNDN); - test_mul (p, x, y, GMP_RNDN); + mpfr_set_ui (y, 0L, MPFR_RNDN); + test_mul (p, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (p)); /* 1 * nan == nan */ - mpfr_set_ui (x, 1L, GMP_RNDN); + mpfr_set_ui (x, 1L, MPFR_RNDN); mpfr_set_nan (y); - test_mul (p, x, y, GMP_RNDN); + test_mul (p, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (p)); /* 0 * +inf == nan */ - mpfr_set_ui (x, 0L, GMP_RNDN); + mpfr_set_ui (x, 0L, MPFR_RNDN); mpfr_set_nan (y); - test_mul (p, x, y, GMP_RNDN); + test_mul (p, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (p)); /* +1 * +inf == +inf */ - mpfr_set_ui (x, 1L, GMP_RNDN); + mpfr_set_ui (x, 1L, MPFR_RNDN); mpfr_set_inf (y, 1); - test_mul (p, x, y, GMP_RNDN); + test_mul (p, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (p)); MPFR_ASSERTN (mpfr_sgn (p) > 0); /* -1 * +inf == -inf */ - mpfr_set_si (x, -1L, GMP_RNDN); + mpfr_set_si (x, -1L, MPFR_RNDN); mpfr_set_inf (y, 1); - test_mul (p, x, y, GMP_RNDN); + test_mul (p, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (p)); MPFR_ASSERTN (mpfr_sgn (p) < 0); @@ -489,15 +489,15 @@ check_regression (void) exit (1); } get_string (s, fp); - mpfr_set_str (y, s, 16, GMP_RNDN); + mpfr_set_str (y, s, 16, MPFR_RNDN); get_string (s, fp); - mpfr_set_str (z, s, 16, GMP_RNDN); - i = mpfr_mul (x, y, z, GMP_RNDN); + mpfr_set_str (z, s, 16, MPFR_RNDN); + i = mpfr_mul (x, y, z, MPFR_RNDN); get_string (s, fp); - if (mpfr_cmp_str (x, s, 16, GMP_RNDN) != 0 || i != -1) + if (mpfr_cmp_str (x, s, 16, MPFR_RNDN) != 0 || i != -1) { printf ("Regression test 1 failed (i=%d, expected -1)\nx=", i); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } fclose (fp); @@ -506,14 +506,14 @@ check_regression (void) mpfr_set_prec (y, 606); mpfr_set_prec (z, 606); - mpfr_set_str (y, "-f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92daefc3f8052ca9f58736564d9e93e62d324@-1", 16, GMP_RNDN); - mpfr_set_str (z, "-f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92daefc3f8052ca9f58736564d9e93e62d324@-1", 16, GMP_RNDN); - i = mpfr_mul (x, y, z, GMP_RNDU); - mpfr_set_str (y, "f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff25b5df87f00a5953eb0e6cac9b3d27cc5a64c@-1", 16, GMP_RNDN); + mpfr_set_str (y, "-f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92daefc3f8052ca9f58736564d9e93e62d324@-1", 16, MPFR_RNDN); + mpfr_set_str (z, "-f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92daefc3f8052ca9f58736564d9e93e62d324@-1", 16, MPFR_RNDN); + i = mpfr_mul (x, y, z, MPFR_RNDU); + mpfr_set_str (y, "f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff25b5df87f00a5953eb0e6cac9b3d27cc5a64c@-1", 16, MPFR_RNDN); if (mpfr_cmp (x, y) || i <= 0) { printf ("Regression test (2) failed! (i=%d - Expected 1)\n", i); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } @@ -521,18 +521,18 @@ check_regression (void) mpfr_set_prec (y, 92); mpfr_set_prec (z, 1023); - mpfr_set_str (y, "6.9b8c8498882770d8038c3b0@-1", 16, GMP_RNDN); - mpfr_set_str (z, "7.44e24b986e7fb296f1e936ce749fec3504cbf0d5ba769466b1c9f1578115efd5d29b4c79271191a920a99280c714d3a657ad6e3afbab77ffce9d697e9bb9110e26d676069afcea8b69f1d1541f2365042d80a97c21dcccd8ace4f1bb58b49922003e738e6f37bb82ef653cb2e87f763974e6ae50ae54e7724c38b80653e3289@255", 16, GMP_RNDN); - i = mpfr_mul (x, y, z, GMP_RNDU); + mpfr_set_str (y, "6.9b8c8498882770d8038c3b0@-1", 16, MPFR_RNDN); + mpfr_set_str (z, "7.44e24b986e7fb296f1e936ce749fec3504cbf0d5ba769466b1c9f1578115efd5d29b4c79271191a920a99280c714d3a657ad6e3afbab77ffce9d697e9bb9110e26d676069afcea8b69f1d1541f2365042d80a97c21dcccd8ace4f1bb58b49922003e738e6f37bb82ef653cb2e87f763974e6ae50ae54e7724c38b80653e3289@255", 16, MPFR_RNDN); + i = mpfr_mul (x, y, z, MPFR_RNDU); mpfr_set_prec (y, 184); mpfr_set_str (y, "3.0080038f2ac5054e3e71ccbb95f76aaab2221715025a28@255", - 16, GMP_RNDN); + 16, MPFR_RNDN); if (mpfr_cmp (x, y) || i <= 0) { printf ("Regression test (4) failed! (i=%d - expected 1)\n", i); printf ("Ref: 3.0080038f2ac5054e3e71ccbb95f76aaab2221715025a28@255\n" "Got: "); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } @@ -543,20 +543,20 @@ check_regression (void) mpfr_set_str (y, "-f.fffffffffffffffffffffffffffffffffffffffffffffffffffffff" "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" "ffffffffffffffffffffffffffffffffffffffffffffffffffffff99be91f83ec6f0ed28a3d42" -"e6e9a327230345ea6@-1", 16, GMP_RNDN); +"e6e9a327230345ea6@-1", 16, MPFR_RNDN); mpfr_set_str (z, "-f.fffffffffffffffffffffffffffffffffffffffffffffffffffffff" "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" "ffffffffffffffffffffffffffffffffffffffffffffffffffffff99be91f83ec6f0ed28a3d42" - "e6e9a327230345ea6@-1", 16, GMP_RNDN); - i = mpfr_mul (x, y, z, GMP_RNDU); + "e6e9a327230345ea6@-1", 16, MPFR_RNDN); + i = mpfr_mul (x, y, z, MPFR_RNDU); mpfr_set_str (y, "f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffff" "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" "fffffffffffffffffffffffffffffffffffffffffffffffffffff337d23f07d8de1da5147a85c" -"dd3464e46068bd4d@-1", 16, GMP_RNDN); +"dd3464e46068bd4d@-1", 16, MPFR_RNDN); if (mpfr_cmp (x, y) || i <= 0) { printf ("Regression test (5) failed! (i=%d - expected 1)\n", i); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } @@ -565,18 +565,18 @@ check_regression (void) mpfr_set_prec (x, 50); mpfr_set_prec (y, 40); mpfr_set_prec (z, 53); - mpfr_set_str (y, "4.1ffffffff8", 16, GMP_RNDN); - mpfr_set_str (z, "4.2000000ffe0000@-4", 16, GMP_RNDN); - i = mpfr_mul (x, y, z, GMP_RNDN); - if (mpfr_cmp_str (x, "1.104000041d6c0@-3", 16, GMP_RNDN) != 0 + mpfr_set_str (y, "4.1ffffffff8", 16, MPFR_RNDN); + mpfr_set_str (z, "4.2000000ffe0000@-4", 16, MPFR_RNDN); + i = mpfr_mul (x, y, z, MPFR_RNDN); + if (mpfr_cmp_str (x, "1.104000041d6c0@-3", 16, MPFR_RNDN) != 0 || i <= 0) { printf ("Regression test (6) failed! (i=%d - expected 1)\nx=", i); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); printf ("\nMore prec="); mpfr_set_prec (x, 93); - mpfr_mul (x, y, z, GMP_RNDN); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); + mpfr_mul (x, y, z, MPFR_RNDN); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } @@ -585,15 +585,15 @@ check_regression (void) mpfr_set_prec (y, 393); mpfr_set_str (y, "-1.921fb54442d18469898cc51701b839a252049c1114cf98e804177d" "4c76273644a29410f31c6809bbdf2a33679a748636600", - 16, GMP_RNDN); - i = mpfr_mul (x, y, y, GMP_RNDU); + 16, MPFR_RNDN); + i = mpfr_mul (x, y, y, MPFR_RNDU); if (mpfr_cmp_str (x, "2.77a79937c8bbcb495b89b36602306b1c2159a8ff834288a19a08" "84094f1cda3dc426da61174c4544a173de83c2500f8bfea2e0569e3698", - 16, GMP_RNDN) != 0 + 16, MPFR_RNDN) != 0 || i <= 0) { printf ("Regression test (7) failed! (i=%d - expected 1)\nx=", i); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } @@ -601,13 +601,13 @@ check_regression (void) mpfr_set_prec (x, 1023); mpfr_set_prec (y, 1023); mpfr_set_prec (z, 511); - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_set_ui (y, 42, GMP_RNDN); - i = mpfr_mul (z, x, y, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_set_ui (y, 42, MPFR_RNDN); + i = mpfr_mul (z, x, y, MPFR_RNDN); if (mpfr_cmp_ui (z, 17*42) != 0 || i != 0) { printf ("Regression test (8) failed! (i=%d - expected 0)\nz=", i); - mpfr_out_str (stdout, 16, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN); printf ("\n"); exit (1); } @@ -643,34 +643,34 @@ main (int argc, char *argv[]) check_exact (); check_float (); - check53("6.9314718055994530941514e-1", "0.0", GMP_RNDZ, "0.0"); - check53("0.0", "6.9314718055994530941514e-1", GMP_RNDZ, "0.0"); + check53("6.9314718055994530941514e-1", "0.0", MPFR_RNDZ, "0.0"); + check53("0.0", "6.9314718055994530941514e-1", MPFR_RNDZ, "0.0"); check_sign(); - check53("-4.165000000e4", "-0.00004801920768307322868063274915", GMP_RNDN, + check53("-4.165000000e4", "-0.00004801920768307322868063274915", MPFR_RNDN, "2.0"); check53("2.71331408349172961467e-08", "-6.72658901114033715233e-165", - GMP_RNDZ, "-1.8251348697787782844e-172"); + MPFR_RNDZ, "-1.8251348697787782844e-172"); check53("2.71331408349172961467e-08", "-6.72658901114033715233e-165", - GMP_RNDA, "-1.8251348697787786e-172"); - check53("0.31869277231188065", "0.88642843322303122", GMP_RNDZ, + MPFR_RNDA, "-1.8251348697787786e-172"); + check53("0.31869277231188065", "0.88642843322303122", MPFR_RNDZ, "2.8249833483992453642e-1"); - check("8.47622108205396074254e-01", "3.24039313247872939883e-01", GMP_RNDU, + check("8.47622108205396074254e-01", "3.24039313247872939883e-01", MPFR_RNDU, 28, 45, 2, "0.375"); - check("8.47622108205396074254e-01", "3.24039313247872939883e-01", GMP_RNDA, + check("8.47622108205396074254e-01", "3.24039313247872939883e-01", MPFR_RNDA, 28, 45, 2, "0.375"); - check("2.63978122803639081440e-01", "6.8378615379333496093e-1", GMP_RNDN, + check("2.63978122803639081440e-01", "6.8378615379333496093e-1", MPFR_RNDN, 34, 23, 31, "0.180504585267044603"); - check("1.0", "0.11835170935876249132", GMP_RNDU, 6, 41, 36, + check("1.0", "0.11835170935876249132", MPFR_RNDU, 6, 41, 36, "0.1183517093595583"); - check53("67108865.0", "134217729.0", GMP_RNDN, "9.007199456067584e15"); - check("1.37399642157394197284e-01", "2.28877275604219221350e-01", GMP_RNDN, + check53("67108865.0", "134217729.0", MPFR_RNDN, "9.007199456067584e15"); + check("1.37399642157394197284e-01", "2.28877275604219221350e-01", MPFR_RNDN, 49, 15, 32, "0.0314472340833162888"); check("4.03160720978664954828e-01", "5.854828e-1" - /*"5.85483042917246621073e-01"*/, GMP_RNDZ, + /*"5.85483042917246621073e-01"*/, MPFR_RNDZ, 51, 22, 32, "0.2360436821472831"); - check("3.90798504668055102229e-14", "9.85394674650308388664e-04", GMP_RNDN, + check("3.90798504668055102229e-14", "9.85394674650308388664e-04", MPFR_RNDN, 46, 22, 12, "0.385027296503914762e-16"); - check("4.58687081072827851358e-01", "2.20543551472118792844e-01", GMP_RNDN, + check("4.58687081072827851358e-01", "2.20543551472118792844e-01", MPFR_RNDN, 49, 3, 2, "0.09375"); check_max(); check_min(); diff --git a/tests/tmul_2exp.c b/tests/tmul_2exp.c index dd1de395f..dbc37b7d4 100644 --- a/tests/tmul_2exp.c +++ b/tests/tmul_2exp.c @@ -66,7 +66,7 @@ underflow (mp_exp_t e) mpfr_inits2 (8, x, y, (mpfr_ptr) 0); for (i = 15; i <= 17; i++) { - inex1 = mpfr_set_ui_2exp (x, i, -4, GMP_RNDN); + inex1 = mpfr_set_ui_2exp (x, i, -4, MPFR_RNDN); MPFR_ASSERTN (inex1 == 0); for (prec = 6; prec >= 3; prec -= 3) { @@ -75,9 +75,9 @@ underflow (mp_exp_t e) for (k = 1; k <= 4; k++) { /* The following one is assumed to be correct. */ - inex1 = mpfr_mul_2si (y, x, e, GMP_RNDN); + inex1 = mpfr_mul_2si (y, x, e, MPFR_RNDN); MPFR_ASSERTN (inex1 == 0); - inex1 = mpfr_set_ui (z1, 1 << k, GMP_RNDN); + inex1 = mpfr_set_ui (z1, 1 << k, MPFR_RNDN); MPFR_ASSERTN (inex1 == 0); mpfr_clear_flags (); /* Do not use mpfr_div_ui to avoid the optimization @@ -107,10 +107,10 @@ underflow (mp_exp_t e) div == 0 ? "mul_2si" : div == 1 ? "div_2si" : "div_2ui", i, prec, k, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); printf ("\nExpected "); - mpfr_out_str (stdout, 16, 0, z1, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, z1, MPFR_RNDN); printf (", inex = %d, flags = %u\n", SIGN (inex1), flags1); printf ("Got "); - mpfr_out_str (stdout, 16, 0, z2, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, z2, MPFR_RNDN); printf (", inex = %d, flags = %u\n", SIGN (inex2), flags2); exit (1); } /* div */ @@ -145,7 +145,7 @@ main (int argc, char *argv[]) for (i = 0; i < 3; i++) { mpfr_set_inf (w, 1); - test_mul (i, 0, w, w, 10, GMP_RNDZ); + test_mul (i, 0, w, w, 10, MPFR_RNDZ); if (!MPFR_IS_INF(w)) { printf ("Result is not Inf (i = %d)\n", i); @@ -153,7 +153,7 @@ main (int argc, char *argv[]) } mpfr_set_nan (w); - test_mul (i, 0, w, w, 10, GMP_RNDZ); + test_mul (i, 0, w, w, 10, MPFR_RNDZ); if (!MPFR_IS_NAN(w)) { printf ("Result is not NaN (i = %d)\n", i); @@ -162,24 +162,24 @@ main (int argc, char *argv[]) for (k = 0 ; k < numberof(val) ; k+=3) { - mpfr_set_str (w, val[k], 16, GMP_RNDN); - test_mul (i, 0, z, w, 10, GMP_RNDZ); - if (mpfr_cmp_str (z, val[k+1], 16, GMP_RNDN)) + mpfr_set_str (w, val[k], 16, MPFR_RNDN); + test_mul (i, 0, z, w, 10, MPFR_RNDZ); + if (mpfr_cmp_str (z, val[k+1], 16, MPFR_RNDN)) { printf ("ERROR for x * 2^n (i = %d) for %s\n", i, val[k]); printf ("Expected: %s\n" "Got : ", val[k+1]); - mpfr_out_str (stdout, 16, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN); putchar ('\n'); exit (1); } - test_mul (i, 1, z, w, 10, GMP_RNDZ); - if (mpfr_cmp_str (z, val[k+2], 16, GMP_RNDN)) + test_mul (i, 1, z, w, 10, MPFR_RNDZ); + if (mpfr_cmp_str (z, val[k+2], 16, MPFR_RNDN)) { printf ("ERROR for x / 2^n (i = %d) for %s\n", i, val[k]); printf ("Expected: %s\n" "Got : ", val[k+2]); - mpfr_out_str (stdout, 16, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN); putchar ('\n'); exit (1); } @@ -187,15 +187,15 @@ main (int argc, char *argv[]) mpfr_set_inf (w, 1); mpfr_nextbelow (w); - test_mul (i, 0, w, w, 1, GMP_RNDN); + test_mul (i, 0, w, w, 1, MPFR_RNDN); if (!mpfr_inf_p (w)) { printf ("Overflow error (i = %d)!\n", i); exit (1); } - mpfr_set_ui (w, 0, GMP_RNDN); + mpfr_set_ui (w, 0, MPFR_RNDN); mpfr_nextabove (w); - test_mul (i, 1, w, w, 1, GMP_RNDN); + test_mul (i, 1, w, w, 1, MPFR_RNDN); if (mpfr_cmp_ui (w, 0)) { printf ("Underflow error (i = %d)!\n", i); @@ -207,10 +207,10 @@ main (int argc, char *argv[]) { unsigned long lmp1 = (unsigned long) LONG_MAX + 1; - mpfr_set_ui (w, 1, GMP_RNDN); - mpfr_mul_2ui (w, w, LONG_MAX/2, GMP_RNDZ); - mpfr_div_2ui (w, w, lmp1, GMP_RNDZ); - mpfr_mul_2ui (w, w, lmp1 - LONG_MAX/2, GMP_RNDZ); + mpfr_set_ui (w, 1, MPFR_RNDN); + mpfr_mul_2ui (w, w, LONG_MAX/2, MPFR_RNDZ); + mpfr_div_2ui (w, w, lmp1, MPFR_RNDZ); + mpfr_mul_2ui (w, w, lmp1 - LONG_MAX/2, MPFR_RNDZ); if (!mpfr_cmp_ui (w, 1)) { printf ("Underflow LONG_MAX error!\n"); diff --git a/tests/tmul_d.c b/tests/tmul_d.c index 08b76c8bc..05eb4e0f2 100644 --- a/tests/tmul_d.c +++ b/tests/tmul_d.c @@ -40,7 +40,7 @@ check_nans (void) /* nan * 1.0 is nan */ mpfr_set_nan (x); mpfr_clear_flags(); - inexact = mpfr_mul_d (y, x, 1.0, GMP_RNDN); + inexact = mpfr_mul_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); MPFR_ASSERTN (mpfr_nan_p (y)); @@ -48,7 +48,7 @@ check_nans (void) /* +inf * 1.0 == +inf */ mpfr_set_inf (x, 1); mpfr_clear_flags(); - inexact = mpfr_mul_d (y, x, 1.0, GMP_RNDN); + inexact = mpfr_mul_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_inf_p (y)); @@ -56,7 +56,7 @@ check_nans (void) /* +inf * 0.0 is nan */ mpfr_clear_flags(); - inexact = mpfr_mul_d (y, x, 0.0, GMP_RNDN); + inexact = mpfr_mul_d (y, x, 0.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); MPFR_ASSERTN (mpfr_nan_p (y)); @@ -64,7 +64,7 @@ check_nans (void) /* -inf * 1.0 == -inf */ mpfr_set_inf (x, -1); mpfr_clear_flags(); - inexact = mpfr_mul_d (y, x, 1.0, GMP_RNDN); + inexact = mpfr_mul_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_inf_p (y)); @@ -93,24 +93,24 @@ main (void) mpfr_init2 (y, IEEE_DBL_MANT_DIG); mpfr_init2 (z, IEEE_DBL_MANT_DIG); - mpfr_set_str (y, "4096", 10, GMP_RNDN); + mpfr_set_str (y, "4096", 10, MPFR_RNDN); d = 0.125; mpfr_clear_flags (); - inexact = mpfr_mul_d (x, y, d, GMP_RNDN); + inexact = mpfr_mul_d (x, y, d, MPFR_RNDN); if (inexact != 0) { printf ("Inexact flag error in mpfr_mul_d\n"); exit (1); } - mpfr_set_str (z, "512", 10, GMP_RNDN); + mpfr_set_str (z, "512", 10, MPFR_RNDN); if (mpfr_cmp (z, x)) { printf ("Error in mpfr_mul_d ("); - mpfr_out_str (stdout, 10, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN); printf (" + %.20g)\nexpected ", d); - mpfr_out_str (stdout, 10, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN); printf ("\ngot "); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } diff --git a/tests/tmul_ui.c b/tests/tmul_ui.c index e947fb8b3..f1a32b4f7 100644 --- a/tests/tmul_ui.c +++ b/tests/tmul_ui.c @@ -39,14 +39,14 @@ check_inexact (mp_prec_t p) mpfr_init2 (z, p + mp_bits_per_limb); mpfr_urandomb (x, RANDS); u = randlimb (); - if (mpfr_mul_ui (z, x, u, GMP_RNDN)) + if (mpfr_mul_ui (z, x, u, MPFR_RNDN)) { printf ("Error: result should be exact\n"); exit (1); } for (q = 2; q <= p; q++) - for (rnd = 0; rnd < GMP_RND_MAX; rnd++) + for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) { mpfr_set_prec (y, q); inexact = mpfr_mul_ui (y, x, u, (mp_rnd_t) rnd); @@ -63,8 +63,8 @@ check_inexact (mp_prec_t p) } mpfr_set_prec (x, 2); - mpfr_set_ui (x, 1, GMP_RNDN); - if (mpfr_mul_ui (x, x, 5, GMP_RNDZ) == 0) + mpfr_set_ui (x, 1, MPFR_RNDN); + if (mpfr_mul_ui (x, x, 5, MPFR_RNDZ) == 0) { printf ("mul_ui(1, 5) cannot be exact with prec=2\n"); exit (1); @@ -98,8 +98,8 @@ main (int argc, char *argv[]) mpfr_init2 (y, 53); /* checks that result is normalized */ - mpfr_set_str (y, "6.93147180559945286227e-01", 10, GMP_RNDZ); - mpfr_mul_ui (x, y, 1, GMP_RNDZ); + mpfr_set_str (y, "6.93147180559945286227e-01", 10, MPFR_RNDZ); + mpfr_mul_ui (x, y, 1, MPFR_RNDZ); if (MPFR_MANT(x)[MPFR_PREC(x)/mp_bits_per_limb] >> (mp_bits_per_limb-1) == 0) { printf ("Error in mpfr_mul_ui: result not normalized\n"); @@ -114,7 +114,7 @@ main (int argc, char *argv[]) } mpfr_set_inf (x, 1); - mpfr_mul_ui (x, x, 3, GMP_RNDU); + mpfr_mul_ui (x, x, 3, MPFR_RNDU); if (!mpfr_inf_p (x) || (mpfr_sgn (x) <= 0)) { printf ("Error in mpfr_mul_ui: +Inf*3 does not give +Inf\n"); @@ -122,7 +122,7 @@ main (int argc, char *argv[]) } mpfr_set_inf (x, -1); - mpfr_mul_ui (x, x, 3, GMP_RNDU); + mpfr_mul_ui (x, x, 3, MPFR_RNDU); if (!mpfr_inf_p (x) || (mpfr_sgn (x) >= 0)) { printf ("Error in mpfr_mul_ui: -Inf*3 does not give -Inf\n"); @@ -130,7 +130,7 @@ main (int argc, char *argv[]) } mpfr_set_nan (x); - mpfr_mul_ui (x, x, 3, GMP_RNDU); + mpfr_mul_ui (x, x, 3, MPFR_RNDU); if (!mpfr_nan_p(x)) { printf ("Error in mpfr_mul_ui: NaN*3 does not give NaN\n"); @@ -138,23 +138,23 @@ main (int argc, char *argv[]) } mpfr_set_inf (x, 1); - mpfr_mul_ui (x, x, 0, GMP_RNDU); + mpfr_mul_ui (x, x, 0, MPFR_RNDU); MPFR_ASSERTN(mpfr_nan_p (x)); - mpfr_set_ui (x, 1, GMP_RNDU); - mpfr_mul_ui (x, x, 0, GMP_RNDU); + mpfr_set_ui (x, 1, MPFR_RNDU); + mpfr_mul_ui (x, x, 0, MPFR_RNDU); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x)); emax = mpfr_get_emax (); set_emax (0); mpfr_set_str_binary (x, "0.1E0"); - mpfr_mul_ui (x, x, 2, GMP_RNDN); + mpfr_mul_ui (x, x, 2, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && MPFR_IS_POS(x)); set_emax (emax); mpfr_set_str (x, /*1.0/3.0*/ - "0.333333333333333333333333333333333", 10, GMP_RNDZ); - mpfr_mul_ui (x, x, 3, GMP_RNDU); + "0.333333333333333333333333333333333", 10, MPFR_RNDZ); + mpfr_mul_ui (x, x, 3, MPFR_RNDU); if (mpfr_cmp_ui (x, 1)) { printf ("Error in mpfr_mul_ui: U(Z(1/3)*3) does not give 1\n"); @@ -162,9 +162,9 @@ main (int argc, char *argv[]) } /* checks sign is correct */ - mpfr_set_si (x, -2, GMP_RNDZ); - mpfr_set_si (y, 3, GMP_RNDZ); - mpfr_mul_ui(x, y, 4, GMP_RNDZ); + mpfr_set_si (x, -2, MPFR_RNDZ); + mpfr_set_si (y, 3, MPFR_RNDZ); + mpfr_mul_ui(x, y, 4, MPFR_RNDZ); if (mpfr_cmp_ui(x, 0) <= 0) { printf("Error in mpfr_mul_ui: 4*3.0 does not give a positive result:\n"); @@ -176,7 +176,7 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 9); mpfr_set_prec (y, 9); mpfr_set_str_binary (y, "0.100001111E9"); /* 271 */ - mpfr_mul_ui (x, y, 1335, GMP_RNDN); + mpfr_mul_ui (x, y, 1335, MPFR_RNDN); mpfr_set_str_binary (y, "0.101100001E19"); /* 361472 */ if (mpfr_cmp (x, y)) { @@ -189,7 +189,7 @@ main (int argc, char *argv[]) mpfr_set_prec(x, 100); /* y = 1199781142214086656 */ mpfr_set_str_binary(y, "0.1000010100110011110101001011110010101111000100001E61"); - mpfr_mul_ui(x, y, 121, GMP_RNDD); + mpfr_mul_ui(x, y, 121, MPFR_RNDD); /* 121*y = 145173518207904485376, representable exactly */ mpfr_set_str_binary(y, "0.1111101111010101111111100011010010111010111110110011001E67"); if (mpfr_cmp(x, y)) @@ -201,12 +201,12 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 32); mpfr_set_str_binary (x, "0.10000000000000000000000000000000E1"); mpfr_set_prec (y, 93); - mpfr_mul_ui (y, x, 1, GMP_RNDN); + mpfr_mul_ui (y, x, 1, MPFR_RNDN); mpfr_set_prec (x, 287); mpfr_set_str_binary (x, "0.1111E7"); mpfr_set_prec (y, 289); - mpfr_mul_ui (y, x, 6, GMP_RNDN); + mpfr_mul_ui (y, x, 6, MPFR_RNDN); mpfr_set_str_binary (x, "0.101101E10"); if (mpfr_cmp (x, y)) { @@ -216,8 +216,8 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 68); mpfr_set_prec (y, 64); - mpfr_set_str (x, "2143861251406875.0", 10, GMP_RNDN); - mpfr_mul_ui (y, x, 23, GMP_RNDN); + mpfr_set_str (x, "2143861251406875.0", 10, MPFR_RNDN); + mpfr_mul_ui (y, x, 23, MPFR_RNDN); mpfr_set_str_binary (x, "10101111001011100001100110101111110001010010011001101101.0"); if (mpfr_cmp (x, y)) { @@ -235,7 +235,7 @@ main (int argc, char *argv[]) for (yprec = 53; yprec <= 128; yprec++) { mpfr_set_prec (y, yprec); - mpfr_mul_ui (y, x, 1, GMP_RNDN); + mpfr_mul_ui (y, x, 1, MPFR_RNDN); if (mpfr_cmp(x,y)) { printf ("multiplication by 1.0 fails for xprec=%u, yprec=%u\n", @@ -248,11 +248,11 @@ main (int argc, char *argv[]) } mpfr_set_prec (x, 128); - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_mul_ui (x, x, ULONG_HIGHBIT, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_mul_ui (x, x, ULONG_HIGHBIT, MPFR_RNDN); mpfr_set_prec (y, 128); - mpfr_set_ui (y, ULONG_HIGHBIT, GMP_RNDN); - mpfr_mul_ui (y, y, 17, GMP_RNDN); + mpfr_set_ui (y, ULONG_HIGHBIT, MPFR_RNDN); + mpfr_mul_ui (y, y, 17, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("Error for 17 * ULONG_HIGHBIT\n"); @@ -262,11 +262,11 @@ main (int argc, char *argv[]) /* Check regression */ mpfr_set_prec (x, 32); mpfr_set_prec (y, 96); - mpfr_set_ui (x, 1742175942, GMP_RNDN); - mpfr_mul_ui (y, x, 59, GMP_RNDN); + mpfr_set_ui (x, 1742175942, MPFR_RNDN); + mpfr_mul_ui (y, x, 59, MPFR_RNDN); if (mpfr_cmp_str (y, "0.10111111011101010101000110111101000100000000000000" "0000000000000000000000000000000000000000000000E37", - 2, GMP_RNDN)) + 2, MPFR_RNDN)) { printf ("Regression tested failed for x=1742175942 * 59\n"); exit (1); diff --git a/tests/tnext.c b/tests/tnext.c index 9a129c51f..5e45f5335 100644 --- a/tests/tnext.c +++ b/tests/tnext.c @@ -51,11 +51,11 @@ generic_abovebelow (void) MPFR_ASSERTN(mpfr_nan_p (x)); mpfr_nexttoward (x, y); MPFR_ASSERTN(mpfr_nan_p (x)); - mpfr_set_ui (y, 1, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); mpfr_nexttoward (y, x); MPFR_ASSERTN(mpfr_nan_p (y)); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_set_ui (y, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); mpfr_nexttoward (x, y); MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0); } @@ -65,26 +65,26 @@ generic_abovebelow (void) while (mpfr_cmp_ui (x, 0) == 0); neg = randlimb () & 1; if (neg) - mpfr_neg (x, x, GMP_RNDN); - mpfr_set (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_set (y, x, MPFR_RNDN); below = randlimb () & 1; if (below) mpfr_nextbelow (y); else mpfr_nextabove (y); - mpfr_set_si (t, below ? -5 : 5, GMP_RNDN); - mpfr_mul_2si (t, t, (mpfr_get_exp) (x) - prec - 3, GMP_RNDN); + mpfr_set_si (t, below ? -5 : 5, MPFR_RNDN); + mpfr_mul_2si (t, t, (mpfr_get_exp) (x) - prec - 3, MPFR_RNDN); /* t = (1/2 + 1/8) ulp(x) */ - mpfr_add (z, x, t, GMP_RNDN); + mpfr_add (z, x, t, MPFR_RNDN); if (!mpfr_number_p (y) || mpfr_cmp (y, z) != 0) { printf ("Error in mpfr_next%s for\n", below ? "below" : "above"); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf (", got\n"); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf (" instead of\n"); - mpfr_out_str (stdout, 2, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); printf ("\n"); exit (1); } @@ -108,10 +108,10 @@ inverse_test (void) int sign; mpfr_inits2 (prec, x, y, (mpfr_ptr) 0); - mpfr_set_str (x, tests[i], 10, GMP_RNDN); + mpfr_set_str (x, tests[i], 10, MPFR_RNDN); if (neg) - mpfr_neg (x, x, GMP_RNDN); - mpfr_set (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_set (y, x, MPFR_RNDN); if (below) mpfr_nextbelow (y); else @@ -125,9 +125,9 @@ inverse_test (void) " below = %d, prec = %d: x = y", tests[i], neg, below, (int) prec); printf ("\nx = "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\ny = "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); exit (1); } @@ -137,7 +137,7 @@ inverse_test (void) printf ("Sign error in inverse_test for %s, neg = %d," " below = %d, prec = %d\n", tests[i], neg, below, (int) prec); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); exit (1); } @@ -147,9 +147,9 @@ inverse_test (void) printf ("Error in inverse_test for %s, neg = %d, below = %d," " prec = %d", tests[i], neg, below, (int) prec); printf ("\nx = "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\ny = "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); exit (1); } diff --git a/tests/tout_str.c b/tests/tout_str.c index a4b6ca7d1..d79387664 100644 --- a/tests/tout_str.c +++ b/tests/tout_str.c @@ -52,18 +52,18 @@ special (void) mpfr_init (x); mpfr_set_nan (x); - mpfr_out_str (fout, 10, 0, x, GMP_RNDN); + mpfr_out_str (fout, 10, 0, x, MPFR_RNDN); mpfr_set_inf (x, 1); - mpfr_out_str (fout, 10, 0, x, GMP_RNDN); + mpfr_out_str (fout, 10, 0, x, MPFR_RNDN); mpfr_set_inf (x, -1); - mpfr_out_str (fout, 10, 0, x, GMP_RNDN); + mpfr_out_str (fout, 10, 0, x, MPFR_RNDN); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_out_str (fout, 10, 0, x, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - mpfr_out_str (fout, 10, 0, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_out_str (fout, 10, 0, x, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_out_str (fout, 10, 0, x, MPFR_RNDN); mpfr_clear (x); } @@ -100,22 +100,22 @@ main (int argc, char *argv[]) special (); - check (-1.37247529013405550000e+15, GMP_RNDN, 7); - check (-1.5674376729569697500e+15, GMP_RNDN, 19); - check (-5.71262771772792640000e-79, GMP_RNDU, 16); - check (DBL_NEG_ZERO, GMP_RNDU, 7); - check (-4.5306392613572974756e-308, GMP_RNDN, 8); - check (-6.7265890111403371523e-165, GMP_RNDN, 4); - check (-1.3242553591261807653e+156, GMP_RNDN, 16); - check (-6.606499965302424244461355e233, GMP_RNDN, 10); - check4 (1.0, GMP_RNDN, 10, 120); - check (1.0, GMP_RNDU, 10); - check (4.059650008e-83, GMP_RNDN, 10); - check (-7.4, GMP_RNDN, 10); - check (0.997, GMP_RNDN, 10); - check (-4.53063926135729747564e-308, GMP_RNDN, 10); - check (2.14478198760196000000e+16, GMP_RNDN, 10); - check (7.02293374921793516813e-84, GMP_RNDN, 10); + check (-1.37247529013405550000e+15, MPFR_RNDN, 7); + check (-1.5674376729569697500e+15, MPFR_RNDN, 19); + check (-5.71262771772792640000e-79, MPFR_RNDU, 16); + check (DBL_NEG_ZERO, MPFR_RNDU, 7); + check (-4.5306392613572974756e-308, MPFR_RNDN, 8); + check (-6.7265890111403371523e-165, MPFR_RNDN, 4); + check (-1.3242553591261807653e+156, MPFR_RNDN, 16); + check (-6.606499965302424244461355e233, MPFR_RNDN, 10); + check4 (1.0, MPFR_RNDN, 10, 120); + check (1.0, MPFR_RNDU, 10); + check (4.059650008e-83, MPFR_RNDN, 10); + check (-7.4, MPFR_RNDN, 10); + check (0.997, MPFR_RNDN, 10); + check (-4.53063926135729747564e-308, MPFR_RNDN, 10); + check (2.14478198760196000000e+16, MPFR_RNDN, 10); + check (7.02293374921793516813e-84, MPFR_RNDN, 10); /* random tests */ for (i=0;i= 53; if (ok) { @@ -82,9 +82,9 @@ check_pow_ui (void) mpfr_init2 (b, 53); /* check in-place operations */ - mpfr_set_str (b, "0.6926773", 10, GMP_RNDN); - mpfr_pow_ui (a, b, 10, GMP_RNDN); - mpfr_pow_ui (b, b, 10, GMP_RNDN); + mpfr_set_str (b, "0.6926773", 10, MPFR_RNDN); + mpfr_pow_ui (a, b, 10, MPFR_RNDN); + mpfr_pow_ui (b, b, 10, MPFR_RNDN); if (mpfr_cmp (a, b)) { printf ("Error for mpfr_pow_ui (b, b, ...)\n"); @@ -92,11 +92,11 @@ check_pow_ui (void) } /* check large exponents */ - mpfr_set_ui (b, 1, GMP_RNDN); - mpfr_pow_ui (a, b, 4294967295UL, GMP_RNDN); + mpfr_set_ui (b, 1, MPFR_RNDN); + mpfr_pow_ui (a, b, 4294967295UL, MPFR_RNDN); mpfr_set_inf (a, -1); - mpfr_pow_ui (a, a, 4049053855UL, GMP_RNDN); + mpfr_pow_ui (a, a, 4049053855UL, MPFR_RNDN); if (!mpfr_inf_p (a) || (mpfr_sgn (a) >= 0)) { printf ("Error for (-Inf)^4049053855\n"); @@ -104,7 +104,7 @@ check_pow_ui (void) } mpfr_set_inf (a, -1); - mpfr_pow_ui (a, a, (unsigned long) 30002752, GMP_RNDN); + mpfr_pow_ui (a, a, (unsigned long) 30002752, MPFR_RNDN); if (!mpfr_inf_p (a) || (mpfr_sgn (a) <= 0)) { printf ("Error for (-Inf)^30002752\n"); @@ -113,7 +113,7 @@ check_pow_ui (void) /* Check underflow */ mpfr_set_str_binary (a, "1E-1"); - res = mpfr_pow_ui (a, a, -mpfr_get_emin (), GMP_RNDN); + res = mpfr_pow_ui (a, a, -mpfr_get_emin (), MPFR_RNDN); if (MPFR_GET_EXP (a) != mpfr_get_emin () + 1) { printf ("Error for (1e-1)^MPFR_EMAX_MAX\n"); @@ -122,7 +122,7 @@ check_pow_ui (void) } mpfr_set_str_binary (a, "1E-10"); - res = mpfr_pow_ui (a, a, -mpfr_get_emin (), GMP_RNDZ); + res = mpfr_pow_ui (a, a, -mpfr_get_emin (), MPFR_RNDZ); if (!MPFR_IS_ZERO (a)) { printf ("Error for (1e-10)^MPFR_EMAX_MAX\n"); @@ -132,7 +132,7 @@ check_pow_ui (void) /* Check overflow */ mpfr_set_str_binary (a, "1E10"); - res = mpfr_pow_ui (a, a, ULONG_MAX, GMP_RNDN); + res = mpfr_pow_ui (a, a, ULONG_MAX, MPFR_RNDN); if (!MPFR_IS_INF (a) || MPFR_SIGN (a) < 0) { printf ("Error for (1e10)^ULONG_MAX\n"); @@ -145,7 +145,7 @@ check_pow_ui (void) gets a wrong sign (positive instead of negative). */ mpfr_set_str_binary (a, "-1E10"); n = (ULONG_MAX ^ (ULONG_MAX >> 1)) + 1; - res = mpfr_pow_ui (a, a, n, GMP_RNDN); + res = mpfr_pow_ui (a, a, n, MPFR_RNDN); if (!MPFR_IS_INF (a) || MPFR_SIGN (a) > 0) { printf ("Error for (-1e10)^%lu, expected -Inf,\ngot ", n); @@ -156,8 +156,8 @@ check_pow_ui (void) /* Check 0 */ MPFR_SET_ZERO (a); MPFR_SET_POS (a); - mpfr_set_si (b, -1, GMP_RNDN); - res = mpfr_pow_ui (b, a, 1, GMP_RNDN); + mpfr_set_si (b, -1, MPFR_RNDN); + res = mpfr_pow_ui (b, a, 1, MPFR_RNDN); if (res != 0 || MPFR_IS_NEG (b)) { printf ("Error for (0+)^1\n"); @@ -165,8 +165,8 @@ check_pow_ui (void) } MPFR_SET_ZERO (a); MPFR_SET_NEG (a); - mpfr_set_ui (b, 1, GMP_RNDN); - res = mpfr_pow_ui (b, a, 5, GMP_RNDN); + mpfr_set_ui (b, 1, MPFR_RNDN); + res = mpfr_pow_ui (b, a, 5, MPFR_RNDN); if (res != 0 || MPFR_IS_POS (b)) { printf ("Error for (0-)^5\n"); @@ -174,8 +174,8 @@ check_pow_ui (void) } MPFR_SET_ZERO (a); MPFR_SET_NEG (a); - mpfr_set_si (b, -1, GMP_RNDN); - res = mpfr_pow_ui (b, a, 6, GMP_RNDN); + mpfr_set_si (b, -1, MPFR_RNDN); + res = mpfr_pow_ui (b, a, 6, MPFR_RNDN); if (res != 0 || MPFR_IS_NEG (b)) { printf ("Error for (0-)^6\n"); @@ -186,7 +186,7 @@ check_pow_ui (void) mpfr_set_prec (b, 122); mpfr_set_str_binary (a, "0.10000010010000111101001110100101101010011110011100001111000001001101000110011001001001001011001011010110110110101000111011E1"); mpfr_set_str_binary (b, "0.11111111100101001001000001000001100011100000001110111111100011111000111011100111111111110100011000111011000100100011001011E51290375"); - mpfr_pow_ui (a, a, 2026876995UL, GMP_RNDU); + mpfr_pow_ui (a, a, 2026876995UL, MPFR_RNDU); if (mpfr_cmp (a, b) != 0) { printf ("Error for x^2026876995\n"); @@ -197,14 +197,14 @@ check_pow_ui (void) mpfr_set_prec (b, 29); mpfr_set_str_binary (a, "1.0000000000000000000000001111"); mpfr_set_str_binary (b, "1.1001101111001100111001010111e165"); - mpfr_pow_ui (a, a, 2055225053, GMP_RNDZ); + mpfr_pow_ui (a, a, 2055225053, MPFR_RNDZ); if (mpfr_cmp (a, b) != 0) { printf ("Error for x^2055225053\n"); printf ("Expected "); - mpfr_out_str (stdout, 2, 0, b, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, b, MPFR_RNDN); printf ("\nGot "); - mpfr_out_str (stdout, 2, 0, a, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN); printf ("\n"); exit (1); } @@ -214,41 +214,41 @@ check_pow_ui (void) mpfr_set_prec (b, 53); mpfr_set_str_binary (a, "1.0000010110000100001000101101101001011101101011010111"); mpfr_set_str_binary (b, "1.0000110111101111011010110100001100010000001010110100E1"); - mpfr_pow_ui (a, a, 35, GMP_RNDN); + mpfr_pow_ui (a, a, 35, MPFR_RNDN); if (mpfr_cmp (a, b) != 0) { printf ("Error in mpfr_pow_ui for worst case (1)\n"); printf ("Expected "); - mpfr_out_str (stdout, 2, 0, b, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, b, MPFR_RNDN); printf ("\nGot "); - mpfr_out_str (stdout, 2, 0, a, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN); printf ("\n"); exit (1); } /* worst cases found on 2006-11-26 */ mpfr_set_str_binary (a, "1.0110100111010001101001010111001110010100111111000011"); mpfr_set_str_binary (b, "1.1111010011101110001111010110000101110000110110101100E17"); - mpfr_pow_ui (a, a, 36, GMP_RNDD); + mpfr_pow_ui (a, a, 36, MPFR_RNDD); if (mpfr_cmp (a, b) != 0) { printf ("Error in mpfr_pow_ui for worst case (2)\n"); printf ("Expected "); - mpfr_out_str (stdout, 2, 0, b, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, b, MPFR_RNDN); printf ("\nGot "); - mpfr_out_str (stdout, 2, 0, a, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN); printf ("\n"); exit (1); } mpfr_set_str_binary (a, "1.1001010100001110000110111111100011011101110011000100"); mpfr_set_str_binary (b, "1.1100011101101101100010110001000001110001111110010001E23"); - mpfr_pow_ui (a, a, 36, GMP_RNDU); + mpfr_pow_ui (a, a, 36, MPFR_RNDU); if (mpfr_cmp (a, b) != 0) { printf ("Error in mpfr_pow_ui for worst case (3)\n"); printf ("Expected "); - mpfr_out_str (stdout, 2, 0, b, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, b, MPFR_RNDN); printf ("\nGot "); - mpfr_out_str (stdout, 2, 0, a, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN); printf ("\n"); exit (1); } @@ -265,37 +265,37 @@ check_pow_si (void) mpfr_init (x); mpfr_set_nan (x); - mpfr_pow_si (x, x, -1, GMP_RNDN); + mpfr_pow_si (x, x, -1, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (x)); mpfr_set_inf (x, 1); - mpfr_pow_si (x, x, -1, GMP_RNDN); + mpfr_pow_si (x, x, -1, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x)); mpfr_set_inf (x, -1); - mpfr_pow_si (x, x, -1, GMP_RNDN); + mpfr_pow_si (x, x, -1, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_NEG(x)); mpfr_set_inf (x, -1); - mpfr_pow_si (x, x, -2, GMP_RNDN); + mpfr_pow_si (x, x, -2, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x)); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_pow_si (x, x, -1, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_pow_si (x, x, -1, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - mpfr_pow_si (x, x, -1, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_pow_si (x, x, -1, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - mpfr_pow_si (x, x, -2, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_pow_si (x, x, -2, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); - mpfr_set_si (x, 2, GMP_RNDN); - mpfr_pow_si (x, x, LONG_MAX, GMP_RNDN); /* 2^LONG_MAX */ + mpfr_set_si (x, 2, MPFR_RNDN); + mpfr_pow_si (x, x, LONG_MAX, MPFR_RNDN); /* 2^LONG_MAX */ if (LONG_MAX > mpfr_get_emax () - 1) /* LONG_MAX + 1 > emax */ { MPFR_ASSERTN (mpfr_inf_p (x)); @@ -305,8 +305,8 @@ check_pow_si (void) MPFR_ASSERTN (mpfr_cmp_si_2exp (x, 1, LONG_MAX)); } - mpfr_set_si (x, 2, GMP_RNDN); - mpfr_pow_si (x, x, LONG_MIN, GMP_RNDN); /* 2^LONG_MIN */ + mpfr_set_si (x, 2, MPFR_RNDN); + mpfr_pow_si (x, x, LONG_MIN, MPFR_RNDN); /* 2^LONG_MIN */ if (LONG_MIN + 1 < mpfr_get_emin ()) { MPFR_ASSERTN (mpfr_zero_p (x)); @@ -316,8 +316,8 @@ check_pow_si (void) MPFR_ASSERTN (mpfr_cmp_si_2exp (x, 1, LONG_MIN)); } - mpfr_set_si (x, 2, GMP_RNDN); - mpfr_pow_si (x, x, LONG_MIN + 1, GMP_RNDN); /* 2^(LONG_MIN+1) */ + mpfr_set_si (x, 2, MPFR_RNDN); + mpfr_pow_si (x, x, LONG_MIN + 1, MPFR_RNDN); /* 2^(LONG_MIN+1) */ if (mpfr_nan_p (x)) { printf ("Error in pow_si(2, LONG_MIN+1): got NaN\n"); @@ -332,8 +332,8 @@ check_pow_si (void) MPFR_ASSERTN (mpfr_cmp_si_2exp (x, 1, LONG_MIN + 1)); } - mpfr_set_si_2exp (x, 1, -1, GMP_RNDN); /* 0.5 */ - mpfr_pow_si (x, x, LONG_MIN, GMP_RNDN); /* 2^(-LONG_MIN) */ + mpfr_set_si_2exp (x, 1, -1, MPFR_RNDN); /* 0.5 */ + mpfr_pow_si (x, x, LONG_MIN, MPFR_RNDN); /* 2^(-LONG_MIN) */ if (LONG_MIN < 1 - mpfr_get_emax ()) /* 1 - LONG_MIN > emax */ { MPFR_ASSERTN (mpfr_inf_p (x)); @@ -354,9 +354,9 @@ check_special_pow_si (void) mpfr_init (a); mpfr_init (b); - mpfr_set_str (a, "2E100000000", 10, GMP_RNDN); - mpfr_set_si (b, -10, GMP_RNDN); - test_pow (b, a, b, GMP_RNDN); + mpfr_set_str (a, "2E100000000", 10, MPFR_RNDN); + mpfr_set_si (b, -10, MPFR_RNDN); + test_pow (b, a, b, MPFR_RNDN); if (!MPFR_IS_ZERO(b)) { printf("Pow(2E10000000, -10) failed\n"); @@ -367,8 +367,8 @@ check_special_pow_si (void) emin = mpfr_get_emin (); mpfr_set_emin (-10); - mpfr_set_si (a, -2, GMP_RNDN); - mpfr_pow_si (b, a, -10000, GMP_RNDN); + mpfr_set_si (a, -2, MPFR_RNDN); + mpfr_pow_si (b, a, -10000, MPFR_RNDN); if (!MPFR_IS_ZERO (b)) { printf ("Pow_so (1, -10000) doesn't underflow if emin=-10.\n"); @@ -388,19 +388,19 @@ pow_si_long_min (void) int inex; mpfr_inits2 (sizeof(long) * CHAR_BIT + 32, x, y, z, (mpfr_ptr) 0); - mpfr_set_si_2exp (x, 3, -1, GMP_RNDN); /* 1.5 */ + mpfr_set_si_2exp (x, 3, -1, MPFR_RNDN); /* 1.5 */ - inex = mpfr_set_si (y, LONG_MIN, GMP_RNDN); + inex = mpfr_set_si (y, LONG_MIN, MPFR_RNDN); MPFR_ASSERTN (inex == 0); mpfr_nextbelow (y); - mpfr_pow (y, x, y, GMP_RNDD); + mpfr_pow (y, x, y, MPFR_RNDD); - inex = mpfr_set_si (z, LONG_MIN, GMP_RNDN); + inex = mpfr_set_si (z, LONG_MIN, MPFR_RNDN); MPFR_ASSERTN (inex == 0); mpfr_nextabove (z); - mpfr_pow (z, x, z, GMP_RNDU); + mpfr_pow (z, x, z, MPFR_RNDU); - mpfr_pow_si (x, x, LONG_MIN, GMP_RNDN); /* 1.5^LONG_MIN */ + mpfr_pow_si (x, x, LONG_MIN, MPFR_RNDN); /* 1.5^LONG_MIN */ if (mpfr_cmp (x, y) < 0 || mpfr_cmp (x, z) > 0) { printf ("Error in pow_si_long_min\n"); @@ -426,7 +426,7 @@ check_inexact (mp_prec_t p) mpfr_urandomb (x, RANDS); u = randlimb () % 2; for (q = 2; q <= p; q++) - for (rnd = 0; rnd < GMP_RND_MAX; rnd++) + for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) { mpfr_set_prec (y, q); mpfr_set_prec (z, q + 10); @@ -464,9 +464,9 @@ check_inexact (mp_prec_t p) mpfr_set_prec (x, p); mpfr_set_prec (y, p); mpfr_set_prec (z, p); - mpfr_set_ui (x, 4, GMP_RNDN); - mpfr_set_str (y, "0.5", 10, GMP_RNDN); - test_pow (z, x, y, GMP_RNDZ); + mpfr_set_ui (x, 4, MPFR_RNDN); + mpfr_set_str (y, "0.5", 10, MPFR_RNDN); + test_pow (z, x, y, MPFR_RNDZ); mpfr_clear (x); mpfr_clear (y); @@ -486,16 +486,16 @@ special (void) mpfr_init2 (z, 53); mpfr_init2 (t, 2); - mpfr_set_ui (x, 2, GMP_RNDN); - mpfr_pow_si (x, x, -2, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); + mpfr_pow_si (x, x, -2, MPFR_RNDN); if (mpfr_cmp_ui_2exp (x, 1, -2)) { printf ("Error in pow_si(x,x,-2) for x=2\n"); exit (1); } - mpfr_set_ui (x, 2, GMP_RNDN); - mpfr_set_si (y, -2, GMP_RNDN); - test_pow (x, x, y, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); + mpfr_set_si (y, -2, MPFR_RNDN); + test_pow (x, x, y, MPFR_RNDN); if (mpfr_cmp_ui_2exp (x, 1, -2)) { printf ("Error in pow(x,x,y) for x=2, y=-2\n"); @@ -507,7 +507,7 @@ special (void) mpfr_set_prec (y, 53); mpfr_set_str_binary (y, "0.11010110011100101010110011001010100111000001000101110E-1"); mpfr_set_prec (z, 2); - test_pow (z, x, y, GMP_RNDZ); + test_pow (z, x, y, MPFR_RNDZ); mpfr_set_str_binary (x, "1.0e-1"); if (mpfr_cmp (x, z)) { @@ -523,22 +523,22 @@ special (void) mpfr_set_str_binary (y, "0.111110010100110000011101100011010111000010000100101"); mpfr_set_str_binary (t, "0.1110110011110110001000110100100001001111010011111000010000011001"); - test_pow (z, x, y, GMP_RNDN); + test_pow (z, x, y, MPFR_RNDN); if (mpfr_cmp (z, t)) { - printf ("Error in mpfr_pow for prec=64, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_pow for prec=64, rnd=MPFR_RNDN\n"); exit (1); } mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); mpfr_set_prec (z, 53); - mpfr_set_str (x, "5.68824667828621954868e-01", 10, GMP_RNDN); - mpfr_set_str (y, "9.03327850535952658895e-01", 10, GMP_RNDN); - test_pow (z, x, y, GMP_RNDZ); + mpfr_set_str (x, "5.68824667828621954868e-01", 10, MPFR_RNDN); + mpfr_set_str (y, "9.03327850535952658895e-01", 10, MPFR_RNDN); + test_pow (z, x, y, MPFR_RNDZ); if (mpfr_cmp_str1 (z, "0.60071044650456473235")) { - printf ("Error in mpfr_pow for prec=53, rnd=GMP_RNDZ\n"); + printf ("Error in mpfr_pow for prec=53, rnd=MPFR_RNDZ\n"); exit (1); } @@ -546,29 +546,29 @@ special (void) mpfr_set_prec (x, 30); mpfr_set_prec (y, 30); mpfr_set_prec (z, 30); - mpfr_set_str (x, "1.00000000001010111110001111011e1", 2, GMP_RNDN); - mpfr_set_str (t, "-0.5", 10, GMP_RNDN); - test_pow (z, x, t, GMP_RNDN); - mpfr_set_str (y, "1.01101001111010101110000101111e-1", 2, GMP_RNDN); + mpfr_set_str (x, "1.00000000001010111110001111011e1", 2, MPFR_RNDN); + mpfr_set_str (t, "-0.5", 10, MPFR_RNDN); + test_pow (z, x, t, MPFR_RNDN); + mpfr_set_str (y, "1.01101001111010101110000101111e-1", 2, MPFR_RNDN); if (mpfr_cmp (z, y)) { - printf ("Error in mpfr_pow for prec=30, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_pow for prec=30, rnd=MPFR_RNDN\n"); exit (1); } mpfr_set_prec (x, 21); mpfr_set_prec (y, 21); mpfr_set_prec (z, 21); - mpfr_set_str (x, "1.11111100100001100101", 2, GMP_RNDN); - test_pow (z, x, t, GMP_RNDZ); - mpfr_set_str (y, "1.01101011010001100000e-1", 2, GMP_RNDN); + mpfr_set_str (x, "1.11111100100001100101", 2, MPFR_RNDN); + test_pow (z, x, t, MPFR_RNDZ); + mpfr_set_str (y, "1.01101011010001100000e-1", 2, MPFR_RNDN); if (mpfr_cmp (z, y)) { - printf ("Error in mpfr_pow for prec=21, rnd=GMP_RNDZ\n"); + printf ("Error in mpfr_pow for prec=21, rnd=MPFR_RNDZ\n"); printf ("Expected "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\nGot "); - mpfr_out_str (stdout, 2, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); printf ("\n"); exit (1); } @@ -578,26 +578,26 @@ special (void) mpfr_set_prec (y, 2); mpfr_set_prec (z, 169); mpfr_set_str1 (x, "6078673043126084065007902175846955"); - mpfr_set_ui_2exp (y, 3, -1, GMP_RNDN); - test_pow (z, x, y, GMP_RNDZ); + mpfr_set_ui_2exp (y, 3, -1, MPFR_RNDN); + test_pow (z, x, y, MPFR_RNDZ); if (mpfr_cmp_str1 (z, "473928882491000966028828671876527456070714790264144")) { printf ("Error in mpfr_pow for 6078673043126084065007902175846955"); - printf ("^(3/2), GMP_RNDZ\nExpected "); + printf ("^(3/2), MPFR_RNDZ\nExpected "); printf ("4.73928882491000966028828671876527456070714790264144e50"); printf ("\nGot "); - mpfr_out_str (stdout, 10, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN); printf ("\n"); exit (1); } - test_pow (z, x, y, GMP_RNDU); + test_pow (z, x, y, MPFR_RNDU); if (mpfr_cmp_str1 (z, "473928882491000966028828671876527456070714790264145")) { printf ("Error in mpfr_pow for 6078673043126084065007902175846955"); - printf ("^(3/2), GMP_RNDU\nExpected "); + printf ("^(3/2), MPFR_RNDU\nExpected "); printf ("4.73928882491000966028828671876527456070714790264145e50"); printf ("\nGot "); - mpfr_out_str (stdout, 10, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN); printf ("\n"); exit (1); } @@ -605,49 +605,49 @@ special (void) mpfr_set_inf (x, 1); mpfr_set_prec (y, 2); mpfr_set_str_binary (y, "1E10"); - test_pow (z, x, y, GMP_RNDN); + test_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z)); mpfr_set_inf (x, -1); - test_pow (z, x, y, GMP_RNDN); + test_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z)); mpfr_set_prec (y, 10); mpfr_set_str_binary (y, "1.000000001E9"); - test_pow (z, x, y, GMP_RNDN); + test_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_NEG(z)); mpfr_set_str_binary (y, "1.000000001E8"); - test_pow (z, x, y, GMP_RNDN); + test_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z)); mpfr_set_inf (x, -1); mpfr_set_prec (y, 2 * mp_bits_per_limb); - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_mul_2exp (y, y, mp_bits_per_limb - 1, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_mul_2exp (y, y, mp_bits_per_limb - 1, MPFR_RNDN); /* y = 2^(mp_bits_per_limb - 1) */ - test_pow (z, x, y, GMP_RNDN); + test_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z)); mpfr_nextabove (y); - test_pow (z, x, y, GMP_RNDN); + test_pow (z, x, y, MPFR_RNDN); /* y = 2^(mp_bits_per_limb - 1) + epsilon */ MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z)); mpfr_nextbelow (y); - mpfr_div_2exp (y, y, 1, GMP_RNDN); + mpfr_div_2exp (y, y, 1, MPFR_RNDN); mpfr_nextabove (y); - test_pow (z, x, y, GMP_RNDN); + test_pow (z, x, y, MPFR_RNDN); /* y = 2^(mp_bits_per_limb - 2) + epsilon */ MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z)); - mpfr_set_si (x, -1, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); mpfr_set_prec (y, 2); mpfr_set_str_binary (y, "1E10"); - test_pow (z, x, y, GMP_RNDN); + test_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (z, 1) == 0); /* Check (-0)^(17.0001) */ mpfr_set_prec (x, 6); mpfr_set_prec (y, 640); MPFR_SET_ZERO (x); MPFR_SET_NEG (x); - mpfr_set_ui (y, 17, GMP_RNDN); mpfr_nextabove (y); - test_pow (z, x, y, GMP_RNDN); + mpfr_set_ui (y, 17, MPFR_RNDN); mpfr_nextabove (y); + test_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_POS (z)); /* Bugs reported by Kevin Rauch on 29 Oct 2007 */ @@ -658,40 +658,40 @@ special (void) mpfr_set_prec (x, 64); mpfr_set_prec (y, 64); mpfr_set_prec (z, 64); - mpfr_set_str (x, "-0.5", 10, GMP_RNDN); - mpfr_set_str (y, "-0.ffffffffffffffff", 16, GMP_RNDN); + mpfr_set_str (x, "-0.5", 10, MPFR_RNDN); + mpfr_set_str (y, "-0.ffffffffffffffff", 16, MPFR_RNDN); mpfr_set_exp (y, mpfr_get_emax ()); - inex = mpfr_pow (z, x, y, GMP_RNDN); + inex = mpfr_pow (z, x, y, MPFR_RNDN); /* (-0.5)^(-n) = 1/2^n for n even */ MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS (z) && inex > 0); /* (-1)^(-n) = 1 for n even */ - mpfr_set_str (x, "-1", 10, GMP_RNDN); - inex = mpfr_pow (z, x, y, GMP_RNDN); + mpfr_set_str (x, "-1", 10, MPFR_RNDN); + inex = mpfr_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (z, 1) == 0 && inex == 0); /* (-1)^n = 1 for n even */ - mpfr_set_str (x, "-1", 10, GMP_RNDN); - mpfr_neg (y, y, GMP_RNDN); - inex = mpfr_pow (z, x, y, GMP_RNDN); + mpfr_set_str (x, "-1", 10, MPFR_RNDN); + mpfr_neg (y, y, MPFR_RNDN); + inex = mpfr_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (z, 1) == 0 && inex == 0); /* (-1.5)^n = +Inf for n even */ - mpfr_set_str (x, "-1.5", 10, GMP_RNDN); - inex = mpfr_pow (z, x, y, GMP_RNDN); + mpfr_set_str (x, "-1.5", 10, MPFR_RNDN); + inex = mpfr_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS (z) && inex > 0); /* (-n)^1.5 = NaN for n even */ - mpfr_neg (y, y, GMP_RNDN); - mpfr_set_str (x, "1.5", 10, GMP_RNDN); - inex = mpfr_pow (z, y, x, GMP_RNDN); + mpfr_neg (y, y, MPFR_RNDN); + mpfr_set_str (x, "1.5", 10, MPFR_RNDN); + inex = mpfr_pow (z, y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (z)); /* x^(-1.5) = NaN for x small < 0 */ - mpfr_set_str (x, "-0.8", 16, GMP_RNDN); + mpfr_set_str (x, "-0.8", 16, MPFR_RNDN); mpfr_set_exp (x, mpfr_get_emin ()); - mpfr_set_str (y, "-1.5", 10, GMP_RNDN); - inex = mpfr_pow (z, x, y, GMP_RNDN); + mpfr_set_str (y, "-1.5", 10, MPFR_RNDN); + inex = mpfr_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (z)); mpfr_set_emin (emin); @@ -717,12 +717,12 @@ particular_cases (void) mpfr_set_nan (t[0]); mpfr_set_inf (t[1], 1); - mpfr_set_ui (t[3], 0, GMP_RNDN); - mpfr_set_ui (t[5], 1, GMP_RNDN); - mpfr_set_ui (t[7], 2, GMP_RNDN); - mpfr_div_2ui (t[9], t[5], 1, GMP_RNDN); + mpfr_set_ui (t[3], 0, MPFR_RNDN); + mpfr_set_ui (t[5], 1, MPFR_RNDN); + mpfr_set_ui (t[7], 2, MPFR_RNDN); + mpfr_div_2ui (t[9], t[5], 1, MPFR_RNDN); for (i = 1; i < 11; i += 2) - mpfr_neg (t[i+1], t[i], GMP_RNDN); + mpfr_neg (t[i+1], t[i], MPFR_RNDN); for (i = 0; i < 11; i++) for (j = 0; j < 11; j++) @@ -743,10 +743,10 @@ particular_cases (void) /* +0.5 */ { 0, 2, 1, 128, 128, 64, 256, 32, 512, 90, 180 }, /* -0.5 */ { 0, 2, 1, 128, 128, -64,-256, 32, 512, 0, 0 } }; - test_pow (r, t[i], t[j], GMP_RNDN); + test_pow (r, t[i], t[j], MPFR_RNDN); p = mpfr_nan_p (r) ? 0 : mpfr_inf_p (r) ? 1 : mpfr_cmp_ui (r, 0) == 0 ? 2 : - (d = mpfr_get_d (r, GMP_RNDN), (int) (ABS(d) * 128.0)); + (d = mpfr_get_d (r, MPFR_RNDN), (int) (ABS(d) * 128.0)); if (p != 0 && MPFR_SIGN(r) < 0) p = -p; if (p != q[i][j]) @@ -778,20 +778,20 @@ underflows (void) mpfr_init2 (x, 64); mpfr_init2 (y, 64); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_set_exp (x, mpfr_get_emin()); for (i = 3; i < 10; i++) { - mpfr_set_ui (y, i, GMP_RNDN); - mpfr_div_2ui (y, y, 1, GMP_RNDN); - test_pow (y, x, y, GMP_RNDN); + mpfr_set_ui (y, i, MPFR_RNDN); + mpfr_div_2ui (y, y, 1, MPFR_RNDN); + test_pow (y, x, y, MPFR_RNDN); if (!MPFR_IS_FP(y) || mpfr_cmp_ui (y, 0)) { printf ("Error in mpfr_pow for "); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf (" ^ (%d/2)\nGot ", i); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf (" instead of 0.\n"); exit (1); } @@ -799,11 +799,11 @@ underflows (void) mpfr_init2 (z, 55); mpfr_set_str (x, "0.110011010011101001110001110100010000110111101E0", - 2, GMP_RNDN); + 2, MPFR_RNDN); mpfr_set_str (y, "0.101110010011111001011010100011011100111110011E40", - 2, GMP_RNDN); + 2, MPFR_RNDN); mpfr_clear_flags (); - inexact = mpfr_pow (z, x, y, GMP_RNDU); + inexact = mpfr_pow (z, x, y, MPFR_RNDU); if (!mpfr_underflow_p ()) { printf ("Underflow flag is not set for special underflow test.\n"); @@ -814,14 +814,14 @@ underflows (void) printf ("Ternary value is wrong for special underflow test.\n"); err = 1; } - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_nextabove (x); if (mpfr_cmp (x, z) != 0) { printf ("Wrong value for special underflow test.\nGot "); - mpfr_out_str (stdout, 2, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); printf ("\ninstead of "); - mpfr_out_str (stdout, 2, 2, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 2, x, MPFR_RNDN); printf ("\n"); err = 1; } @@ -835,10 +835,10 @@ underflows (void) mpfr_set_prec (x, 2); mpfr_set_prec (y, 2); mpfr_set_prec (z, 12); - mpfr_set_ui_2exp (x, 3, -2, GMP_RNDN); - mpfr_set_ui_2exp (y, 1, mpfr_get_emax () - 1, GMP_RNDN); + mpfr_set_ui_2exp (x, 3, -2, MPFR_RNDN); + mpfr_set_ui_2exp (y, 1, mpfr_get_emax () - 1, MPFR_RNDN); mpfr_clear_flags (); - mpfr_pow (z, x, y, GMP_RNDN); + mpfr_pow (z, x, y, MPFR_RNDN); if (!mpfr_underflow_p () || MPFR_NOTZERO (z)) { printf ("Underflow test with large y fails.\n"); @@ -850,10 +850,10 @@ underflows (void) mpfr_set_prec (x, 2); mpfr_set_prec (y, 2); mpfr_set_prec (z, 12); - mpfr_set_ui_2exp (x, 3, -2, GMP_RNDN); - mpfr_set_ui_2exp (y, 1, 38, GMP_RNDN); + mpfr_set_ui_2exp (x, 3, -2, MPFR_RNDN); + mpfr_set_ui_2exp (y, 1, 38, MPFR_RNDN); mpfr_clear_flags (); - inexact = mpfr_pow (z, x, y, GMP_RNDN); + inexact = mpfr_pow (z, x, y, MPFR_RNDN); if (!mpfr_underflow_p () || MPFR_NOTZERO (z) || inexact >= 0) { printf ("Bad underflow detection for 0.75^(2^38). Obtained:\n" @@ -871,19 +871,19 @@ underflows (void) mpfr_set_prec (x, 2); mpfr_set_prec (y, 40); mpfr_set_prec (z, 12); - mpfr_set_ui_2exp (x, 3, -1, GMP_RNDN); - mpfr_set_si_2exp (y, -1, 38, GMP_RNDN); + mpfr_set_ui_2exp (x, 3, -1, MPFR_RNDN); + mpfr_set_si_2exp (y, -1, 38, MPFR_RNDN); for (i = 0; i < 4; i++) { if (i == 2) - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); mpfr_clear_flags (); - inexact = mpfr_pow (z, x, y, GMP_RNDN); + inexact = mpfr_pow (z, x, y, MPFR_RNDN); if (!mpfr_underflow_p () || MPFR_NOTZERO (z) || (i == 3 ? (inexact <= 0) : (inexact >= 0))) { printf ("Bad underflow detection for ("); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf (")^(-2^38-%d). Obtained:\n" "Overflow flag.... %-3s (should be 'no')\n" "Underflow flag... %-3s (should be 'yes')\n" @@ -895,7 +895,7 @@ underflows (void) i == 3 ? "positive" : "negative"); exit (1); } - inexact = mpfr_sub_ui (y, y, 1, GMP_RNDN); + inexact = mpfr_sub_ui (y, y, 1, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); } mpfr_set_emin (emin); @@ -910,15 +910,15 @@ overflows (void) /* bug found by Ming J. Tsai , 4 Oct 2003 */ - mpfr_init_set_str (a, "5.1e32", 10, GMP_RNDN); + mpfr_init_set_str (a, "5.1e32", 10, MPFR_RNDN); mpfr_init (b); - test_pow (b, a, a, GMP_RNDN); + test_pow (b, a, a, MPFR_RNDN); if (!(mpfr_inf_p (b) && mpfr_sgn (b) > 0)) { printf ("Error for a^a for a=5.1e32\n"); printf ("Expected +Inf, got "); - mpfr_out_str (stdout, 10, 0, b, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, b, MPFR_RNDN); printf ("\n"); exit (1); } @@ -943,13 +943,13 @@ overflows2 (void) mpfr_inits2 (16, x, y, z, (mpfr_ptr) 0); - mpfr_set_si_2exp (x, 1, -64, GMP_RNDN); /* 2^(-64) */ - mpfr_set_si_2exp (y, -1, -1, GMP_RNDN); /* -0.5 */ + mpfr_set_si_2exp (x, 1, -64, MPFR_RNDN); /* 2^(-64) */ + mpfr_set_si_2exp (y, -1, -1, MPFR_RNDN); /* -0.5 */ for (e = 2; e <= 32; e += 17) { set_emax (e); mpfr_clear_flags (); - mpfr_pow (z, x, y, GMP_RNDN); + mpfr_pow (z, x, y, MPFR_RNDN); if (MPFR_IS_NEG (z) || ! mpfr_inf_p (z)) { printf ("Error in overflows2 (e = %d): expected +Inf, got ", e); @@ -989,10 +989,10 @@ overflows3 (void) mpfr_inits2 (16, x, y, z, (mpfr_ptr) 0); - mpfr_set_si_2exp (x, 1, -2 * (MPFR_EMAX_MAX / 3), GMP_RNDN); - mpfr_set_si_2exp (y, -3, -1, GMP_RNDN); + mpfr_set_si_2exp (x, 1, -2 * (MPFR_EMAX_MAX / 3), MPFR_RNDN); + mpfr_set_si_2exp (y, -3, -1, MPFR_RNDN); mpfr_clear_flags (); - mpfr_pow (z, x, y, GMP_RNDN); + mpfr_pow (z, x, y, MPFR_RNDN); if (MPFR_IS_NEG (z) || ! mpfr_inf_p (z)) { printf ("Error in overflows3: expected +Inf, got "); @@ -1022,11 +1022,11 @@ x_near_one (void) mpfr_init2 (y, 4); mpfr_init2 (z, 33); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_nextbelow (x); - mpfr_set_ui_2exp (y, 11, -2, GMP_RNDN); - inex = mpfr_pow (z, x, y, GMP_RNDN); - if (mpfr_cmp_str (z, "0.111111111111111111111111111111011E0", 2, GMP_RNDN) + mpfr_set_ui_2exp (y, 11, -2, MPFR_RNDN); + inex = mpfr_pow (z, x, y, MPFR_RNDN); + if (mpfr_cmp_str (z, "0.111111111111111111111111111111011E0", 2, MPFR_RNDN) || inex <= 0) { printf ("Failure in x_near_one, got inex = %d and\nz = ", inex); @@ -1043,8 +1043,8 @@ mpfr_pow275 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t r) int inex; mpfr_init2 (z, 4); - mpfr_set_ui_2exp (z, 11, -2, GMP_RNDN); - inex = mpfr_pow (y, x, z, GMP_RNDN); + mpfr_set_ui_2exp (z, 11, -2, MPFR_RNDN); + inex = mpfr_pow (y, x, z, MPFR_RNDN); mpfr_clear (z); return inex; } @@ -1062,11 +1062,11 @@ bug20071103 (void) mpfr_set_emax ( 1000000); mpfr_inits2 (64, x, y, z, (mpfr_ptr) 0); - mpfr_set_si_2exp (x, -3, -1, GMP_RNDN); /* x = -1.5 */ - mpfr_set_str (y, "-0.ffffffffffffffff", 16, GMP_RNDN); + mpfr_set_si_2exp (x, -3, -1, MPFR_RNDN); /* x = -1.5 */ + mpfr_set_str (y, "-0.ffffffffffffffff", 16, MPFR_RNDN); mpfr_set_exp (y, mpfr_get_emax ()); mpfr_clear_flags (); - mpfr_pow (z, x, y, GMP_RNDN); + mpfr_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_zero_p (z) && MPFR_SIGN (z) > 0 && __gmpfr_flags == (MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT)); mpfr_clears (x, y, z, (mpfr_ptr) 0); @@ -1089,11 +1089,11 @@ bug20071104 (void) mpfr_set_emax ( 1000000); mpfr_inits2 (20, x, y, z, (mpfr_ptr) 0); - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_nextbelow (x); /* x = -2^(emin-1) */ - mpfr_set_si (y, -2, GMP_RNDN); /* y = -2 */ + mpfr_set_si (y, -2, MPFR_RNDN); /* y = -2 */ mpfr_clear_flags (); - inex = mpfr_pow (z, x, y, GMP_RNDN); + inex = mpfr_pow (z, x, y, MPFR_RNDN); if (! mpfr_inf_p (z) || MPFR_SIGN (z) < 0) { printf ("Error in bug20071104: expected +Inf, got "); @@ -1133,13 +1133,13 @@ bug20071127 (void) mpfr_init2 (y, 128); mpfr_init2 (z, 128); - mpfr_set_str (x, "0.80000000000000000000000000000001", 16, GMP_RNDN); + mpfr_set_str (x, "0.80000000000000000000000000000001", 16, MPFR_RNDN); for (i = 1; i < 9; i *= 2) { - mpfr_set_str (y, "8000000000000000", 16, GMP_RNDN); - mpfr_add_si (y, y, i, GMP_RNDN); - tern = mpfr_pow (z, x, y, GMP_RNDN); + mpfr_set_str (y, "8000000000000000", 16, MPFR_RNDN); + mpfr_add_si (y, y, i, MPFR_RNDN); + tern = mpfr_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_zero_p (z) && MPFR_IS_POS(z)); } @@ -1169,26 +1169,26 @@ bug20071128 (void) mpfr_init2 (y, 64); mpfr_init2 (z, 64); - mpfr_set_str (max_val, "0.ffffffffffffffff", 16, GMP_RNDN); + mpfr_set_str (max_val, "0.ffffffffffffffff", 16, MPFR_RNDN); mpfr_set_exp (max_val, mpfr_get_emax ()); - mpfr_neg (x, max_val, GMP_RNDN); + mpfr_neg (x, max_val, MPFR_RNDN); /* on 64-bit machines */ for (i = 41; i < 45; i++) { - mpfr_set_si_2exp (y, -1, i, GMP_RNDN); - mpfr_add_si (y, y, 1, GMP_RNDN); - tern = mpfr_pow (z, x, y, GMP_RNDN); + mpfr_set_si_2exp (y, -1, i, MPFR_RNDN); + mpfr_add_si (y, y, 1, MPFR_RNDN); + tern = mpfr_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_zero_p (z) && MPFR_SIGN(z) < 0); } /* on 32-bit machines */ for (i = 9; i < 13; i++) { - mpfr_set_si_2exp (y, -1, i, GMP_RNDN); - mpfr_add_si (y, y, 1, GMP_RNDN); - tern = mpfr_pow (z, x, y, GMP_RNDN); + mpfr_set_si_2exp (y, -1, i, MPFR_RNDN); + mpfr_add_si (y, y, 1, MPFR_RNDN); + tern = mpfr_pow (z, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_zero_p (z) && MPFR_SIGN(z) < 0); } @@ -1209,11 +1209,11 @@ bug20071218 (void) int tern; mpfr_inits2 (64, x, y, z, t, (mpfr_ptr) 0); - mpfr_set_str (x, "0x.80000000000002P-1023", 0, GMP_RNDN); - mpfr_set_str (y, "100000.000000002", 16, GMP_RNDN); - mpfr_set_ui (t, 0, GMP_RNDN); + mpfr_set_str (x, "0x.80000000000002P-1023", 0, MPFR_RNDN); + mpfr_set_str (y, "100000.000000002", 16, MPFR_RNDN); + mpfr_set_ui (t, 0, MPFR_RNDN); mpfr_nextabove (t); - tern = mpfr_pow (z, x, y, GMP_RNDN); + tern = mpfr_pow (z, x, y, MPFR_RNDN); if (mpfr_cmp0 (z, t) != 0) { printf ("Error in bug20071218 (1): Expected\n"); @@ -1228,8 +1228,8 @@ bug20071218 (void) " (%d instead of positive)\n", tern); exit (1); } - mpfr_mul_2ui (y, y, 32, GMP_RNDN); - tern = mpfr_pow (z, x, y, GMP_RNDN); + mpfr_mul_2ui (y, y, 32, MPFR_RNDN); + tern = mpfr_pow (z, x, y, MPFR_RNDN); if (MPFR_NOTZERO (z) || MPFR_IS_NEG (z)) { printf ("Error in bug20071218 (2): expected 0, got\n"); @@ -1264,10 +1264,10 @@ bug20080721 (void) */ mpfr_inits2 (4913, x, y, (mpfr_ptr) 0); mpfr_inits2 (8, z, t[0], t[1], (mpfr_ptr) 0); - mpfr_set_si (x, -1, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); mpfr_nextbelow (x); - mpfr_set_ui_2exp (y, 1, mpfr_get_prec (y) - 1, GMP_RNDN); - inex = mpfr_add_ui (y, y, 1, GMP_RNDN); + mpfr_set_ui_2exp (y, 1, mpfr_get_prec (y) - 1, MPFR_RNDN); + inex = mpfr_add_ui (y, y, 1, MPFR_RNDN); MPFR_ASSERTN (inex == 0); mpfr_set_str_binary (t[0], "-0.10101101e2"); mpfr_set_str_binary (t[1], "-0.10101110e2"); @@ -1275,7 +1275,7 @@ bug20080721 (void) { int i, inex0; - i = (rnd == GMP_RNDN || rnd == GMP_RNDD || rnd == GMP_RNDA); + i = (rnd == MPFR_RNDN || rnd == MPFR_RNDD || rnd == MPFR_RNDA); inex0 = i ? -1 : 1; mpfr_clear_flags (); inex = mpfr_pow (z, x, y, (mp_rnd_t) rnd); @@ -1287,11 +1287,11 @@ bug20080721 (void) printf ("Error in bug20080721 with %s\n", mpfr_print_rnd_mode ((mp_rnd_t) rnd)); printf ("expected "); - mpfr_out_str (stdout, 2, 0, t[i], GMP_RNDN); + mpfr_out_str (stdout, 2, 0, t[i], MPFR_RNDN); printf (", inex = %d, flags = %u\n", inex0, (unsigned int) MPFR_FLAGS_INEXACT); printf ("got "); - mpfr_out_str (stdout, 2, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); printf (", inex = %d, flags = %u\n", inex, flags); err = 1; } @@ -1302,8 +1302,8 @@ bug20080721 (void) } /* The following test fails in r5552 (32-bit and 64-bit). This is due to: - * mpfr_log (t, absx, GMP_RNDU); - * mpfr_mul (t, y, t, GMP_RNDU); + * mpfr_log (t, absx, MPFR_RNDU); + * mpfr_mul (t, y, t, MPFR_RNDU); * in pow.c, that is supposed to compute an upper bound on exp(y*ln|x|), * but this is incorrect if y is negative. */ @@ -1319,12 +1319,12 @@ bug20080820 (void) mpfr_init2 (y, sizeof (mp_exp_t) * CHAR_BIT + 32); mpfr_init2 (z1, 2); mpfr_init2 (z2, 80); - mpfr_set_ui (x, 2, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); mpfr_nextbelow (x); - mpfr_set_exp_t (y, mpfr_get_emin () - 2, GMP_RNDN); + mpfr_set_exp_t (y, mpfr_get_emin () - 2, MPFR_RNDN); mpfr_nextabove (y); - mpfr_pow (z1, x, y, GMP_RNDN); - mpfr_pow (z2, x, y, GMP_RNDN); + mpfr_pow (z1, x, y, MPFR_RNDN); + mpfr_pow (z2, x, y, MPFR_RNDN); /* As x > 0, the rounded value of x^y to nearest in precision p is equal to 0 iff x^y <= 2^(emin - 2). In particular, this does not depend on the precision p. Hence the following test. */ diff --git a/tests/tpow3.c b/tests/tpow3.c index d17919928..230698f81 100644 --- a/tests/tpow3.c +++ b/tests/tpow3.c @@ -64,11 +64,11 @@ main (int argc, char *argv[]) mpfr_urandomb (x, RANDS); mpfr_urandomb (s, RANDS); if (randlimb () % 2) - mpfr_neg (s, s, GMP_RNDN); + mpfr_neg (s, s, MPFR_RNDN); rnd = RND_RAND (); mpfr_set_prec (y, yprec); compare = mpfr_pow (y, x, s, rnd); - err = (rnd == GMP_RNDN) ? yprec + 1 : yprec; + err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec; if (mpfr_can_round (y, err, rnd, rnd, prec)) { mpfr_set (t, y, rnd); @@ -76,16 +76,16 @@ main (int argc, char *argv[]) if (mpfr_cmp (t, z)) { printf ("results differ for x^y with x="); - mpfr_out_str (stdout, 2, prec, x, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN); printf (" y="); - mpfr_out_str (stdout, 2, 0, s, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN); printf (" prec=%u rnd_mode=%s\n", (unsigned int) prec, mpfr_print_rnd_mode (rnd)); printf ("got "); - mpfr_out_str (stdout, 2, prec, z, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); puts (""); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); puts (""); printf ("approx "); mpfr_print_binary (y); @@ -95,7 +95,7 @@ main (int argc, char *argv[]) compare2 = mpfr_cmp (t, y); /* if rounding to nearest, cannot know the sign of t - f(x) because of composed rounding: y = o(f(x)) and t = o(y) */ - if ((rnd != GMP_RNDN) && (compare * compare2 >= 0)) + if ((rnd != MPFR_RNDN) && (compare * compare2 >= 0)) compare = compare + compare2; else compare = inexact; /* cannot determine sign(t-f(x)) */ diff --git a/tests/tpow_all.c b/tests/tpow_all.c index db1ceeb49..cf66e95aa 100644 --- a/tests/tpow_all.c +++ b/tests/tpow_all.c @@ -58,7 +58,7 @@ err (const char *s, int i, int j, int rnd, mpfr_srcptr z, int inex) printf ("x = %s, y = %s, %s\n", val[i], val[j], mpfr_print_rnd_mode ((mp_rnd_t) rnd)); printf ("z = "); - mpfr_out_str (stdout, 10, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN); printf ("\ninex = %d\n", inex); exit (1); } @@ -104,7 +104,7 @@ cmpres (int spx, const void *px, const char *sy, mp_rnd_t rnd, printf ("%s, ", (char *) px); else { - mpfr_out_str (stdout, 16, 0, (mpfr_ptr) px, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, (mpfr_ptr) px, MPFR_RNDN); puts (","); } printf ("y = %s, %s\n", sy, mpfr_print_rnd_mode (rnd)); @@ -115,11 +115,11 @@ cmpres (int spx, const void *px, const char *sy, mp_rnd_t rnd, } else { - mpfr_out_str (stdout, 16, 0, z1, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, z1, MPFR_RNDN); printf (", inex = %d, flags = %u\n", SIGN (inex1), flags1); } printf ("Got "); - mpfr_out_str (stdout, 16, 0, z2, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, z2, MPFR_RNDN); printf (", inex = %d, flags = %u\n", SIGN (inex2), flags2); if (all_cmpres_errors != 0) all_cmpres_errors = -1; @@ -131,8 +131,8 @@ static int is_odd (mpfr_srcptr x) { /* works only with the values from val[] */ - return mpfr_integer_p (x) && mpfr_fits_slong_p (x, GMP_RNDN) && - (mpfr_get_si (x, GMP_RNDN) & 1); + return mpfr_integer_p (x) && mpfr_fits_slong_p (x, MPFR_RNDN) && + (mpfr_get_si (x, MPFR_RNDN) & 1); } /* Compare the result (z1,inex1) of mpfr_pow with all flags cleared @@ -163,9 +163,9 @@ test_others (const void *sx, const char *sy, mp_rnd_t rnd, /* If y is an integer that fits in an unsigned long and is not -0, we can test mpfr_pow_ui. */ if (MPFR_IS_POS (y) && mpfr_integer_p (y) && - mpfr_fits_ulong_p (y, GMP_RNDN)) + mpfr_fits_ulong_p (y, MPFR_RNDN)) { - unsigned long yy = mpfr_get_ui (y, GMP_RNDN); + unsigned long yy = mpfr_get_ui (y, MPFR_RNDN); mpfr_clear_flags (); inex2 = mpfr_pow_ui (z2, x, yy, rnd); @@ -179,9 +179,9 @@ test_others (const void *sx, const char *sy, mp_rnd_t rnd, /* If x is an integer that fits in an unsigned long and is not -0, we can also test mpfr_ui_pow_ui. */ if (MPFR_IS_POS (x) && mpfr_integer_p (x) && - mpfr_fits_ulong_p (x, GMP_RNDN)) + mpfr_fits_ulong_p (x, MPFR_RNDN)) { - unsigned long xx = mpfr_get_ui (x, GMP_RNDN); + unsigned long xx = mpfr_get_ui (x, MPFR_RNDN); mpfr_clear_flags (); inex2 = mpfr_ui_pow_ui (z2, xx, yy, rnd); @@ -202,9 +202,9 @@ test_others (const void *sx, const char *sy, mp_rnd_t rnd, mpz_t yyy; /* If y fits in a long, we can test mpfr_pow_si. */ - if (mpfr_fits_slong_p (y, GMP_RNDN)) + if (mpfr_fits_slong_p (y, MPFR_RNDN)) { - long yy = mpfr_get_si (y, GMP_RNDN); + long yy = mpfr_get_si (y, MPFR_RNDN); mpfr_clear_flags (); inex2 = mpfr_pow_si (z2, x, yy, rnd); @@ -244,7 +244,7 @@ test_others (const void *sx, const char *sy, mp_rnd_t rnd, /* Test mpfr_pow_z. */ mpz_init (yyy); - mpfr_get_z (yyy, y, GMP_RNDN); + mpfr_get_z (yyy, y, MPFR_RNDN); mpfr_clear_flags (); inex2 = mpfr_pow_z (z2, x, yyy, rnd); cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, flags, @@ -291,9 +291,9 @@ test_others (const void *sx, const char *sy, mp_rnd_t rnd, /* If x is an integer that fits in an unsigned long and is not -0, we can test mpfr_ui_pow. */ if (MPFR_IS_POS (x) && mpfr_integer_p (x) && - mpfr_fits_ulong_p (x, GMP_RNDN)) + mpfr_fits_ulong_p (x, MPFR_RNDN)) { - unsigned long xx = mpfr_get_ui (x, GMP_RNDN); + unsigned long xx = mpfr_get_ui (x, MPFR_RNDN); mpfr_clear_flags (); inex2 = mpfr_ui_pow (z2, xx, y, rnd); @@ -356,7 +356,7 @@ my_setstr (mpfr_ptr t, const char *s) MPFR_SET_POS (t); return 0; } - return mpfr_set_str (t, s, 10, GMP_RNDN); + return mpfr_set_str (t, s, 10, MPFR_RNDN); } static void @@ -401,7 +401,7 @@ tst (void) if (mpfr_overflow_p ()) err ("got overflow", i, j, rnd, z, inex); exact = MPFR_IS_SINGULAR (z) || - (mpfr_mul_2ui (tmp, z, 16, GMP_RNDN), mpfr_integer_p (tmp)); + (mpfr_mul_2ui (tmp, z, 16, MPFR_RNDN), mpfr_integer_p (tmp)); if (exact && inex != 0) err ("got exact value with ternary flag different from 0", i, j, rnd, z, inex); @@ -478,19 +478,19 @@ underflow_up1 (void) return; mpfr_init2 (delta, 2); - inex = mpfr_set_ui_2exp (delta, 1, -2, GMP_RNDN); + inex = mpfr_set_ui_2exp (delta, 1, -2, MPFR_RNDN); MPFR_ASSERTN (inex == 0); mpfr_init2 (x, 8); - inex = mpfr_set_ui (x, 2, GMP_RNDN); + inex = mpfr_set_ui (x, 2, MPFR_RNDN); MPFR_ASSERTN (inex == 0); mpfr_init2 (y, sizeof (long) * CHAR_BIT + 4); - inex = mpfr_set_si (y, n, GMP_RNDN); + inex = mpfr_set_si (y, n, MPFR_RNDN); MPFR_ASSERTN (inex == 0); mpfr_init2 (z0, 2); - mpfr_set_ui (z0, 0, GMP_RNDN); + mpfr_set_ui (z0, 0, MPFR_RNDN); mpfr_init2 (z, 32); @@ -501,7 +501,7 @@ underflow_up1 (void) /* Test 2^(emin - i/4). * --> Underflow iff i > 4. - * --> Zero in GMP_RNDN iff i >= 8. + * --> Zero in MPFR_RNDN iff i >= 8. */ if (i != 0 && i != 4) @@ -515,8 +515,8 @@ underflow_up1 (void) { int zero; - zero = (i > 4 && (rnd == GMP_RNDZ || rnd == GMP_RNDD)) || - (i >= 8 && rnd == GMP_RNDN); + zero = (i > 4 && (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)) || + (i >= 8 && rnd == MPFR_RNDN); mpfr_clear_flags (); inex = mpfr_pow (z, x, y, (mp_rnd_t) rnd); @@ -526,7 +526,7 @@ underflow_up1 (void) "underflow_up1"); } - inex = mpfr_sub (y, y, delta, GMP_RNDN); + inex = mpfr_sub (y, y, delta, MPFR_RNDN); MPFR_ASSERTN (inex == 0); } @@ -537,7 +537,7 @@ underflow_up1 (void) * due to a double-rounding problem when rescaling the result: * Error with underflow_up2 and extended exponent range * x = 7.fffffffffffffff0@-1, - * y = 4611686018427387904, GMP_RNDN + * y = 4611686018427387904, MPFR_RNDN * Expected 1.0000000000000000@-1152921504606846976, inex = 1, flags = 9 * Got 0, inex = -1, flags = 9 * With pow_ui.c r5423, the following test fails on a 64-bit Linux machine @@ -545,7 +545,7 @@ underflow_up1 (void) * error is ignored): * Error with mpfr_pow_ui, flags cleared * x = 7.fffffffffffffff0@-1, - * y = 4611686018427387904, GMP_RNDN + * y = 4611686018427387904, MPFR_RNDN * Expected 1.0000000000000000@-1152921504606846976, inex = 1, flags = 9 * Got 0, inex = -1, flags = 9 */ @@ -563,17 +563,17 @@ underflow_up2 (void) return; mpfr_init2 (eps, 2); - mpfr_set_ui_2exp (eps, 1, -1, GMP_RNDN); /* 1/2 */ - mpfr_div_ui (eps, eps, n, GMP_RNDZ); /* 1/(2n) rounded toward zero */ + mpfr_set_ui_2exp (eps, 1, -1, MPFR_RNDN); /* 1/2 */ + mpfr_div_ui (eps, eps, n, MPFR_RNDZ); /* 1/(2n) rounded toward zero */ mpfr_init2 (x, sizeof (unsigned long) * CHAR_BIT + 1); - inex = mpfr_ui_sub (x, 1, eps, GMP_RNDN); + inex = mpfr_ui_sub (x, 1, eps, MPFR_RNDN); MPFR_ASSERTN (inex == 0); /* since n < 2^(size_of_long_in_bits) */ - inex = mpfr_div_2ui (x, x, 1, GMP_RNDN); /* 1/2 - eps/2 exactly */ + inex = mpfr_div_2ui (x, x, 1, MPFR_RNDN); /* 1/2 - eps/2 exactly */ MPFR_ASSERTN (inex == 0); mpfr_init2 (y, sizeof (unsigned long) * CHAR_BIT); - inex = mpfr_set_ui (y, n, GMP_RNDN); + inex = mpfr_set_ui (y, n, MPFR_RNDN); MPFR_ASSERTN (inex == 0); /* 0 < eps < 1 / (2n), thus (1 - eps)^n > 1/2, @@ -585,8 +585,8 @@ underflow_up2 (void) int expected_inex; char sy[256]; - mpfr_set_ui (z0, 0, GMP_RNDN); - expected_inex = rnd == GMP_RNDN || rnd == GMP_RNDU || rnd == GMP_RNDA ? + mpfr_set_ui (z0, 0, MPFR_RNDN); + expected_inex = rnd == MPFR_RNDN || rnd == MPFR_RNDU || rnd == MPFR_RNDA ? (mpfr_nextabove (z0), 1) : -1; sprintf (sy, "%lu", (unsigned long) n); @@ -614,7 +614,7 @@ underflow_up3 (void) mpfr_init2 (z, 32); mpfr_init2 (z0, 2); - inex = mpfr_set_exp_t (y, mpfr_get_emin () - 2, GMP_RNDN); + inex = mpfr_set_exp_t (y, mpfr_get_emin () - 2, MPFR_RNDN); MPFR_ASSERTN (inex == 0); for (i = -1; i <= 1; i++) RND_LOOP (rnd) @@ -622,17 +622,17 @@ underflow_up3 (void) unsigned int ufinex = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT; int expected_inex; - mpfr_set_ui (x, 2, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); if (i < 0) mpfr_nextbelow (x); if (i > 0) mpfr_nextabove (x); /* x = 2 + i * eps, y = emin - 2, x^y ~= 2^(emin - 2) */ - expected_inex = rnd == GMP_RNDU || rnd == GMP_RNDA - || (rnd == GMP_RNDN && i < 0) ? 1 : -1; + expected_inex = rnd == MPFR_RNDU || rnd == MPFR_RNDA + || (rnd == MPFR_RNDN && i < 0) ? 1 : -1; - mpfr_set_ui (z0, 0, GMP_RNDN); + mpfr_set_ui (z0, 0, MPFR_RNDN); if (expected_inex > 0) mpfr_nextabove (z0); @@ -667,7 +667,7 @@ overflow_inv (void) mpfr_init2 (y, 2); mpfr_init2 (z, 8); - mpfr_set_si (y, -1, GMP_RNDN); + mpfr_set_si (y, -1, MPFR_RNDN); for (precx = 10; precx <= 100; precx += 90) { const char *sp = precx == 10 ? @@ -676,7 +676,7 @@ overflow_inv (void) mpfr_init2 (x, precx); for (s = -1; s <= 1; s += 2) { - inex = mpfr_set_si_2exp (x, s, - mpfr_get_emax (), GMP_RNDN); + inex = mpfr_set_si_2exp (x, s, - mpfr_get_emax (), MPFR_RNDN); MPFR_ASSERTN (inex == 0); for (t = 0; t <= 5; t++) { @@ -685,31 +685,31 @@ overflow_inv (void) * 1/x = s * 2^emax * (1 - t * 2^(-9) + eps) with eps > 0. * Values of (1/x) / 2^emax and overflow condition for x > 0: * t = 0: 1 o: always - * t = 1: 0.11111111 100000000011... o: GMP_RNDN and GMP_RNDU - * t = 2: 0.11111111 000000001111... o: GMP_RNDU + * t = 1: 0.11111111 100000000011... o: MPFR_RNDN and MPFR_RNDU + * t = 2: 0.11111111 000000001111... o: MPFR_RNDU * t = 3: 0.11111110 100000100011... o: never * * If precx = 100: * t = 0: always overflow - * t > 0: overflow for GMP_RNDN and GMP_RNDU. + * t > 0: overflow for MPFR_RNDN and MPFR_RNDU. */ RND_LOOP (rnd) { int inf, overflow; mp_rnd_t rnd2; - if (rnd == GMP_RNDA) - rnd2 = s < 0 ? GMP_RNDD : GMP_RNDU; + if (rnd == MPFR_RNDA) + rnd2 = s < 0 ? MPFR_RNDD : MPFR_RNDU; else rnd2 = rnd; overflow = t == 0 || - ((mp_rnd_t) rnd == GMP_RNDN && (precx > 10 || t == 1)) || - ((mp_rnd_t) rnd2 == (s < 0 ? GMP_RNDD : GMP_RNDU) && + ((mp_rnd_t) rnd == MPFR_RNDN && (precx > 10 || t == 1)) || + ((mp_rnd_t) rnd2 == (s < 0 ? MPFR_RNDD : MPFR_RNDU) && (precx > 10 || t <= 2)); inf = overflow && - ((mp_rnd_t) rnd == GMP_RNDN || - (mp_rnd_t) rnd2 == (s < 0 ? GMP_RNDD : GMP_RNDU)); + ((mp_rnd_t) rnd == MPFR_RNDN || + (mp_rnd_t) rnd2 == (s < 0 ? MPFR_RNDD : MPFR_RNDU)); mpfr_clear_flags (); inex = mpfr_pow (z, x, y, (mp_rnd_t) rnd); if (overflow ^ !! mpfr_overflow_p ()) @@ -726,7 +726,7 @@ overflow_inv (void) "s = %d, t = %d, %s\nGot ", sp, ext ? ", extended exponent range" : "", s, t, mpfr_print_rnd_mode ((mp_rnd_t) rnd)); - mpfr_out_str (stdout, 16, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN); printf (" instead of %s value.\n", inf ? "infinite" : "finite"); exit (1); diff --git a/tests/tpow_z.c b/tests/tpow_z.c index a90b23f58..c9d866809 100644 --- a/tests/tpow_z.c +++ b/tests/tpow_z.c @@ -40,95 +40,95 @@ check_special (void) mpz_init (z); /* x^0 = 1 except for NAN */ - mpfr_set_ui (x, 23, GMP_RNDN); + mpfr_set_ui (x, 23, MPFR_RNDN); mpz_set_ui (z, 0); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (y, 1) != 0) ERROR ("23^0"); mpfr_set_nan (x); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_nan_p (y) || mpfr_cmp_si (y, 1) != 0) ERROR ("NAN^0"); mpfr_set_inf (x, 1); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (y, 1) != 0) ERROR ("INF^0"); /* sINF^N = INF if s==1 or n even if N > 0*/ mpz_set_ui (z, 42); mpfr_set_inf (x, 1); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0) ERROR ("INF^42"); mpfr_set_inf (x, -1); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0) ERROR ("-INF^42"); mpz_set_ui (z, 17); mpfr_set_inf (x, 1); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0) ERROR ("INF^17"); mpfr_set_inf (x, -1); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) >= 0) ERROR ("-INF^17"); mpz_set_si (z, -42); mpfr_set_inf (x, 1); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) ERROR ("INF^-42"); mpfr_set_inf (x, -1); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) ERROR ("-INF^-42"); mpz_set_si (z, -17); mpfr_set_inf (x, 1); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) ERROR ("INF^-17"); mpfr_set_inf (x, -1); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) >= 0) ERROR ("-INF^-17"); /* s0^N = +0 if s==+ or n even if N > 0*/ mpz_set_ui (z, 42); MPFR_SET_ZERO (x); MPFR_SET_POS (x); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) ERROR ("+0^42"); MPFR_SET_NEG (x); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) ERROR ("-0^42"); mpz_set_ui (z, 17); MPFR_SET_POS (x); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) ERROR ("+0^17"); MPFR_SET_NEG (x); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) >= 0) ERROR ("-0^17"); mpz_set_si (z, -42); MPFR_SET_ZERO (x); MPFR_SET_POS (x); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0) ERROR ("+0^-42"); MPFR_SET_NEG (x); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0) ERROR ("-0^-42"); mpz_set_si (z, -17); MPFR_SET_POS (x); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0) ERROR ("+0^-17"); MPFR_SET_NEG (x); - res = mpfr_pow_z (y, x, z, GMP_RNDN); + res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) >= 0) ERROR ("-0^-17"); @@ -160,7 +160,7 @@ check_integer (mp_prec_t begin, mp_prec_t end, unsigned long max) if ((i & 1) != 0) mpz_neg (z, z); mpfr_urandomb (x, RANDS); - mpfr_mul_2ui (x, x, 1, GMP_RNDN); /* 0 <= x < 2 */ + mpfr_mul_2ui (x, x, 1, MPFR_RNDN); /* 0 <= x < 2 */ rnd = RND_RAND (); if (mpz_fits_slong_p (z)) { @@ -206,8 +206,8 @@ check_regression (void) mpfr_init2 (y, 122); mpfr_set_str_binary (x, "0.10000010010000111101001110100101101010011110011100001111000001001101000110011001001001001011001011010110110110101000111011E1"); - res1 = mpfr_pow_z (y, x, z, GMP_RNDU); - res2 = mpfr_pow_ui (x, x, 2026876995UL, GMP_RNDU); + res1 = mpfr_pow_z (y, x, z, MPFR_RNDU); + res2 = mpfr_pow_ui (x, x, 2026876995UL, MPFR_RNDU); if (mpfr_cmp (x, y) || res1 != res2) { printf ("Regression (1) tested failed (%d=?%d)\n",res1, res2); @@ -232,10 +232,10 @@ bug20071104 (void) mpz_init_set_si (z, -2); mpfr_inits2 (20, x, y, (mpfr_ptr) 0); - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_nextbelow (x); /* x = -2^(emin-1) */ mpfr_clear_flags (); - inex = mpfr_pow_z (y, x, z, GMP_RNDN); + inex = mpfr_pow_z (y, x, z, MPFR_RNDN); if (! mpfr_inf_p (y) || MPFR_SIGN (y) < 0) { printf ("Error in bug20071104: expected +Inf, got "); @@ -268,7 +268,7 @@ check_overflow (void) mpfr_set_str_binary (a, "1E10"); mpz_init_set_ui (z, ULONG_MAX); - res = mpfr_pow_z (a, a, z, GMP_RNDN); + res = mpfr_pow_z (a, a, z, MPFR_RNDN); if (!MPFR_IS_INF (a) || MPFR_SIGN (a) < 0) { printf ("Error for (1e10)^ULONG_MAX\n"); @@ -283,7 +283,7 @@ check_overflow (void) mpfr_set_str_binary (a, "-1.1E10"); n = (ULONG_MAX ^ (ULONG_MAX >> 1)) + 1; mpz_set_ui (z, n); - res = mpfr_pow_z (a, a, z, GMP_RNDN); + res = mpfr_pow_z (a, a, z, MPFR_RNDN); if (!MPFR_IS_INF (a) || MPFR_SIGN (a) > 0) { printf ("Error for (-1e10)^%lu, expected -Inf,\ngot ", n); @@ -305,11 +305,11 @@ bug20080223 (void) mpfr_init2 (exp, 53); mpfr_init2 (answer, 53); - mpfr_set_si (exp, -1073741824, GMP_RNDN); + mpfr_set_si (exp, -1073741824, MPFR_RNDN); - mpfr_set_str (a, "1.999999999", 10, GMP_RNDN); + mpfr_set_str (a, "1.999999999", 10, MPFR_RNDN); /* a = 562949953139837/2^48 */ - mpfr_pow (answer, a, exp, GMP_RNDN); + mpfr_pow (answer, a, exp, MPFR_RNDN); mpfr_set_str_binary (a, "0.110110101111011001110000111111100011101000111011101E-1073741823"); MPFR_ASSERTN(mpfr_cmp0 (answer, a) == 0); @@ -335,10 +335,10 @@ bug20080904 (void) mpz_set_str (exp, "-4eb92f8c7b7bf81e", 16); mpfr_set_str_binary (a, "1.110000101110100110100011111000011110111101000011111001111001010011100"); - mpfr_pow_z (answer, a, exp, GMP_RNDN); + mpfr_pow_z (answer, a, exp, MPFR_RNDN); /* The correct result is near 2^(-2^62), so it underflows when MPFR_EMIN_MIN > -2^62 (i.e. with 32 and 64 bits machines). */ - mpfr_set_str (a, "AA500C0D7A69275DBp-4632850503556296886", 16, GMP_RNDN); + mpfr_set_str (a, "AA500C0D7A69275DBp-4632850503556296886", 16, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp0 (answer, a) == 0); mpfr_set_emin (emin_default); diff --git a/tests/tprintf.c b/tests/tprintf.c index 71cae718c..2a001f45a 100644 --- a/tests/tprintf.c +++ b/tests/tprintf.c @@ -164,7 +164,7 @@ check_mixed (void) mpz_t mpz; mpq_t mpq; mpf_t mpf; - mp_rnd_t rnd = GMP_RNDN; + mp_rnd_t rnd = MPFR_RNDN; mpfr_t mpfr; mpfr_prec_t prec; @@ -176,7 +176,7 @@ check_mixed (void) mpf_init (mpf); mpf_set_q (mpf, mpq); mpfr_init (mpfr); - mpfr_set_f (mpfr, mpf, GMP_RNDN); + mpfr_set_f (mpfr, mpf, MPFR_RNDN); prec = mpfr_get_prec (mpfr); check_vprintf ("a. %Ra, b. %u, c. %lx%n", mpfr, ui, ulo, &j); diff --git a/tests/trandom.c b/tests/trandom.c index 08abb96dc..14dafc31e 100644 --- a/tests/trandom.c +++ b/tests/trandom.c @@ -136,7 +136,7 @@ test_random2 (long nbtests, mp_prec_t prec, int verbose) /* test size=0 */ mpfr_random2 (x, 0, 0); MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x)); - mpfr_set_si (x, -1, GMP_RNDN); /* x is negative */ + mpfr_set_si (x, -1, MPFR_RNDN); /* x is negative */ mpfr_random2 (x, 0, 0); MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x)); diff --git a/tests/trec_sqrt.c b/tests/trec_sqrt.c index 3b33b2a4e..e1776cfe2 100644 --- a/tests/trec_sqrt.c +++ b/tests/trec_sqrt.c @@ -42,44 +42,44 @@ special (void) /* rec_sqrt(NaN) = NaN */ mpfr_set_nan (x); - inex = mpfr_rec_sqrt (x, x, GMP_RNDN); + inex = mpfr_rec_sqrt (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (x) && inex == 0); /* rec_sqrt(+Inf) = +0 */ mpfr_set_inf (x, 1); - inex = mpfr_rec_sqrt (x, x, GMP_RNDN); + inex = mpfr_rec_sqrt (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_zero_p (x) && MPFR_IS_POS(x) && inex == 0); /* rec_sqrt(-Inf) = NaN */ mpfr_set_inf (x, -1); - inex = mpfr_rec_sqrt (x, x, GMP_RNDN); + inex = mpfr_rec_sqrt (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (x) && inex == 0); /* rec_sqrt(+0) = +Inf */ - mpfr_set_ui (x, 0, GMP_RNDN); - inex = mpfr_rec_sqrt (x, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + inex = mpfr_rec_sqrt (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && MPFR_IS_POS(x) && inex == 0); /* rec_sqrt(-0) = +Inf */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - inex = mpfr_rec_sqrt (x, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + inex = mpfr_rec_sqrt (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && MPFR_IS_POS(x) && inex == 0); /* rec_sqrt(-1) = NaN */ - mpfr_set_si (x, -1, GMP_RNDN); - inex = mpfr_rec_sqrt (x, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + inex = mpfr_rec_sqrt (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (x) && inex == 0); /* rec_sqrt(1) = 1 */ - mpfr_set_ui (x, 1, GMP_RNDN); - inex = mpfr_rec_sqrt (x, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + inex = mpfr_rec_sqrt (x, x, MPFR_RNDN); MPFR_ASSERTN((mpfr_cmp_ui (x, 1) == 0) && (inex == 0)); mpfr_set_prec (x, 23); mpfr_set_prec (y, 33); mpfr_set_str_binary (x, "1.0001110110101001010100e-1"); - inex = mpfr_rec_sqrt (y, x, GMP_RNDU); + inex = mpfr_rec_sqrt (y, x, MPFR_RNDU); mpfr_set_prec (x, 33); mpfr_set_str_binary (x, "1.01010110101110100100100101011"); MPFR_ASSERTN (inex > 0 && mpfr_cmp (x, y) == 0); @@ -96,17 +96,17 @@ bad_case1 (void) mpfr_init2 (x, 72); mpfr_inits2 (6, y, z, (mpfr_ptr) 0); - mpfr_set_str (x, "1.08310518720928b30e@-120", 16, GMP_RNDN); - mpfr_set_str (z, "f.8@59", 16, GMP_RNDN); + mpfr_set_str (x, "1.08310518720928b30e@-120", 16, MPFR_RNDN); + mpfr_set_str (z, "f.8@59", 16, MPFR_RNDN); /* z = rec_sqrt(x) rounded on 6 bits toward 0, the exact value being ~= f.bffffffffffffffffa11@59. */ - mpfr_rec_sqrt (y, x, GMP_RNDZ); + mpfr_rec_sqrt (y, x, MPFR_RNDZ); if (mpfr_cmp0 (y, z) != 0) { printf ("Error in bad_case1\nexpected "); - mpfr_out_str (stdout, 16, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN); printf ("\ngot "); - mpfr_out_str (stdout, 16, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN); printf ("\n"); exit (1); } diff --git a/tests/tremquo.c b/tests/tremquo.c index 0f2358a7b..de7d0900c 100644 --- a/tests/tremquo.c +++ b/tests/tremquo.c @@ -35,11 +35,11 @@ bug20090227 (void) mpfr_init2 (y, 181); mpfr_init2 (r1, 140); mpfr_init2 (r2, 140); - mpfr_set_si (x, -1, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); mpfr_set_str_binary (y, "1.100100100001111110110101010001000100001011010001100001000110100110001001100011001100010100010111000000011011100000111001101000100101001000000100100111000001000100010100110011111010"); - inex1 = mpfr_remainder (r1, x, y, GMP_RNDU); + inex1 = mpfr_remainder (r1, x, y, MPFR_RNDU); /* since the quotient is -1, r1 is the rounding of x+y */ - inex2 = mpfr_add (r2, x, y, GMP_RNDU); + inex2 = mpfr_add (r2, x, y, MPFR_RNDU); if (mpfr_cmp (r1, r2)) { printf ("Error in mpfr_remainder (bug20090227)\n"); @@ -61,16 +61,16 @@ main (int argc, char *argv[]) mpfr_t x, y, r; long q[1]; - if (argc == 3) /* usage: tremquo x y (rnd=GMP_RNDN implicit) */ + if (argc == 3) /* usage: tremquo x y (rnd=MPFR_RNDN implicit) */ { mpfr_init2 (x, BITS_PER_MP_LIMB); mpfr_init2 (y, BITS_PER_MP_LIMB); mpfr_init2 (r, BITS_PER_MP_LIMB); - mpfr_set_str (x, argv[1], 10, GMP_RNDN); - mpfr_set_str (y, argv[2], 10, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_str (x, argv[1], 10, MPFR_RNDN); + mpfr_set_str (y, argv[2], 10, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); printf ("r="); - mpfr_out_str (stdout, 10, 0, r, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, r, MPFR_RNDN); printf (" q=%ld\n", q[0]); mpfr_clear (x); mpfr_clear (y); @@ -88,64 +88,64 @@ main (int argc, char *argv[]) /* special values */ mpfr_set_nan (x); - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (r)); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_set_nan (y); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (r)); mpfr_set_inf (x, 1); /* +Inf */ - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (r)); mpfr_set_inf (x, 1); /* +Inf */ - mpfr_set_ui (y, 0, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (r)); mpfr_set_inf (x, 1); /* +Inf */ mpfr_set_inf (y, 1); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (r)); - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_set_inf (y, 1); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_POS (r)); MPFR_ASSERTN (q[0] == (long) 0); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); /* -0 */ + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); /* -0 */ mpfr_set_inf (y, 1); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_NEG (r)); MPFR_ASSERTN (q[0] == (long) 0); - mpfr_set_ui (x, 17, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); mpfr_set_inf (y, 1); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp (r, x) == 0); MPFR_ASSERTN (q[0] == (long) 0); - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_set_ui (y, 0, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_set_ui (y, 0, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (r)); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_set_ui (y, 17, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_set_ui (y, 17, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_POS (r)); MPFR_ASSERTN (q[0] == (long) 0); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - mpfr_set_ui (y, 17, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_set_ui (y, 17, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_NEG (r)); MPFR_ASSERTN (q[0] == (long) 0); @@ -153,81 +153,81 @@ main (int argc, char *argv[]) mpfr_set_prec (y, 53); /* check four possible sign combinations */ - mpfr_set_ui (x, 42, GMP_RNDN); - mpfr_set_ui (y, 17, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_ui (x, 42, MPFR_RNDN); + mpfr_set_ui (y, 17, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (r, 8) == 0); MPFR_ASSERTN (q[0] == (long) 2); - mpfr_set_si (x, -42, GMP_RNDN); - mpfr_set_ui (y, 17, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_si (x, -42, MPFR_RNDN); + mpfr_set_ui (y, 17, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_si (r, -8) == 0); MPFR_ASSERTN (q[0] == (long) -2); - mpfr_set_si (x, -42, GMP_RNDN); - mpfr_set_si (y, -17, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_si (x, -42, MPFR_RNDN); + mpfr_set_si (y, -17, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_si (r, -8) == 0); MPFR_ASSERTN (q[0] == (long) 2); - mpfr_set_ui (x, 42, GMP_RNDN); - mpfr_set_si (y, -17, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_ui (x, 42, MPFR_RNDN); + mpfr_set_si (y, -17, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (r, 8) == 0); MPFR_ASSERTN (q[0] == (long) -2); mpfr_set_prec (x, 100); mpfr_set_prec (y, 50); - mpfr_set_ui (x, 42, GMP_RNDN); + mpfr_set_ui (x, 42, MPFR_RNDN); mpfr_nextabove (x); /* 42 + 2^(-94) */ - mpfr_set_ui (y, 21, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_ui (y, 21, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -94) == 0); MPFR_ASSERTN (q[0] == (long) 2); mpfr_set_prec (x, 50); mpfr_set_prec (y, 100); - mpfr_set_ui (x, 42, GMP_RNDN); + mpfr_set_ui (x, 42, MPFR_RNDN); mpfr_nextabove (x); /* 42 + 2^(-44) */ - mpfr_set_ui (y, 21, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_ui (y, 21, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -44) == 0); MPFR_ASSERTN (q[0] == (long) 2); mpfr_set_prec (x, 100); mpfr_set_prec (y, 50); - mpfr_set_ui (x, 42, GMP_RNDN); - mpfr_set_ui (y, 21, GMP_RNDN); + mpfr_set_ui (x, 42, MPFR_RNDN); + mpfr_set_ui (y, 21, MPFR_RNDN); mpfr_nextabove (y); /* 21 + 2^(-45) */ - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); /* r should be 42 - 2*(21 + 2^(-45)) = -2^(-44) */ MPFR_ASSERTN (mpfr_cmp_si_2exp (r, -1, -44) == 0); MPFR_ASSERTN (q[0] == (long) 2); mpfr_set_prec (x, 50); mpfr_set_prec (y, 100); - mpfr_set_ui (x, 42, GMP_RNDN); - mpfr_set_ui (y, 21, GMP_RNDN); + mpfr_set_ui (x, 42, MPFR_RNDN); + mpfr_set_ui (y, 21, MPFR_RNDN); mpfr_nextabove (y); /* 21 + 2^(-95) */ - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); /* r should be 42 - 2*(21 + 2^(-95)) = -2^(-94) */ MPFR_ASSERTN (mpfr_cmp_si_2exp (r, -1, -94) == 0); MPFR_ASSERTN (q[0] == (long) 2); /* exercise large quotient */ - mpfr_set_ui_2exp (x, 1, 65, GMP_RNDN); - mpfr_set_ui (y, 1, GMP_RNDN); + mpfr_set_ui_2exp (x, 1, 65, MPFR_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); /* quotient is 2^65 */ - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_si (r, 0) == 0); MPFR_ASSERTN (q[0] % 1073741824L == 0L); /* another large quotient */ mpfr_set_prec (x, 65); mpfr_set_prec (y, 65); - mpfr_const_pi (x, GMP_RNDN); - mpfr_mul_2exp (x, x, 63, GMP_RNDN); - mpfr_const_log2 (y, GMP_RNDN); + mpfr_const_pi (x, MPFR_RNDN); + mpfr_mul_2exp (x, x, 63, MPFR_RNDN); + mpfr_const_log2 (y, MPFR_RNDN); mpfr_set_prec (r, 10); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); /* q should be 41803643793084085130, r should be 605/2048 */ MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 605, -11) == 0); MPFR_ASSERTN ((q[0] > 0) && ((q[0] % 1073741824L) == 733836170L)); @@ -236,49 +236,49 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 65); mpfr_set_prec (y, 65); mpfr_set_prec (r, 63); - mpfr_set_ui (x, 3, GMP_RNDN); - mpfr_set_ui (y, 2, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_ui (x, 3, MPFR_RNDN); + mpfr_set_ui (y, 2, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); /* x/y = 1.5, quotient should be 2 (even rule), remainder should be -1 */ MPFR_ASSERTN (mpfr_cmp_si (r, -1) == 0); MPFR_ASSERTN (q[0] == 2L); - mpfr_set_ui (x, 3, GMP_RNDN); + mpfr_set_ui (x, 3, MPFR_RNDN); mpfr_nextabove (x); /* 3 + 2^(-63) */ - mpfr_set_ui (y, 2, GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_ui (y, 2, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); /* x/y = 1.5 + 2^(-64), quo should be 2, r should be -1 + 2^(-63) */ - MPFR_ASSERTN (mpfr_add_ui (r, r, 1, GMP_RNDN) == 0); + MPFR_ASSERTN (mpfr_add_ui (r, r, 1, MPFR_RNDN) == 0); MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -63) == 0); MPFR_ASSERTN (q[0] == 2L); - mpfr_set_ui (x, 3, GMP_RNDN); - mpfr_set_ui (y, 2, GMP_RNDN); + mpfr_set_ui (x, 3, MPFR_RNDN); + mpfr_set_ui (y, 2, MPFR_RNDN); mpfr_nextabove (y); /* 2 + 2^(-63) */ - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); /* x/y = 1.5 - eps, quo should be 1, r should be 1 - 2^(-63) */ - MPFR_ASSERTN (mpfr_sub_ui (r, r, 1, GMP_RNDN) == 0); + MPFR_ASSERTN (mpfr_sub_ui (r, r, 1, MPFR_RNDN) == 0); MPFR_ASSERTN (mpfr_cmp_si_2exp (r, -1, -63) == 0); MPFR_ASSERTN (q[0] == 1L); /* bug founds by Kaveh Ghazi, 3 May 2007 */ - mpfr_set_ui (x, 2, GMP_RNDN); - mpfr_set_ui (y, 3, GMP_RNDN); - mpfr_remainder (r, x, y, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); + mpfr_set_ui (y, 3, MPFR_RNDN); + mpfr_remainder (r, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_si (r, -1) == 0); - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_remainder (r, x, y, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_remainder (r, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_si (r, 0) == 0 && MPFR_SIGN (r) < 0); /* check argument reuse */ - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_remainder (x, x, y, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_remainder (x, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_si (x, 0) == 0 && MPFR_SIGN (x) < 0); - mpfr_set_ui_2exp (x, 1, mpfr_get_emax () - 1, GMP_RNDN); - mpfr_set_ui_2exp (y, 1, mpfr_get_emin (), GMP_RNDN); - mpfr_remquo (r, q, x, y, GMP_RNDN); + mpfr_set_ui_2exp (x, 1, mpfr_get_emax () - 1, MPFR_RNDN); + mpfr_set_ui_2exp (y, 1, mpfr_get_emin (), MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_zero_p (r) && MPFR_SIGN (r) > 0); MPFR_ASSERTN (q[0] == 0); diff --git a/tests/trint.c b/tests/trint.c index 0a76a6d0d..3b6be4516 100644 --- a/tests/trint.c +++ b/tests/trint.c @@ -40,31 +40,31 @@ special (void) mpfr_init (y); mpfr_set_nan (x); - mpfr_rint (y, x, GMP_RNDN); + mpfr_rint (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); mpfr_set_inf (x, 1); - mpfr_rint (y, x, GMP_RNDN); + mpfr_rint (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) > 0); mpfr_set_inf (x, -1); - mpfr_rint (y, x, GMP_RNDN); + mpfr_rint (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) < 0); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_rint (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_rint (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS(y)); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - mpfr_rint (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_rint (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG(y)); /* coverage test */ mpfr_set_prec (x, 2); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_mul_2exp (x, x, mp_bits_per_limb, GMP_RNDN); - mpfr_rint (y, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_mul_2exp (x, x, mp_bits_per_limb, MPFR_RNDN); + mpfr_rint (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp (y, x) == 0); /* another coverage test */ @@ -73,7 +73,7 @@ special (void) mpfr_set_prec (x, 3); mpfr_set_str_binary (x, "1.11E0"); mpfr_set_prec (y, 2); - mpfr_rint (y, x, GMP_RNDU); /* x rounds to 1.0E1=0.1E2 which overflows */ + mpfr_rint (y, x, MPFR_RNDU); /* x rounds to 1.0E1=0.1E2 which overflows */ MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) > 0); set_emax (emax); @@ -81,35 +81,35 @@ special (void) mpfr_set_prec (x, 97); mpfr_set_prec (y, 96); mpfr_set_str_binary (x, "-0.1011111001101111000111011100011100000110110110110000000111010001000101001111101010101011010111100E97"); - mpfr_rint (y, x, GMP_RNDN); + mpfr_rint (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp (y, x) == 0); mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); mpfr_set_str_binary (x, "0.10101100000000101001010101111111000000011111010000010E-1"); - mpfr_rint (y, x, GMP_RNDU); + mpfr_rint (y, x, MPFR_RNDU); MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); - mpfr_rint (y, x, GMP_RNDD); + mpfr_rint (y, x, MPFR_RNDD); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS(y)); mpfr_set_prec (x, 36); mpfr_set_prec (y, 2); mpfr_set_str_binary (x, "-11000110101010111111110111001.0000100"); - mpfr_rint (y, x, GMP_RNDN); + mpfr_rint (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "-11E27"); MPFR_ASSERTN(mpfr_cmp (y, x) == 0); mpfr_set_prec (x, 39); mpfr_set_prec (y, 29); mpfr_set_str_binary (x, "-0.100010110100011010001111001001001100111E39"); - mpfr_rint (y, x, GMP_RNDN); + mpfr_rint (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "-0.10001011010001101000111100101E39"); MPFR_ASSERTN(mpfr_cmp (y, x) == 0); mpfr_set_prec (x, 46); mpfr_set_prec (y, 32); mpfr_set_str_binary (x, "-0.1011100110100101000001011111101011001001101001E32"); - mpfr_rint (y, x, GMP_RNDN); + mpfr_rint (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "-0.10111001101001010000010111111011E32"); MPFR_ASSERTN(mpfr_cmp (y, x) == 0); @@ -142,7 +142,7 @@ special (void) "000000000000000000000E32"); mpfr_round (x, x); if (mpfr_cmp_str (x, "0.1100110100100010000001111011010100000000000000" \ - "00000000000000000000000000000000000000E32", 2, GMP_RNDN)) + "00000000000000000000000000000000000000E32", 2, MPFR_RNDN)) { printf ("Rounding error when dest=src\n"); exit (1); @@ -175,7 +175,7 @@ test_fct (double (*f)(double), int (*g)(), char *s, mp_rnd_t r) { printf ("test_against_libc: incorrect result for %s, rnd = %s," " d = %g\ngot ", s, mpfr_print_rnd_mode (r), d); - mpfr_out_str (stdout, 10, 0, yy, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, yy, MPFR_RNDN); printf (" instead of %g\n", y); exit (1); } @@ -189,7 +189,7 @@ test_fct (double (*f)(double), int (*g)(), char *s, mp_rnd_t r) static void test_against_libc (void) { - mp_rnd_t r = GMP_RNDN; + mp_rnd_t r = MPFR_RNDN; #if HAVE_ROUND TEST_FCT (round); @@ -204,7 +204,7 @@ test_against_libc (void) TEST_FCT (ceil); #endif #if HAVE_NEARBYINT - for (r = 0; r < GMP_RND_MAX ; r++) + for (r = 0; r < MPFR_RND_MAX ; r++) if (mpfr_set_machine_rnd_mode (r) == 0) test_fct (&nearbyint, &mpfr_rint, "rint", r); #endif @@ -255,38 +255,38 @@ main (int argc, char *argv[]) mpfr_set_prec (x, s); mpfr_set_prec (t, s); mpfr_set_prec (u, s); - if (mpfr_set_z (x, z, GMP_RNDN)) + if (mpfr_set_z (x, z, MPFR_RNDN)) { printf ("Error: mpfr_set_z should be exact (s = %u)\n", (unsigned int) s); exit (1); } if (randlimb () % 2) - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); if (randlimb () % 2) - mpfr_div_2ui (x, x, randlimb () % s, GMP_RNDN); + mpfr_div_2ui (x, x, randlimb () % s, MPFR_RNDN); for (p = 2; p < 100; p++) { int trint; mpfr_set_prec (y, p); mpfr_set_prec (v, p); - for (r = 0; r < GMP_RND_MAX ; r++) + for (r = 0; r < MPFR_RND_MAX ; r++) for (trint = 0; trint < 3; trint++) { if (trint == 2) inexact = mpfr_rint (y, x, (mp_rnd_t) r); - else if (r == GMP_RNDN) + else if (r == MPFR_RNDN) inexact = mpfr_round (y, x); - else if (r == GMP_RNDZ) + else if (r == MPFR_RNDZ) inexact = (trint ? mpfr_trunc (y, x) : - mpfr_rint_trunc (y, x, GMP_RNDZ)); - else if (r == GMP_RNDU) + mpfr_rint_trunc (y, x, MPFR_RNDZ)); + else if (r == MPFR_RNDU) inexact = (trint ? mpfr_ceil (y, x) : - mpfr_rint_ceil (y, x, GMP_RNDU)); - else /* r = GMP_RNDD */ + mpfr_rint_ceil (y, x, MPFR_RNDU)); + else /* r = MPFR_RNDD */ inexact = (trint ? mpfr_floor (y, x) : - mpfr_rint_floor (y, x, GMP_RNDD)); - if (mpfr_sub (t, y, x, GMP_RNDN)) + mpfr_rint_floor (y, x, MPFR_RNDD)); + if (mpfr_sub (t, y, x, MPFR_RNDN)) err ("subtraction 1 should be exact", s, x, y, p, (mp_rnd_t) r, trint, inexact); sign_t = mpfr_cmp_ui (t, 0); @@ -298,30 +298,30 @@ main (int argc, char *argv[]) if (inexact == 0) continue; /* end of the test for exact results */ - if (((r == GMP_RNDD || (r == GMP_RNDZ && MPFR_SIGN (x) > 0)) + if (((r == MPFR_RNDD || (r == MPFR_RNDZ && MPFR_SIGN (x) > 0)) && inexact > 0) || - ((r == GMP_RNDU || (r == GMP_RNDZ && MPFR_SIGN (x) < 0)) + ((r == MPFR_RNDU || (r == MPFR_RNDZ && MPFR_SIGN (x) < 0)) && inexact < 0)) err ("wrong rounding direction", s, x, y, p, (mp_rnd_t) r, trint, inexact); if (inexact < 0) { - mpfr_add_ui (v, y, 1, GMP_RNDU); + mpfr_add_ui (v, y, 1, MPFR_RNDU); if (mpfr_cmp (v, x) <= 0) err ("representable integer between x and its " "rounded value", s, x, y, p, (mp_rnd_t) r, trint, inexact); } else { - mpfr_sub_ui (v, y, 1, GMP_RNDD); + mpfr_sub_ui (v, y, 1, MPFR_RNDD); if (mpfr_cmp (v, x) >= 0) err ("representable integer between x and its " "rounded value", s, x, y, p, (mp_rnd_t) r, trint, inexact); } - if (r == GMP_RNDN) + if (r == MPFR_RNDN) { int cmp; - if (mpfr_sub (u, v, x, GMP_RNDN)) + if (mpfr_sub (u, v, x, MPFR_RNDN)) err ("subtraction 2 should be exact", s, x, y, p, (mp_rnd_t) r, trint, inexact); cmp = mpfr_cmp_abs (t, u); @@ -334,20 +334,20 @@ main (int argc, char *argv[]) representable integers. */ if (trint == 2) { - /* halfway case for mpfr_rint in GMP_RNDN rounding + /* halfway case for mpfr_rint in MPFR_RNDN rounding mode: round to an even integer or mantissa. */ - mpfr_div_2ui (y, y, 1, GMP_RNDZ); + mpfr_div_2ui (y, y, 1, MPFR_RNDZ); if (!mpfr_integer_p (y)) err ("halfway case for mpfr_rint, result isn't an" " even integer", s, x, y, p, (mp_rnd_t) r, trint, inexact); /* If floor(x) and ceil(x) aren't both representable integers, the mantissa must be even. */ - mpfr_sub (v, v, y, GMP_RNDN); - mpfr_abs (v, v, GMP_RNDN); + mpfr_sub (v, v, y, MPFR_RNDN); + mpfr_abs (v, v, MPFR_RNDN); if (mpfr_cmp_ui (v, 1) != 0) { mpfr_div_2si (y, y, MPFR_EXP (y) - MPFR_PREC (y) - + 1, GMP_RNDN); + + 1, MPFR_RNDN); if (!mpfr_integer_p (y)) err ("halfway case for mpfr_rint, mantissa isn't" " even", s, x, y, p, (mp_rnd_t) r, trint, inexact); diff --git a/tests/troot.c b/tests/troot.c index 789295753..f70f5144d 100644 --- a/tests/troot.c +++ b/tests/troot.c @@ -36,7 +36,7 @@ special (void) /* root(NaN) = NaN */ mpfr_set_nan (x); - mpfr_root (y, x, 17, GMP_RNDN); + mpfr_root (y, x, 17, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: root(NaN,17) <> NaN\n"); @@ -45,7 +45,7 @@ special (void) /* root(+Inf) = +Inf */ mpfr_set_inf (x, 1); - mpfr_root (y, x, 42, GMP_RNDN); + mpfr_root (y, x, 42, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error: root(+Inf,42) <> +Inf\n"); @@ -54,7 +54,7 @@ special (void) /* root(-Inf, 17) = -Inf */ mpfr_set_inf (x, -1); - mpfr_root (y, x, 17, GMP_RNDN); + mpfr_root (y, x, 17, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0) { printf ("Error: root(-Inf,17) <> -Inf\n"); @@ -62,7 +62,7 @@ special (void) } /* root(-Inf, 42) = NaN */ mpfr_set_inf (x, -1); - mpfr_root (y, x, 42, GMP_RNDN); + mpfr_root (y, x, 42, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: root(-Inf,42) <> -Inf\n"); @@ -70,15 +70,15 @@ special (void) } /* root(+/-0) = +/-0 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_root (y, x, 17, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_root (y, x, 17, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) { printf ("Error: root(+0,17) <> +0\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_root (y, x, 42, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_root (y, x, 42, MPFR_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0) { printf ("Error: root(-0,42) <> -0\n"); @@ -86,8 +86,8 @@ special (void) } mpfr_set_prec (x, 53); - mpfr_set_str (x, "8.39005285514734966412e-01", 10, GMP_RNDN); - mpfr_root (x, x, 3, GMP_RNDN); + mpfr_set_str (x, "8.39005285514734966412e-01", 10, MPFR_RNDN); + mpfr_root (x, x, 3, MPFR_RNDN); if (mpfr_cmp_str1 (x, "9.43166207799662426048e-01")) { printf ("Error in root3 (1)\n"); @@ -100,7 +100,7 @@ special (void) mpfr_set_prec (x, 32); mpfr_set_prec (y, 32); mpfr_set_str_binary (x, "0.10000100001100101001001001011001"); - mpfr_root (x, x, 3, GMP_RNDN); + mpfr_root (x, x, 3, MPFR_RNDN); mpfr_set_str_binary (y, "0.11001101011000100111000111111001"); if (mpfr_cmp (x, y)) { @@ -111,7 +111,7 @@ special (void) mpfr_set_prec (x, 32); mpfr_set_prec (y, 32); mpfr_set_str_binary (x, "-0.1100001110110000010101011001011"); - mpfr_root (x, x, 3, GMP_RNDD); + mpfr_root (x, x, 3, MPFR_RNDD); mpfr_set_str_binary (y, "-0.11101010000100100101000101011001"); if (mpfr_cmp (x, y)) { @@ -122,7 +122,7 @@ special (void) mpfr_set_prec (x, 82); mpfr_set_prec (y, 27); mpfr_set_str_binary (x, "0.1010001111011101011011000111001011001101100011110110010011011011011010011001100101e-7"); - mpfr_root (y, x, 3, GMP_RNDD); + mpfr_root (y, x, 3, MPFR_RNDD); mpfr_set_str_binary (x, "0.101011110001110001000100011E-2"); if (mpfr_cmp (x, y)) { @@ -133,7 +133,7 @@ special (void) mpfr_set_prec (x, 204); mpfr_set_prec (y, 38); mpfr_set_str_binary (x, "0.101000000001101000000001100111111011111001110110100001111000100110100111001101100111110001110001011011010110010011100101111001111100001010010100111011101100000011011000101100010000000011000101001010001001E-5"); - mpfr_root (y, x, 3, GMP_RNDD); + mpfr_root (y, x, 3, MPFR_RNDD); mpfr_set_str_binary (x, "0.10001001111010011011101000010110110010E-1"); if (mpfr_cmp (x, y)) { @@ -145,11 +145,11 @@ special (void) mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); mpfr_set_str_binary (x, "1.0100001101101101001100110001001000000101001101100011E28"); - mpfr_root (y, x, 35, GMP_RNDN); + mpfr_root (y, x, 35, MPFR_RNDN); mpfr_set_str_binary (x, "1.1100000010110101100011101011000010100001101100100011E0"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_root (y, x, 35, GMP_RNDN) for\n" + printf ("Error in mpfr_root (y, x, 35, MPFR_RNDN) for\n" "x = 1.0100001101101101001100110001001000000101001101100011E28\n" "Expected "); mpfr_dump (x); @@ -159,11 +159,11 @@ special (void) } /* Worst cases found on 2006-11-26 */ mpfr_set_str_binary (x, "1.1111010011101110001111010110000101110000110110101100E17"); - mpfr_root (y, x, 36, GMP_RNDD); + mpfr_root (y, x, 36, MPFR_RNDD); mpfr_set_str_binary (x, "1.0110100111010001101001010111001110010100111111000010E0"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_root (y, x, 36, GMP_RNDD) for\n" + printf ("Error in mpfr_root (y, x, 36, MPFR_RNDD) for\n" "x = 1.1111010011101110001111010110000101110000110110101100E17\n" "Expected "); mpfr_dump (x); @@ -172,11 +172,11 @@ special (void) exit (1); } mpfr_set_str_binary (x, "1.1100011101101101100010110001000001110001111110010000E23"); - mpfr_root (y, x, 36, GMP_RNDU); + mpfr_root (y, x, 36, MPFR_RNDU); mpfr_set_str_binary (x, "1.1001010100001110000110111111100011011101110011000100E0"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_root (y, x, 36, GMP_RNDU) for\n" + printf ("Error in mpfr_root (y, x, 36, MPFR_RNDU) for\n" "x = 1.1100011101101101100010110001000001110001111110010000E23\n" "Expected "); mpfr_dump (x); @@ -186,8 +186,8 @@ special (void) } /* Check for k = 1 */ - mpfr_set_ui (x, 17, GMP_RNDN); - i = mpfr_root (y, x, 1, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + i = mpfr_root (y, x, 1, MPFR_RNDN); if (mpfr_cmp_ui (x, 17) || i != 0) { printf ("Error in root (17^(1/1))\n"); @@ -200,51 +200,51 @@ special (void) For x = 1 => 1. For x > 1, => +Inf. For x < 0 => NaN. */ - i = mpfr_root (y, x, 0, GMP_RNDN); + i = mpfr_root (y, x, 0, MPFR_RNDN); if (!MPFR_IS_INF (y) || !MPFR_IS_POS (y) || i != 0) { printf ("Error in root 17^(1/0)\n"); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - i = mpfr_root (y, x, 0, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + i = mpfr_root (y, x, 0, MPFR_RNDN); if (mpfr_cmp_ui (y, 1) || i != 0) { printf ("Error in root 1^(1/0)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); - i = mpfr_root (y, x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + i = mpfr_root (y, x, 0, MPFR_RNDN); if (!MPFR_IS_ZERO (y) || !MPFR_IS_POS (y) || i != 0) { printf ("Error in root 0+^(1/0)\n"); exit (1); } MPFR_CHANGE_SIGN (x); - i = mpfr_root (y, x, 0, GMP_RNDN); + i = mpfr_root (y, x, 0, MPFR_RNDN); if (!MPFR_IS_ZERO (y) || !MPFR_IS_POS (y) || i != 0) { printf ("Error in root 0-^(1/0)\n"); exit (1); } - mpfr_set_ui_2exp (x, 17, -5, GMP_RNDD); - i = mpfr_root (y, x, 0, GMP_RNDN); + mpfr_set_ui_2exp (x, 17, -5, MPFR_RNDD); + i = mpfr_root (y, x, 0, MPFR_RNDN); if (!MPFR_IS_ZERO (y) || !MPFR_IS_POS (y) || i != 0) { printf ("Error in root (17/2^5)^(1/0)\n"); exit (1); } #endif - mpfr_set_ui (x, 0, GMP_RNDN); - i = mpfr_root (y, x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + i = mpfr_root (y, x, 0, MPFR_RNDN); if (!MPFR_IS_NAN (y) || i != 0) { printf ("Error in root 0+^(1/0)\n"); exit (1); } /* Check for k==2 */ - mpfr_set_si (x, -17, GMP_RNDD); - i = mpfr_root (y, x, 2, GMP_RNDN); + mpfr_set_si (x, -17, MPFR_RNDD); + i = mpfr_root (y, x, 2, MPFR_RNDN); if (!MPFR_IS_NAN (y) || i != 0) { printf ("Error in root (-17)^(1/2)\n"); @@ -277,20 +277,20 @@ main (void) for (p = 2; p < 100; p++) { mpfr_set_prec (x, p); - for (r = 0; r < GMP_RND_MAX; r++) + for (r = 0; r < MPFR_RND_MAX; r++) { - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); k = 2 + randlimb () % 4; /* 2 <= k <= 5 */ mpfr_root (x, x, k, (mp_rnd_t) r); if (mpfr_cmp_ui (x, 1)) { printf ("Error in mpfr_root(%lu) for x=1, rnd=%s\ngot ", k, mpfr_print_rnd_mode ((mp_rnd_t) r)); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); if (k % 2) { mpfr_root (x, x, k, (mp_rnd_t) r); @@ -298,7 +298,7 @@ main (void) { printf ("Error in mpfr_root(%lu) for x=-1, rnd=%s\ngot ", k, mpfr_print_rnd_mode ((mp_rnd_t) r)); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } @@ -309,15 +309,15 @@ main (void) int i; for (i = -12; i <= 12; i++) { - mpfr_set_ui (x, 27, GMP_RNDN); - mpfr_mul_2si (x, x, 3*i, GMP_RNDN); - mpfr_root (x, x, 3, GMP_RNDN); + mpfr_set_ui (x, 27, MPFR_RNDN); + mpfr_mul_2si (x, x, 3*i, MPFR_RNDN); + mpfr_root (x, x, 3, MPFR_RNDN); if (mpfr_cmp_si_2exp (x, 3, i)) { printf ("Error in mpfr_root(3) for " "x = 27.0 * 2^(%d), rnd=%s\ngot ", 3*i, mpfr_print_rnd_mode ((mp_rnd_t) r)); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\ninstead of 3 * 2^(%d)\n", i); exit (1); } diff --git a/tests/tround_prec.c b/tests/tround_prec.c index 256ac64d3..59d5e5bed 100644 --- a/tests/tround_prec.c +++ b/tests/tround_prec.c @@ -36,83 +36,83 @@ main (void) mpfr_init (x); mpfr_set_nan (x); - mpfr_prec_round (x, 2, GMP_RNDN); + mpfr_prec_round (x, 2, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (x)); mpfr_set_inf (x, 1); - mpfr_prec_round (x, 2, GMP_RNDN); + mpfr_prec_round (x, 2, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); mpfr_set_inf (x, -1); - mpfr_prec_round (x, 2, GMP_RNDN); + mpfr_prec_round (x, 2, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_prec_round (x, 2, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_prec_round (x, 2, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x)); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - mpfr_prec_round (x, 2, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_prec_round (x, 2, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_NEG(x)); emax = mpfr_get_emax (); set_emax (0); mpfr_set_prec (x, 3); mpfr_set_str_binary (x, "0.111"); - mpfr_prec_round (x, 2, GMP_RNDN); + mpfr_prec_round (x, 2, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); set_emax (emax); mpfr_set_prec (x, mp_bits_per_limb + 2); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_nextbelow (x); - mpfr_prec_round (x, mp_bits_per_limb + 1, GMP_RNDN); + mpfr_prec_round (x, mp_bits_per_limb + 1, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0); mpfr_set_prec (x, 3); - mpfr_set_ui (x, 5, GMP_RNDN); - mpfr_prec_round (x, 2, GMP_RNDN); + mpfr_set_ui (x, 5, MPFR_RNDN); + mpfr_prec_round (x, 2, MPFR_RNDN); if (mpfr_cmp_ui(x, 4)) { printf ("Error in tround: got "); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf (" instead of 4\n"); exit (1); } /* check case when reallocation is needed */ mpfr_set_prec (x, 3); - mpfr_set_ui (x, 5, GMP_RNDN); /* exact */ - mpfr_prec_round (x, mp_bits_per_limb + 1, GMP_RNDN); + mpfr_set_ui (x, 5, MPFR_RNDN); /* exact */ + mpfr_prec_round (x, mp_bits_per_limb + 1, MPFR_RNDN); if (mpfr_cmp_ui(x, 5)) { printf ("Error in tround: got "); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf (" instead of 5\n"); exit (1); } mpfr_clear(x); mpfr_init2 (x, 3); - mpfr_set_si (x, -5, GMP_RNDN); /* exact */ - mpfr_prec_round (x, mp_bits_per_limb + 1, GMP_RNDN); + mpfr_set_si (x, -5, MPFR_RNDN); /* exact */ + mpfr_prec_round (x, mp_bits_per_limb + 1, MPFR_RNDN); if (mpfr_cmp_si(x, -5)) { printf ("Error in tround: got "); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf (" instead of -5\n"); exit (1); } /* check case when new precision needs less limbs */ mpfr_set_prec (x, mp_bits_per_limb + 1); - mpfr_set_ui (x, 5, GMP_RNDN); /* exact */ - mpfr_prec_round (x, 3, GMP_RNDN); /* exact */ + mpfr_set_ui (x, 5, MPFR_RNDN); /* exact */ + mpfr_prec_round (x, 3, MPFR_RNDN); /* exact */ if (mpfr_cmp_ui(x, 5)) { printf ("Error in tround: got "); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf (" instead of 5\n"); exit (1); } diff --git a/tests/tsec.c b/tests/tsec.c index 005395978..d8032d374 100644 --- a/tests/tsec.c +++ b/tests/tsec.c @@ -38,7 +38,7 @@ check_specials (void) mpfr_init2 (y, 123L); mpfr_set_nan (x); - mpfr_sec (y, x, GMP_RNDN); + mpfr_sec (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: sec(NaN) != NaN\n"); @@ -46,7 +46,7 @@ check_specials (void) } mpfr_set_inf (x, 1); - mpfr_sec (y, x, GMP_RNDN); + mpfr_sec (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: sec(Inf) != NaN\n"); @@ -54,7 +54,7 @@ check_specials (void) } mpfr_set_inf (x, -1); - mpfr_sec (y, x, GMP_RNDN); + mpfr_sec (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: sec(-Inf) != NaN\n"); @@ -62,15 +62,15 @@ check_specials (void) } /* sec(+/-0) = 1 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_sec (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_sec (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { printf ("Error: sec(+0) != 1\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_sec (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_sec (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { printf ("Error: sec(-0) != 1\n"); @@ -95,13 +95,13 @@ overflowed_sec0 (void) for (emax = -1; emax <= 0; emax++) { - mpfr_set_ui_2exp (y, 1, emax, GMP_RNDN); + mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN); mpfr_nextbelow (y); set_emax (emax); /* 1 is not representable. */ for (i = -1; i <= 1; i++) RND_LOOP (rnd) { - mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN); + mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN); mpfr_clear_flags (); inex = mpfr_sec (x, x, (mp_rnd_t) rnd); if (! mpfr_overflow_p ()) @@ -111,7 +111,7 @@ overflowed_sec0 (void) i, mpfr_print_rnd_mode ((mp_rnd_t) rnd)); err = 1; } - if (rnd == GMP_RNDZ || rnd == GMP_RNDD) + if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) { if (inex >= 0) { diff --git a/tests/tsech.c b/tests/tsech.c index 6e9bf970d..bb2e44679 100644 --- a/tests/tsech.c +++ b/tests/tsech.c @@ -39,7 +39,7 @@ check_specials (void) mpfr_init2 (y, 123L); mpfr_set_nan (x); - mpfr_sech (y, x, GMP_RNDN); + mpfr_sech (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: sech(NaN) != NaN\n"); @@ -47,7 +47,7 @@ check_specials (void) } mpfr_set_inf (x, 1); - mpfr_sech (y, x, GMP_RNDN); + mpfr_sech (y, x, MPFR_RNDN); if (! (MPFR_IS_ZERO (y) && MPFR_SIGN (y) > 0)) { printf ("Error: sech(+Inf) != +0\n"); @@ -55,7 +55,7 @@ check_specials (void) } mpfr_set_inf (x, -1); - mpfr_sech (y, x, GMP_RNDN); + mpfr_sech (y, x, MPFR_RNDN); if (! (MPFR_IS_ZERO (y) && MPFR_SIGN (y) > 0)) { printf ("Error: sech(-Inf) != +0\n"); @@ -63,15 +63,15 @@ check_specials (void) } /* sec(+/-0) = 1 */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_sech (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_sech (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { printf ("Error: sech(+0) != 1\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_sech (y, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_sech (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1)) { printf ("Error: sech(-0) != 1\n"); @@ -79,15 +79,15 @@ check_specials (void) } /* check huge x */ - mpfr_set_str (x, "8e8", 10, GMP_RNDN); - mpfr_sech (y, x, GMP_RNDN); + mpfr_set_str (x, "8e8", 10, MPFR_RNDN); + mpfr_sech (y, x, MPFR_RNDN); if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0)) { printf ("Error: sech(8e8) != +0\n"); exit (1); } - mpfr_set_str (x, "-8e8", 10, GMP_RNDN); - mpfr_sech (y, x, GMP_RNDN); + mpfr_set_str (x, "-8e8", 10, MPFR_RNDN); + mpfr_sech (y, x, MPFR_RNDN); if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0)) { printf ("Error: sech(-8e8) != +0\n"); @@ -112,17 +112,17 @@ overflowed_sech0 (void) for (emax = -1; emax <= 0; emax++) { - mpfr_set_ui_2exp (y, 1, emax, GMP_RNDN); + mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN); mpfr_nextbelow (y); set_emax (emax); /* 1 is not representable. */ /* and if emax < 0, 1 - eps is not representable either. */ for (i = -1; i <= 1; i++) RND_LOOP (rnd) { - mpfr_set_si_2exp (x, i, -512 * ABS (i), GMP_RNDN); + mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN); mpfr_clear_flags (); inex = mpfr_sech (x, x, (mp_rnd_t) rnd); - if ((i == 0 || emax < 0 || rnd == GMP_RNDN || rnd == GMP_RNDU) && + if ((i == 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) && ! mpfr_overflow_p ()) { printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n" @@ -130,7 +130,7 @@ overflowed_sech0 (void) i, mpfr_print_rnd_mode ((mp_rnd_t) rnd)); err = 1; } - if (rnd == GMP_RNDZ || rnd == GMP_RNDD) + if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) { if (inex >= 0) { diff --git a/tests/tset.c b/tests/tset.c index 2212236ce..740a4e721 100644 --- a/tests/tset.c +++ b/tests/tset.c @@ -33,7 +33,7 @@ check_neg_special (void) mpfr_init (x); MPFR_SET_NAN (x); mpfr_clear_nanflag (); - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); if (!mpfr_nanflag_p () ) { printf("ERROR: neg (NaN) doesn't set Nan flag.\n"); @@ -57,30 +57,30 @@ main (void) tests_start_mpfr (); /* check prototypes of mpfr_init_set_* */ - inexact = mpfr_init_set_si (x, -1, GMP_RNDN); - inexact = mpfr_init_set (y, x, GMP_RNDN); - inexact = mpfr_init_set_ui (z, 1, GMP_RNDN); - inexact = mpfr_init_set_d (u, 1.0, GMP_RNDN); + inexact = mpfr_init_set_si (x, -1, MPFR_RNDN); + inexact = mpfr_init_set (y, x, MPFR_RNDN); + inexact = mpfr_init_set_ui (z, 1, MPFR_RNDN); + inexact = mpfr_init_set_d (u, 1.0, MPFR_RNDN); mpfr_set_nan (x); - (mpfr_set) (y, x, GMP_RNDN); + (mpfr_set) (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); mpfr_set_inf (x, 1); - mpfr_set (y, x, GMP_RNDN); + mpfr_set (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) > 0); mpfr_set_inf (x, -1); - mpfr_set (y, x, GMP_RNDN); + mpfr_set (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) < 0); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_set (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_set (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS(y)); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - mpfr_set (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_set (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG(y)); emax = mpfr_get_emax (); @@ -88,7 +88,7 @@ main (void) mpfr_set_prec (x, 3); mpfr_set_str_binary (x, "0.111"); mpfr_set_prec (y, 2); - mpfr_set (y, x, GMP_RNDU); + mpfr_set (y, x, MPFR_RNDU); if (!(MPFR_IS_INF (y) && MPFR_SIGN (y) > 0)) { printf ("Error for y=x=0.111 with px=3, py=2 and emax=0\nx="); @@ -104,11 +104,11 @@ main (void) mpfr_set_prec (y, 11); mpfr_set_str_binary (y, "0.11111111100E-8"); mpfr_set_prec (x, 2); - mpfr_set (x, y, GMP_RNDN); + mpfr_set (x, y, MPFR_RNDN); mpfr_set_str_binary (y, "1.0E-8"); if (mpfr_cmp (x, y)) { - printf ("Error for y=0.11111111100E-8, prec=2, rnd=GMP_RNDN\n"); + printf ("Error for y=0.11111111100E-8, prec=2, rnd=MPFR_RNDN\n"); exit (1); } @@ -117,11 +117,11 @@ main (void) mpfr_set_prec (x, p); mpfr_urandomb (x, RANDS); if (randlimb () % 2) - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); for (q=2; q<2*p; q++) { mpfr_set_prec (y, q); - for (rnd = 0; rnd < GMP_RND_MAX; rnd++) + for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) { inexact = mpfr_set (y, x, (mp_rnd_t) rnd); cmp = mpfr_cmp (y, x); diff --git a/tests/tset_d.c b/tests/tset_d.c index 85721f2fb..935eed8a5 100644 --- a/tests/tset_d.c +++ b/tests/tset_d.c @@ -66,7 +66,7 @@ main (int argc, char *argv[]) mpfr_init (x); mpfr_set_nan (x); - d = mpfr_get_d (x, GMP_RNDN); + d = mpfr_get_d (x, MPFR_RNDN); if (! DOUBLE_ISNAN (d)) { printf ("ERROR for NAN (1)\n"); @@ -77,8 +77,8 @@ main (int argc, char *argv[]) #endif exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_set_d (x, d, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_set_d (x, d, MPFR_RNDN); if (! mpfr_nan_p (x)) { printf ("ERROR for NAN (2)\n"); @@ -91,10 +91,10 @@ main (int argc, char *argv[]) } d = 0.0; - mpfr_set_d (x, d, GMP_RNDN); + mpfr_set_d (x, d, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x)); d = -d; - mpfr_set_d (x, d, GMP_RNDN); + mpfr_set_d (x, d, MPFR_RNDN); if (mpfr_cmp_ui (x, 0) != 0 || MPFR_IS_POS(x)) { printf ("Error in mpfr_set_d on -0\n"); @@ -102,15 +102,15 @@ main (int argc, char *argv[]) } mpfr_set_inf (x, 1); - d = mpfr_get_d (x, GMP_RNDN); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_set_d (x, d, GMP_RNDN); + d = mpfr_get_d (x, MPFR_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_set_d (x, d, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); mpfr_set_inf (x, -1); - d = mpfr_get_d (x, GMP_RNDN); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_set_d (x, d, GMP_RNDN); + d = mpfr_get_d (x, MPFR_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_set_d (x, d, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0); mpfr_set_prec (x, 2); @@ -120,12 +120,12 @@ main (int argc, char *argv[]) for (n=0; n<52; n++, d /= 2.0) if (d != 0.0) /* should be 2^(-1022-n) */ { - mpfr_set_d (x, d, GMP_RNDN); + mpfr_set_d (x, d, MPFR_RNDN); if (mpfr_cmp_ui_2exp (x, 1, -1022-n)) { printf ("Wrong result for d=2^(%ld), ", -1022-n); printf ("got "); - mpfr_out_str (stdout, 10, 10, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 10, x, MPFR_RNDN); printf ("\n"); mpfr_print_binary (x); puts (""); @@ -135,14 +135,14 @@ main (int argc, char *argv[]) /* checks that rounds to nearest sets the last bit to zero in case of equal distance */ - mpfr_set_d (x, 5.0, GMP_RNDN); + mpfr_set_d (x, 5.0, MPFR_RNDN); if (mpfr_cmp_ui (x, 4)) { printf ("Error in tset_d: expected 4.0, got "); mpfr_print_binary (x); putchar('\n'); exit (1); } - mpfr_set_d (x, -5.0, GMP_RNDN); + mpfr_set_d (x, -5.0, MPFR_RNDN); if (mpfr_cmp_si (x, -4)) { printf ("Error in tset_d: expected -4.0, got "); @@ -150,7 +150,7 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_d (x, 9.84891017624509146344e-01, GMP_RNDU); + mpfr_set_d (x, 9.84891017624509146344e-01, MPFR_RNDU); if (mpfr_cmp_ui (x, 1)) { printf ("Error in tset_d: expected 1.0, got "); diff --git a/tests/tset_exp.c b/tests/tset_exp.c index bfd50a1a5..c62df48b0 100644 --- a/tests/tset_exp.c +++ b/tests/tset_exp.c @@ -39,7 +39,7 @@ main (int argc, char *argv[]) mpfr_init (x); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); ret = mpfr_set_exp (x, 2); MPFR_ASSERTN(ret == 0 && mpfr_cmp_ui (x, 2) == 0); diff --git a/tests/tset_f.c b/tests/tset_f.c index d9fcae02c..aeca58e0a 100644 --- a/tests/tset_f.c +++ b/tests/tset_f.c @@ -43,9 +43,9 @@ main (void) mpf_set_d (y, 0.0); /* check prototype of mpfr_init_set_f */ - mpfr_init_set_f (x, y, GMP_RNDN); + mpfr_init_set_f (x, y, MPFR_RNDN); mpfr_set_prec (x, 100); - mpfr_set_f (x, y, GMP_RNDN); + mpfr_set_f (x, y, MPFR_RNDN); mpf_urandomb (y, RANDS, 10 * GMP_NUMB_BITS); mpfr_set_f (x, y, RND_RAND ()); @@ -56,10 +56,10 @@ main (void) mpfr_init2 (u, 256); mpfr_set_str (u, "7.f10872b020c49ba5e353f7ced916872b020c49ba5e353f7ced916872b020c498@2", - 16, GMP_RNDN); + 16, MPFR_RNDN); mpf_set_str (y, "2033033E-3", 10); /* avoid 2033.033 which is locale-sensitive */ - mpfr_set_f (x, y, GMP_RNDN); + mpfr_set_f (x, y, MPFR_RNDN); if (mpfr_cmp (x, u)) { printf ("mpfr_set_f failed for y=2033033E-3\n"); @@ -67,8 +67,8 @@ main (void) } mpf_set_str (y, "-2033033E-3", 10); /* avoid -2033.033 which is locale-sensitive */ - mpfr_set_f (x, y, GMP_RNDN); - mpfr_neg (u, u, GMP_RNDN); + mpfr_set_f (x, y, MPFR_RNDN); + mpfr_neg (u, u, MPFR_RNDN); if (mpfr_cmp (x, u)) { printf ("mpfr_set_f failed for y=-2033033E-3\n"); @@ -79,7 +79,7 @@ main (void) mpf_set_str (y, "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111", -2); mpf_mul_2exp (y, y, 600); mpfr_set_prec (x, 300); - mpfr_set_f (x, y, GMP_RNDN); + mpfr_set_f (x, y, MPFR_RNDN); if (mpfr_check (x) == 0) { printf ("Error in mpfr_set_f: corrupted result\n"); @@ -95,7 +95,7 @@ main (void) mpf_set_prec (z, pr); mpf_urandomb (z, RANDS, z->_mp_prec); mpfr_set_prec (u, ((pr / BITS_PER_MP_LIMB + 1) * BITS_PER_MP_LIMB)); - mpfr_set_f (u, z, GMP_RNDN); + mpfr_set_f (u, z, MPFR_RNDN); if (mpfr_cmp_f (u , z) != 0) { printf ("Error in mpfr_set_f:\n"); @@ -103,21 +103,21 @@ main (void) mpf_out_str (stdout, 16, 0, z); printf ("\nmpfr(precision=%lu)=", ((pr / BITS_PER_MP_LIMB + 1) * BITS_PER_MP_LIMB)); - mpfr_out_str (stdout, 16, 0, u, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN); putchar ('\n'); exit (1); } mpfr_set_prec (x, pr); - mpfr_set_f (x, z, GMP_RNDN); - mpfr_sub (u, u, x, GMP_RNDN); - mpfr_abs (u, u, GMP_RNDN); + mpfr_set_f (x, z, MPFR_RNDN); + mpfr_sub (u, u, x, MPFR_RNDN); + mpfr_abs (u, u, MPFR_RNDN); if (mpfr_cmp_ui_2exp (u, 1, -pr - 1) > 0) { printf ("Error in mpfr_set_f: precision=%lu\n", pr); printf ("mpf ="); mpf_out_str (stdout, 16, 0, z); printf ("\nmpfr="); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } @@ -127,13 +127,13 @@ main (void) mpfr_set_prec (x, 53); mpf_set_prec (y, 53); mpf_set_ui (y, 0); - for (r = 0 ; r < GMP_RND_MAX ; r++) + for (r = 0 ; r < MPFR_RND_MAX ; r++) { int i; for (i = -1; i <= 1; i++) { if (i) - mpfr_set_si (x, i, GMP_RNDN); + mpfr_set_si (x, i, MPFR_RNDN); inexact = mpfr_set_f (x, y, (mp_rnd_t) r); if (!MPFR_IS_ZERO(x) || !MPFR_IS_POS(x) || inexact) { @@ -151,19 +151,19 @@ main (void) for (r = 0; r < mp_bits_per_limb; r++) { mpfr_urandomb (x, RANDS); /* to fill low limbs with random data */ - inexact = mpfr_set_f (x, y, GMP_RNDN); + inexact = mpfr_set_f (x, y, MPFR_RNDN); MPFR_ASSERTN(inexact == 0 && mpfr_cmp_ui_2exp (x, 1, r) == 0); mpf_mul_2exp (y, y, 1); } mpf_set_ui (y, 1); mpf_mul_2exp (y, y, ULONG_MAX); - mpfr_set_f (x, y, GMP_RNDN); - mpfr_set_ui (u, 1, GMP_RNDN); - mpfr_mul_2ui (u, u, ULONG_MAX, GMP_RNDN); + mpfr_set_f (x, y, MPFR_RNDN); + mpfr_set_ui (u, 1, MPFR_RNDN); + mpfr_mul_2ui (u, u, ULONG_MAX, MPFR_RNDN); if (!mpfr_equal_p (x, u)) { - printf ("Error: mpfr_set_f (x, y, GMP_RNDN) for y = 2^ULONG_MAX\n"); + printf ("Error: mpfr_set_f (x, y, MPFR_RNDN) for y = 2^ULONG_MAX\n"); exit (1); } @@ -174,11 +174,11 @@ main (void) { mpf_set_ui (y, 1); mpf_mul_2exp (y, y, emax); - mpfr_set_f (x, y, GMP_RNDN); - mpfr_set_ui_2exp (u, 1, emax, GMP_RNDN); + mpfr_set_f (x, y, MPFR_RNDN); + mpfr_set_ui_2exp (u, 1, emax, MPFR_RNDN); if (!mpfr_equal_p (x, u)) { - printf ("Error: mpfr_set_f (x, y, GMP_RNDN) for y = 2^emax\n"); + printf ("Error: mpfr_set_f (x, y, MPFR_RNDN) for y = 2^emax\n"); exit (1); } } @@ -188,11 +188,11 @@ main (void) { mpf_set_ui (y, 1); mpf_mul_2exp (y, y, emax - 1); - mpfr_set_f (x, y, GMP_RNDN); - mpfr_set_ui_2exp (u, 1, emax - 1, GMP_RNDN); + mpfr_set_f (x, y, MPFR_RNDN); + mpfr_set_ui_2exp (u, 1, emax - 1, MPFR_RNDN); if (!mpfr_equal_p (x, u)) { - printf ("Error: mpfr_set_f (x, y, GMP_RNDN) for y = 2^(emax-1)\n"); + printf ("Error: mpfr_set_f (x, y, MPFR_RNDN) for y = 2^(emax-1)\n"); exit (1); } } diff --git a/tests/tset_ld.c b/tests/tset_ld.c index 378e77f0e..ab5636dbe 100644 --- a/tests/tset_ld.c +++ b/tests/tset_ld.c @@ -68,7 +68,7 @@ check_set_get (long double d, mpfr_t x) long double e; int inex; - for (r = 0; r < GMP_RND_MAX; r++) + for (r = 0; r < MPFR_RND_MAX; r++) { inex = mpfr_set_ld (x, d, (mp_rnd_t) r); if (inex != 0) @@ -88,7 +88,7 @@ check_set_get (long double d, mpfr_t x) printf (" r=%d\n", r); printf (" d=%1.30Le get_ld(set_ld(d))=%1.30Le\n", d, e); ld_trace (" d", d); - printf (" x="); mpfr_out_str (NULL, 16, 0, x, GMP_RNDN); + printf (" x="); mpfr_out_str (NULL, 16, 0, x, MPFR_RNDN); printf ("\n"); ld_trace (" e", e); #ifdef MPFR_NANISNAN @@ -113,28 +113,28 @@ test_small (void) mpfr_init2 (z, 64); /* x = 11906603631607553907/2^(16381+64) */ - mpfr_set_str (x, "0.1010010100111100110000001110101101000111010110000001111101110011E-16381", 2, GMP_RNDN); - d = mpfr_get_ld (x, GMP_RNDN); /* infinite loop? */ - mpfr_set_ld (y, d, GMP_RNDN); - mpfr_sub (z, x, y, GMP_RNDN); - mpfr_abs (z, z, GMP_RNDN); + mpfr_set_str (x, "0.1010010100111100110000001110101101000111010110000001111101110011E-16381", 2, MPFR_RNDN); + d = mpfr_get_ld (x, MPFR_RNDN); /* infinite loop? */ + mpfr_set_ld (y, d, MPFR_RNDN); + mpfr_sub (z, x, y, MPFR_RNDN); + mpfr_abs (z, z, MPFR_RNDN); mpfr_clear_erangeflag (); /* If long double = double, d should be equal to 0; in this case, everything is OK. */ - if (d != 0 && (mpfr_cmp_str (z, "1E-16434", 2, GMP_RNDN) > 0 || + if (d != 0 && (mpfr_cmp_str (z, "1E-16434", 2, MPFR_RNDN) > 0 || mpfr_erangeflag_p ())) { printf ("Error with x = "); - mpfr_out_str (NULL, 10, 21, x, GMP_RNDN); + mpfr_out_str (NULL, 10, 21, x, MPFR_RNDN); printf (" = "); - mpfr_out_str (NULL, 16, 0, x, GMP_RNDN); + mpfr_out_str (NULL, 16, 0, x, MPFR_RNDN); printf ("\n -> d = %.21Lg", d); printf ("\n -> y = "); - mpfr_out_str (NULL, 10, 21, y, GMP_RNDN); + mpfr_out_str (NULL, 10, 21, y, MPFR_RNDN); printf (" = "); - mpfr_out_str (NULL, 16, 0, y, GMP_RNDN); + mpfr_out_str (NULL, 16, 0, y, MPFR_RNDN); printf ("\n -> |x-y| = "); - mpfr_out_str (NULL, 16, 0, z, GMP_RNDN); + mpfr_out_str (NULL, 16, 0, z, MPFR_RNDN); printf ("\n"); exit (1); } @@ -171,7 +171,7 @@ main (int argc, char *argv[]) /* check NaN */ mpfr_set_nan (x); - d = mpfr_get_ld (x, GMP_RNDN); + d = mpfr_get_ld (x, MPFR_RNDN); check_set_get (d, x); /* check +0.0 and -0.0 */ @@ -181,7 +181,7 @@ main (int argc, char *argv[]) check_set_get (d, x); /* check that the sign of -0.0 is set */ - mpfr_set_ld (x, DBL_NEG_ZERO, GMP_RNDN); + mpfr_set_ld (x, DBL_NEG_ZERO, MPFR_RNDN); if (MPFR_SIGN(x) > 0) { printf ("Error: sign of -0.0 is not set correctly\n"); @@ -193,12 +193,12 @@ main (int argc, char *argv[]) /* check +Inf */ mpfr_set_inf (x, 1); - d = mpfr_get_ld (x, GMP_RNDN); + d = mpfr_get_ld (x, MPFR_RNDN); check_set_get (d, x); /* check -Inf */ mpfr_set_inf (x, -1); - d = mpfr_get_ld (x, GMP_RNDN); + d = mpfr_get_ld (x, MPFR_RNDN); check_set_get (d, x); /* check the largest power of two */ @@ -235,7 +235,7 @@ main (int argc, char *argv[]) for (i = 0; i < 10000; i++) { mpfr_urandomb (x, RANDS); - d = mpfr_get_ld (x, GMP_RNDN); + d = mpfr_get_ld (x, MPFR_RNDN); check_set_get (d, x); } @@ -243,11 +243,11 @@ main (int argc, char *argv[]) emax = mpfr_get_emax (); mpfr_set_prec (x, 2); set_emax (1); - mpfr_set_ld (x, (long double) 2.0, GMP_RNDN); + mpfr_set_ld (x, (long double) 2.0, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); for (d = (long double) 2.0, i = 0; i < 13; i++, d *= d); /* now d = 2^8192 */ - mpfr_set_ld (x, d, GMP_RNDN); + mpfr_set_ld (x, d, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); set_emax (emax); diff --git a/tests/tset_q.c b/tests/tset_q.c index 2e008ebbf..3c873ad53 100644 --- a/tests/tset_q.c +++ b/tests/tset_q.c @@ -44,7 +44,7 @@ check (long int n, long int d, mp_rnd_t rnd, const char *ys) printf ("Error for q=%ld/%ld and rnd=%s\n", n, d, mpfr_print_rnd_mode (rnd)); printf ("correct result is %s, mpfr_set_q gives ", ys); - mpfr_out_str(stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); exit (1); } @@ -81,7 +81,7 @@ static void check0(void) mpfr_init (x); mpq_init (y); mpq_set_si (y, 0, 1); - for (r = 0; r < GMP_RND_MAX; r++) + for (r = 0; r < MPFR_RND_MAX; r++) { inexact = mpfr_set_q(x, y, (mp_rnd_t) r); if (!MPFR_IS_ZERO(x) || !MPFR_IS_POS(x) || inexact) @@ -100,15 +100,15 @@ main (void) { tests_start_mpfr (); - check(-1647229822, 40619231, GMP_RNDZ, "-4.055295438754120596e1"); - check(-148939696, 1673285490, GMP_RNDZ, "-8.9010331404953485501e-2"); - check(-441322590, 273662545, GMP_RNDZ, "-1.6126525096812205362"); - check(-1631156895, 1677687197, GMP_RNDU, "-9.722652100563177191e-1"); - check(2141332571, 3117601, GMP_RNDZ, "6.8685267004982347316e2"); - check(75504803, 400207282, GMP_RNDU, "1.8866424074712365155e-1"); - check(643562308, 23100894, GMP_RNDD, "2.7858762002890447462e1"); - check(632549085, 1831935802, GMP_RNDN, "3.4528998467600230393e-1"); - check (1, 1, GMP_RNDN, "1.0"); + check(-1647229822, 40619231, MPFR_RNDZ, "-4.055295438754120596e1"); + check(-148939696, 1673285490, MPFR_RNDZ, "-8.9010331404953485501e-2"); + check(-441322590, 273662545, MPFR_RNDZ, "-1.6126525096812205362"); + check(-1631156895, 1677687197, MPFR_RNDU, "-9.722652100563177191e-1"); + check(2141332571, 3117601, MPFR_RNDZ, "6.8685267004982347316e2"); + check(75504803, 400207282, MPFR_RNDU, "1.8866424074712365155e-1"); + check(643562308, 23100894, MPFR_RNDD, "2.7858762002890447462e1"); + check(632549085, 1831935802, MPFR_RNDN, "3.4528998467600230393e-1"); + check (1, 1, MPFR_RNDN, "1.0"); check0(); diff --git a/tests/tset_si.c b/tests/tset_si.c index a07da8cba..1bb5a7294 100644 --- a/tests/tset_si.c +++ b/tests/tset_si.c @@ -36,55 +36,55 @@ test_2exp (void) mpfr_init2 (x, 32); - mpfr_set_ui_2exp (x, 1, 0, GMP_RNDN); + mpfr_set_ui_2exp (x, 1, 0, MPFR_RNDN); if (mpfr_cmp_ui(x, 1)) ERROR("(1U,0)"); - mpfr_set_ui_2exp (x, 1024, -10, GMP_RNDN); + mpfr_set_ui_2exp (x, 1024, -10, MPFR_RNDN); if (mpfr_cmp_ui(x, 1)) ERROR("(1024U,-10)"); - mpfr_set_ui_2exp (x, 1024, 10, GMP_RNDN); + mpfr_set_ui_2exp (x, 1024, 10, MPFR_RNDN); if (mpfr_cmp_ui(x, 1024*1024)) ERROR("(1024U,+10)"); - mpfr_set_si_2exp (x, -1024L * 1024L, -10, GMP_RNDN); + mpfr_set_si_2exp (x, -1024L * 1024L, -10, MPFR_RNDN); if (mpfr_cmp_si(x, -1024)) ERROR("(1M,-10)"); - mpfr_set_ui_2exp (x, 0x92345678, 16, GMP_RNDN); - if (mpfr_cmp_str (x, "92345678@4", 16, GMP_RNDN)) + mpfr_set_ui_2exp (x, 0x92345678, 16, MPFR_RNDN); + if (mpfr_cmp_str (x, "92345678@4", 16, MPFR_RNDN)) ERROR("(x92345678U,+16)"); - mpfr_set_si_2exp (x, -0x1ABCDEF0, -256, GMP_RNDN); - if (mpfr_cmp_str (x, "-1ABCDEF0@-64", 16, GMP_RNDN)) + mpfr_set_si_2exp (x, -0x1ABCDEF0, -256, MPFR_RNDN); + if (mpfr_cmp_str (x, "-1ABCDEF0@-64", 16, MPFR_RNDN)) ERROR("(-x1ABCDEF0,-256)"); mpfr_set_prec (x, 2); - res = mpfr_set_si_2exp (x, 7, 10, GMP_RNDU); + res = mpfr_set_si_2exp (x, 7, 10, MPFR_RNDU); if (mpfr_cmp_ui (x, 1<<13) || res <= 0) ERROR ("Prec 2 + si_2exp"); - res = mpfr_set_ui_2exp (x, 7, 10, GMP_RNDU); + res = mpfr_set_ui_2exp (x, 7, 10, MPFR_RNDU); if (mpfr_cmp_ui (x, 1<<13) || res <= 0) ERROR ("Prec 2 + ui_2exp"); mpfr_clear_flags (); - mpfr_set_ui_2exp (x, 17, MPFR_EMAX_MAX, GMP_RNDN); + mpfr_set_ui_2exp (x, 17, MPFR_EMAX_MAX, MPFR_RNDN); if (!mpfr_inf_p (x) || MPFR_IS_NEG (x)) ERROR ("mpfr_set_ui_2exp and overflow (bad result)"); if (!mpfr_overflow_p ()) ERROR ("mpfr_set_ui_2exp and overflow (overflow flag not set)"); mpfr_clear_flags (); - mpfr_set_si_2exp (x, 17, MPFR_EMAX_MAX, GMP_RNDN); + mpfr_set_si_2exp (x, 17, MPFR_EMAX_MAX, MPFR_RNDN); if (!mpfr_inf_p (x) || MPFR_IS_NEG (x)) ERROR ("mpfr_set_si_2exp (pos) and overflow (bad result)"); if (!mpfr_overflow_p ()) ERROR ("mpfr_set_si_2exp (pos) and overflow (overflow flag not set)"); mpfr_clear_flags (); - mpfr_set_si_2exp (x, -17, MPFR_EMAX_MAX, GMP_RNDN); + mpfr_set_si_2exp (x, -17, MPFR_EMAX_MAX, MPFR_RNDN); if (!mpfr_inf_p (x) || MPFR_IS_POS (x)) ERROR ("mpfr_set_si_2exp (neg) and overflow (bad result)"); if (!mpfr_overflow_p ()) @@ -145,8 +145,8 @@ main (int argc, char *argv[]) for (k = 1; k <= N; k++) { z = (long) (randlimb () & LONG_MAX) + LONG_MIN / 2; - inex = mpfr_set_si (x, z, GMP_RNDZ); - d = mpfr_get_si (x, GMP_RNDZ); + inex = mpfr_set_si (x, z, MPFR_RNDZ); + d = mpfr_get_si (x, MPFR_RNDZ); if (d != z) { printf ("Error in mpfr_set_si: expected %ld got %ld\n", z, d); @@ -163,8 +163,8 @@ main (int argc, char *argv[]) for (k = 1; k <= N; k++) { zl = randlimb (); - inex = mpfr_set_ui (x, zl, GMP_RNDZ); - dl = mpfr_get_ui (x, GMP_RNDZ); + inex = mpfr_set_ui (x, zl, MPFR_RNDZ); + dl = mpfr_get_ui (x, MPFR_RNDZ); if (dl != zl) { printf ("Error in mpfr_set_ui: expected %lu got %lu\n", zl, dl); @@ -179,56 +179,56 @@ main (int argc, char *argv[]) } mpfr_set_prec (x, 2); - if (mpfr_set_si (x, 5, GMP_RNDZ) >= 0) + if (mpfr_set_si (x, 5, MPFR_RNDZ) >= 0) { - printf ("Wrong inexact flag for x=5, rnd=GMP_RNDZ\n"); + printf ("Wrong inexact flag for x=5, rnd=MPFR_RNDZ\n"); exit (1); } mpfr_set_prec (x, 2); - if (mpfr_set_si (x, -5, GMP_RNDZ) <= 0) + if (mpfr_set_si (x, -5, MPFR_RNDZ) <= 0) { - printf ("Wrong inexact flag for x=-5, rnd=GMP_RNDZ\n"); + printf ("Wrong inexact flag for x=-5, rnd=MPFR_RNDZ\n"); exit (1); } mpfr_set_prec (x, 3); - inex = mpfr_set_si (x, 77617, GMP_RNDD); /* should be 65536 */ + inex = mpfr_set_si (x, 77617, MPFR_RNDD); /* should be 65536 */ if (MPFR_MANT(x)[0] != ((mp_limb_t)1 << (mp_bits_per_limb-1)) || inex >= 0) { - printf ("Error in mpfr_set_si(x:3, 77617, GMP_RNDD)\n"); + printf ("Error in mpfr_set_si(x:3, 77617, MPFR_RNDD)\n"); mpfr_print_binary (x); puts (""); exit (1); } - inex = mpfr_set_ui (x, 77617, GMP_RNDD); /* should be 65536 */ + inex = mpfr_set_ui (x, 77617, MPFR_RNDD); /* should be 65536 */ if (MPFR_MANT(x)[0] != ((mp_limb_t)1 << (mp_bits_per_limb-1)) || inex >= 0) { - printf ("Error in mpfr_set_ui(x:3, 77617, GMP_RNDD)\n"); + printf ("Error in mpfr_set_ui(x:3, 77617, MPFR_RNDD)\n"); mpfr_print_binary (x); puts (""); exit (1); } mpfr_set_prec (x, 2); - inex = mpfr_set_si (x, 33096, GMP_RNDU); - if (mpfr_get_si (x, GMP_RNDZ) != 49152 || inex <= 0) + inex = mpfr_set_si (x, 33096, MPFR_RNDU); + if (mpfr_get_si (x, MPFR_RNDZ) != 49152 || inex <= 0) { printf ("Error in mpfr_set_si, exp. 49152, got %ld, inex %d\n", - mpfr_get_si (x, GMP_RNDZ), inex); + mpfr_get_si (x, MPFR_RNDZ), inex); exit (1); } - inex = mpfr_set_ui (x, 33096, GMP_RNDU); - if (mpfr_get_si (x, GMP_RNDZ) != 49152) + inex = mpfr_set_ui (x, 33096, MPFR_RNDU); + if (mpfr_get_si (x, MPFR_RNDZ) != 49152) { printf ("Error in mpfr_set_ui, exp. 49152, got %ld, inex %d\n", - mpfr_get_si (x, GMP_RNDZ), inex); + mpfr_get_si (x, MPFR_RNDZ), inex); exit (1); } - for (r = 0 ; r < GMP_RND_MAX ; r++) + for (r = 0 ; r < MPFR_RND_MAX ; r++) { mpfr_set_si (x, -1, (mp_rnd_t) r); mpfr_set_ui (x, 0, (mp_rnd_t) r); @@ -252,7 +252,7 @@ main (int argc, char *argv[]) /* check potential bug in case mp_limb_t is unsigned */ emax = mpfr_get_emax (); set_emax (0); - mpfr_set_si (x, -1, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); if (mpfr_sgn (x) >= 0) { printf ("mpfr_set_si (x, -1) fails\n"); @@ -263,7 +263,7 @@ main (int argc, char *argv[]) emax = mpfr_get_emax (); set_emax (5); mpfr_set_prec (x, 2); - mpfr_set_si (x, -31, GMP_RNDN); + mpfr_set_si (x, -31, MPFR_RNDN); if (mpfr_sgn (x) >= 0) { printf ("mpfr_set_si (x, -31) fails\n"); @@ -272,100 +272,100 @@ main (int argc, char *argv[]) set_emax (emax); /* test for get_ui */ - mpfr_set_ui (x, 0, GMP_RNDN); - MPFR_ASSERTN(mpfr_get_ui (x, GMP_RNDN) == 0); - mpfr_set_ui (x, ULONG_MAX, GMP_RNDU); + mpfr_set_ui (x, 0, MPFR_RNDN); + MPFR_ASSERTN(mpfr_get_ui (x, MPFR_RNDN) == 0); + mpfr_set_ui (x, ULONG_MAX, MPFR_RNDU); mpfr_nextabove (x); - mpfr_get_ui (x, GMP_RNDU); + mpfr_get_ui (x, MPFR_RNDU); /* another test for get_ui */ mpfr_set_prec (x, 10); mpfr_set_str_binary (x, "10.101"); - dl = mpfr_get_ui (x, GMP_RNDN); + dl = mpfr_get_ui (x, MPFR_RNDN); MPFR_ASSERTN (dl == 3); mpfr_set_str_binary (x, "-1.0"); - mpfr_get_ui (x, GMP_RNDN); + mpfr_get_ui (x, MPFR_RNDN); mpfr_set_str_binary (x, "0.1"); - dl = mpfr_get_ui (x, GMP_RNDN); + dl = mpfr_get_ui (x, MPFR_RNDN); MPFR_ASSERTN (dl == 0); - dl = mpfr_get_ui (x, GMP_RNDZ); + dl = mpfr_get_ui (x, MPFR_RNDZ); MPFR_ASSERTN (dl == 0); - dl = mpfr_get_ui (x, GMP_RNDD); + dl = mpfr_get_ui (x, MPFR_RNDD); MPFR_ASSERTN (dl == 0); - dl = mpfr_get_ui (x, GMP_RNDU); + dl = mpfr_get_ui (x, MPFR_RNDU); MPFR_ASSERTN (dl == 1); /* coverage tests */ mpfr_set_prec (x, 2); - mpfr_set_si (x, -7, GMP_RNDD); + mpfr_set_si (x, -7, MPFR_RNDD); MPFR_ASSERTN(mpfr_cmp_si (x, -8) == 0); mpfr_set_prec (x, 2); - mpfr_set_ui (x, 7, GMP_RNDU); + mpfr_set_ui (x, 7, MPFR_RNDU); MPFR_ASSERTN(mpfr_cmp_ui (x, 8) == 0); emax = mpfr_get_emax (); set_emax (3); - mpfr_set_ui (x, 7, GMP_RNDU); + mpfr_set_ui (x, 7, MPFR_RNDU); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); set_emax (1); - MPFR_ASSERTN( mpfr_set_ui (x, 7, GMP_RNDU) ); + MPFR_ASSERTN( mpfr_set_ui (x, 7, MPFR_RNDU) ); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); set_emax (emax); - mpfr_set_ui_2exp (x, 17, -50, GMP_RNDN); - MPFR_ASSERTN (mpfr_get_ui (x, GMP_RNDD) == 0); - MPFR_ASSERTN (mpfr_get_si (x, GMP_RNDD) == 0); + mpfr_set_ui_2exp (x, 17, -50, MPFR_RNDN); + MPFR_ASSERTN (mpfr_get_ui (x, MPFR_RNDD) == 0); + MPFR_ASSERTN (mpfr_get_si (x, MPFR_RNDD) == 0); /* Test for ERANGE flag + correct behaviour if overflow */ mpfr_set_prec (x, 256); - mpfr_set_ui (x, ULONG_MAX, GMP_RNDN); + mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); mpfr_clear_erangeflag (); - dl = mpfr_get_ui (x, GMP_RNDN); + dl = mpfr_get_ui (x, MPFR_RNDN); if (dl != ULONG_MAX || mpfr_erangeflag_p ()) { printf ("ERROR for get_ui + ERANGE + ULONG_MAX (1)\n"); exit (1); } - mpfr_add_ui (x, x, 1, GMP_RNDN); - dl = mpfr_get_ui (x, GMP_RNDN); + mpfr_add_ui (x, x, 1, MPFR_RNDN); + dl = mpfr_get_ui (x, MPFR_RNDN); if (dl != ULONG_MAX || !mpfr_erangeflag_p ()) { printf ("ERROR for get_ui + ERANGE + ULONG_MAX (2)\n"); exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); mpfr_clear_erangeflag (); - dl = mpfr_get_ui (x, GMP_RNDN); + dl = mpfr_get_ui (x, MPFR_RNDN); if (dl != 0 || !mpfr_erangeflag_p ()) { printf ("ERROR for get_ui + ERANGE + -1 \n"); exit (1); } - mpfr_set_si (x, LONG_MAX, GMP_RNDN); + mpfr_set_si (x, LONG_MAX, MPFR_RNDN); mpfr_clear_erangeflag (); - d = mpfr_get_si (x, GMP_RNDN); + d = mpfr_get_si (x, MPFR_RNDN); if (d != LONG_MAX || mpfr_erangeflag_p ()) { printf ("ERROR for get_si + ERANGE + LONG_MAX (1): %ld\n", d); exit (1); } - mpfr_add_ui (x, x, 1, GMP_RNDN); - d = mpfr_get_si (x, GMP_RNDN); + mpfr_add_ui (x, x, 1, MPFR_RNDN); + d = mpfr_get_si (x, MPFR_RNDN); if (d != LONG_MAX || !mpfr_erangeflag_p ()) { printf ("ERROR for get_si + ERANGE + LONG_MAX (2)\n"); exit (1); } - mpfr_set_si (x, LONG_MIN, GMP_RNDN); + mpfr_set_si (x, LONG_MIN, MPFR_RNDN); mpfr_clear_erangeflag (); - d = mpfr_get_si (x, GMP_RNDN); + d = mpfr_get_si (x, MPFR_RNDN); if (d != LONG_MIN || mpfr_erangeflag_p ()) { printf ("ERROR for get_si + ERANGE + LONG_MIN (1)\n"); exit (1); } - mpfr_sub_ui (x, x, 1, GMP_RNDN); - d = mpfr_get_si (x, GMP_RNDN); + mpfr_sub_ui (x, x, 1, MPFR_RNDN); + d = mpfr_get_si (x, MPFR_RNDN); if (d != LONG_MIN || !mpfr_erangeflag_p ()) { printf ("ERROR for get_si + ERANGE + LONG_MIN (2)\n"); @@ -377,34 +377,34 @@ main (int argc, char *argv[]) mpfr_set_emin (4); mpfr_clear_flags (); - mpfr_set_ui (x, 7, GMP_RNDU); + mpfr_set_ui (x, 7, MPFR_RNDU); flag = mpfr_underflow_p (); mpfr_set_emin (emin); if (mpfr_cmp_ui (x, 8) != 0) { - printf ("Error for mpfr_set_ui (x, 7, GMP_RNDU), prec = 2, emin = 4\n"); + printf ("Error for mpfr_set_ui (x, 7, MPFR_RNDU), prec = 2, emin = 4\n"); exit (1); } if (flag) { - printf ("mpfr_set_ui (x, 7, GMP_RNDU) should not underflow " + printf ("mpfr_set_ui (x, 7, MPFR_RNDU) should not underflow " "with prec = 2, emin = 4\n"); exit (1); } mpfr_set_emin (4); mpfr_clear_flags (); - mpfr_set_si (x, -7, GMP_RNDD); + mpfr_set_si (x, -7, MPFR_RNDD); flag = mpfr_underflow_p (); mpfr_set_emin (emin); if (mpfr_cmp_si (x, -8) != 0) { - printf ("Error for mpfr_set_si (x, -7, GMP_RNDD), prec = 2, emin = 4\n"); + printf ("Error for mpfr_set_si (x, -7, MPFR_RNDD), prec = 2, emin = 4\n"); exit (1); } if (flag) { - printf ("mpfr_set_si (x, -7, GMP_RNDD) should not underflow " + printf ("mpfr_set_si (x, -7, MPFR_RNDD) should not underflow " "with prec = 2, emin = 4\n"); exit (1); } diff --git a/tests/tset_sj.c b/tests/tset_sj.c index 98141309e..7c01a64c7 100644 --- a/tests/tset_sj.c +++ b/tests/tset_sj.c @@ -80,8 +80,8 @@ check_set_uj (mp_prec_t pmin, mp_prec_t pmax, int N) { /* mp_limb_t may be unsigned long long */ limb = (unsigned long) randlimb (); - inex1 = mpfr_set_uj (x, limb, GMP_RNDN); - inex2 = mpfr_set_ui (y, limb, GMP_RNDN); + inex1 = mpfr_set_uj (x, limb, MPFR_RNDN); + inex2 = mpfr_set_ui (y, limb, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("ERROR for mpfr_set_uj and j=%lu and p=%lu\n", @@ -101,14 +101,14 @@ check_set_uj (mp_prec_t pmin, mp_prec_t pmax, int N) } /* Special case */ mpfr_set_prec (x, sizeof(uintmax_t)*CHAR_BIT); - inex1 = mpfr_set_uj (x, UINTMAX_MAX, GMP_RNDN); + inex1 = mpfr_set_uj (x, UINTMAX_MAX, MPFR_RNDN); if (inex1 != 0 || mpfr_sgn(x) <= 0) ERROR ("inexact / UINTMAX_MAX"); - inex1 = mpfr_add_ui (x, x, 1, GMP_RNDN); + inex1 = mpfr_add_ui (x, x, 1, MPFR_RNDN); if (inex1 != 0 || !mpfr_powerof2_raw (x) || MPFR_EXP (x) != (sizeof(uintmax_t)*CHAR_BIT+1) ) ERROR ("power of 2"); - mpfr_set_uj (x, 0, GMP_RNDN); + mpfr_set_uj (x, 0, MPFR_RNDN); if (!MPFR_IS_ZERO (x)) ERROR ("Setting 0"); @@ -123,30 +123,30 @@ check_set_uj_2exp (void) mpfr_init2 (x, sizeof(uintmax_t)*CHAR_BIT); - inex = mpfr_set_uj_2exp (x, 1, 0, GMP_RNDN); + inex = mpfr_set_uj_2exp (x, 1, 0, MPFR_RNDN); if (inex || mpfr_cmp_ui(x, 1)) ERROR("(1U,0)"); - inex = mpfr_set_uj_2exp (x, 1024, -10, GMP_RNDN); + inex = mpfr_set_uj_2exp (x, 1024, -10, MPFR_RNDN); if (inex || mpfr_cmp_ui(x, 1)) ERROR("(1024U,-10)"); - inex = mpfr_set_uj_2exp (x, 1024, 10, GMP_RNDN); + inex = mpfr_set_uj_2exp (x, 1024, 10, MPFR_RNDN); if (inex || mpfr_cmp_ui(x, 1024L * 1024L)) ERROR("(1024U,+10)"); - inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, 1000, GMP_RNDN); - inex |= mpfr_div_2ui (x, x, 1000, GMP_RNDN); - inex |= mpfr_add_ui (x, x, 1, GMP_RNDN); + inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, 1000, MPFR_RNDN); + inex |= mpfr_div_2ui (x, x, 1000, MPFR_RNDN); + inex |= mpfr_add_ui (x, x, 1, MPFR_RNDN); if (inex || !mpfr_powerof2_raw (x) || MPFR_EXP (x) != (sizeof(uintmax_t)*CHAR_BIT+1) ) ERROR("(UINTMAX_MAX)"); - inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, MPFR_EMAX_MAX-10, GMP_RNDN); + inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, MPFR_EMAX_MAX-10, MPFR_RNDN); if (inex == 0 || !mpfr_inf_p (x)) ERROR ("Overflow"); - inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, MPFR_EMIN_MIN-1000, GMP_RNDN); + inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, MPFR_EMIN_MIN-1000, MPFR_RNDN); if (inex == 0 || !MPFR_IS_ZERO (x)) ERROR ("Underflow"); @@ -161,13 +161,13 @@ check_set_sj (void) mpfr_init2 (x, sizeof(intmax_t)*CHAR_BIT-1); - inex = mpfr_set_sj (x, -INTMAX_MAX, GMP_RNDN); - inex |= mpfr_add_si (x, x, -1, GMP_RNDN); + inex = mpfr_set_sj (x, -INTMAX_MAX, MPFR_RNDN); + inex |= mpfr_add_si (x, x, -1, MPFR_RNDN); if (inex || mpfr_sgn (x) >=0 || !mpfr_powerof2_raw (x) || MPFR_EXP (x) != (sizeof(intmax_t)*CHAR_BIT) ) ERROR("set_sj (-INTMAX_MAX)"); - inex = mpfr_set_sj (x, 1742, GMP_RNDN); + inex = mpfr_set_sj (x, 1742, MPFR_RNDN); if (inex || mpfr_cmp_ui (x, 1742)) ERROR ("set_sj (1742)"); @@ -182,7 +182,7 @@ check_set_sj_2exp (void) mpfr_init2 (x, sizeof(intmax_t)*CHAR_BIT-1); - inex = mpfr_set_sj_2exp (x, INTMAX_MIN, 1000, GMP_RNDN); + inex = mpfr_set_sj_2exp (x, INTMAX_MIN, 1000, MPFR_RNDN); if (inex || mpfr_sgn (x) >=0 || !mpfr_powerof2_raw (x) || MPFR_EXP (x) != (sizeof(intmax_t)*CHAR_BIT+1000) ) ERROR("set_sj_2exp (INTMAX_MIN)"); diff --git a/tests/tset_str.c b/tests/tset_str.c index 57b8847ff..dffa18aee 100644 --- a/tests/tset_str.c +++ b/tests/tset_str.c @@ -56,10 +56,10 @@ check_underflow (void) /* Check underflow */ emin = mpfr_get_emin (); set_emin (-20); - res = mpfr_set_str (a, "0.00000000001", 10, GMP_RNDZ); + res = mpfr_set_str (a, "0.00000000001", 10, MPFR_RNDZ); if (!MPFR_IS_ZERO (a)) { - printf("ERROR for mpfr_set_str (a, \"0.00000000001\", 10, GMP_RNDN)\n" + printf("ERROR for mpfr_set_str (a, \"0.00000000001\", 10, MPFR_RNDN)\n" " with emin=-20\n" "res=%d\n", res); mpfr_dump (a); @@ -70,10 +70,10 @@ check_underflow (void) /* check overflow */ emax = mpfr_get_emax (); set_emax (1073741823); /* 2^30-1 */ - mpfr_set_str (a, "2E1000000000", 10, GMP_RNDN); + mpfr_set_str (a, "2E1000000000", 10, MPFR_RNDN); if (!mpfr_inf_p (a) || mpfr_sgn (a) < 0) { - printf("ERROR for mpfr_set_str (a, \"2E1000000000\", 10, GMP_RNDN);\n"); + printf("ERROR for mpfr_set_str (a, \"2E1000000000\", 10, MPFR_RNDN);\n"); exit (1); } set_emax (emax); @@ -89,7 +89,7 @@ bug20081028 (void) const char *s = "0.10000000000000000000000000000001E1"; mpfr_init2 (x, 32); - mpfr_set_str (x, "1.00000000000000000006", 10, GMP_RNDU); + mpfr_set_str (x, "1.00000000000000000006", 10, MPFR_RNDU); if (! mpfr_greater_p (x, __gmpfr_one)) { printf ("Error in bug20081028:\nExpected %s\nGot ", s); @@ -116,8 +116,8 @@ main (int argc, char *argv[]) base = (argc >= 4) ? atoi (argv[3]) : 2; obase = (argc >= 5) ? atoi (argv[4]) : 10; mpfr_init2 (x, prec); - mpfr_set_str (x, argv[1], base, GMP_RNDN); - mpfr_out_str (stdout, obase, 0, x, GMP_RNDN); + mpfr_set_str (x, argv[1], base, MPFR_RNDN); + mpfr_out_str (stdout, obase, 0, x, MPFR_RNDN); puts (""); mpfr_clear (x); return 0; @@ -155,7 +155,7 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 54); mpfr_set_str_binary (x, "0.100100100110110101001010010101111000001011100100101010E-529"); mpfr_init2 (y, 54); - mpfr_set_str (y, "4.936a52bc17254@-133", 16, GMP_RNDN); + mpfr_set_str (y, "4.936a52bc17254@-133", 16, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (1a):\n"); @@ -169,7 +169,7 @@ main (int argc, char *argv[]) } mpfr_set_str_binary (x, "0.111111101101110010111010100110000111011001010100001101E-529"); - mpfr_set_str (y, "0.fedcba98765434P-529", 16, GMP_RNDN); + mpfr_set_str (y, "0.fedcba98765434P-529", 16, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (1b):\n"); @@ -207,11 +207,11 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str (x, "+243495834958.53452345E1", 10, GMP_RNDN); - mpfr_set_str (x, "9007199254740993", 10, GMP_RNDN); - mpfr_set_str (x, "9007199254740992", 10, GMP_RNDU); - mpfr_set_str (x, "9007199254740992", 10, GMP_RNDD); - mpfr_set_str (x, "9007199254740992", 10, GMP_RNDZ); + mpfr_set_str (x, "+243495834958.53452345E1", 10, MPFR_RNDN); + mpfr_set_str (x, "9007199254740993", 10, MPFR_RNDN); + mpfr_set_str (x, "9007199254740992", 10, MPFR_RNDU); + mpfr_set_str (x, "9007199254740992", 10, MPFR_RNDD); + mpfr_set_str (x, "9007199254740992", 10, MPFR_RNDZ); /* check a random number printed and read is not modified */ prec = 53; @@ -256,7 +256,7 @@ main (int argc, char *argv[]) for (i = 2; i <= 36; i++) { - if (mpfr_set_str (x, "@NaN@(garbage)", i, GMP_RNDN) != 0 || + if (mpfr_set_str (x, "@NaN@(garbage)", i, MPFR_RNDN) != 0 || !mpfr_nan_p(x)) { printf ("mpfr_set_str failed on @NaN@(garbage)\n"); @@ -264,21 +264,21 @@ main (int argc, char *argv[]) } /* - if (mpfr_set_str (x, "@Inf@garbage", i, GMP_RNDN) != 0 || + if (mpfr_set_str (x, "@Inf@garbage", i, MPFR_RNDN) != 0 || !mpfr_inf_p(x) || MPFR_SIGN(x) < 0) { printf ("mpfr_set_str failed on @Inf@garbage\n"); exit (1); } - if (mpfr_set_str (x, "-@Inf@garbage", i, GMP_RNDN) != 0 || + if (mpfr_set_str (x, "-@Inf@garbage", i, MPFR_RNDN) != 0 || !mpfr_inf_p(x) || MPFR_SIGN(x) > 0) { printf ("mpfr_set_str failed on -@Inf@garbage\n"); exit (1); } - if (mpfr_set_str (x, "+@Inf@garbage", i, GMP_RNDN) != 0 || + if (mpfr_set_str (x, "+@Inf@garbage", i, MPFR_RNDN) != 0 || !mpfr_inf_p(x) || MPFR_SIGN(x) < 0) { printf ("mpfr_set_str failed on +@Inf@garbage\n"); @@ -289,28 +289,28 @@ main (int argc, char *argv[]) if (i > 16) continue; - if (mpfr_set_str (x, "NaN", i, GMP_RNDN) != 0 || + if (mpfr_set_str (x, "NaN", i, MPFR_RNDN) != 0 || !mpfr_nan_p(x)) { printf ("mpfr_set_str failed on NaN\n"); exit (1); } - if (mpfr_set_str (x, "Inf", i, GMP_RNDN) != 0 || + if (mpfr_set_str (x, "Inf", i, MPFR_RNDN) != 0 || !mpfr_inf_p(x) || MPFR_SIGN(x) < 0) { printf ("mpfr_set_str failed on Inf\n"); exit (1); } - if (mpfr_set_str (x, "-Inf", i, GMP_RNDN) != 0 || + if (mpfr_set_str (x, "-Inf", i, MPFR_RNDN) != 0 || !mpfr_inf_p(x) || MPFR_SIGN(x) > 0) { printf ("mpfr_set_str failed on -Inf\n"); exit (1); } - if (mpfr_set_str (x, "+Inf", i, GMP_RNDN) != 0 || + if (mpfr_set_str (x, "+Inf", i, MPFR_RNDN) != 0 || !mpfr_inf_p(x) || MPFR_SIGN(x) < 0) { printf ("mpfr_set_str failed on +Inf\n"); @@ -320,7 +320,7 @@ main (int argc, char *argv[]) /* check that mpfr_set_str works for uppercase letters too */ mpfr_set_prec (x, 10); - mpfr_set_str (x, "B", 16, GMP_RNDN); + mpfr_set_str (x, "B", 16, MPFR_RNDN); if (mpfr_cmp_ui (x, 11) != 0) { printf ("mpfr_set_str does not work for uppercase letters\n"); @@ -333,7 +333,7 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 64); mpfr_set_prec (y, 64); mpfr_set_str_binary (x, "1.0E-532"); - mpfr_set_str (y, "0.71128279983522479470@-160", 10, GMP_RNDU); + mpfr_set_str (y, "0.71128279983522479470@-160", 10, MPFR_RNDU); if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (2):\n"); @@ -353,7 +353,7 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 64); mpfr_set_prec (y, 64); mpfr_set_str_binary (x, "1.111111111110000000000000000111111111111111111111111110000000001E184"); - mpfr_set_str (y, "0.jo08hg31hc5mmpj5mjjmgn55p2h35g@39", 27, GMP_RNDU); + mpfr_set_str (y, "0.jo08hg31hc5mmpj5mjjmgn55p2h35g@39", 27, MPFR_RNDU); /* y = 49027884868983130654865109690613178467841148597221480052 */ if (mpfr_cmp (x, y)) { @@ -370,14 +370,14 @@ main (int argc, char *argv[]) /* not exact rounding in mpfr_set_str same number with more precision is : 1.111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011011111101000001101110110010101101000010100110011101110010001110e195 this result is the same as mpfr_set_str */ - /* problem was : can_round was call with GMP_RNDN round mode, + /* problem was : can_round was call with MPFR_RNDN round mode, so can_round use an error : 1/2 * 2^err * ulp(y) instead of 2^err * ulp(y) I have increase err by 1 */ mpfr_set_prec (x, 64); /* it was round down instead of up */ mpfr_set_prec (y, 64); mpfr_set_str_binary (x, "1.111111111111111111111111111000000000000000000000000000000000001e195"); - mpfr_set_str (y, "0.6e23ekb6acgh96abk10b6c9f2ka16i@45", 21, GMP_RNDU); + mpfr_set_str (y, "0.6e23ekb6acgh96abk10b6c9f2ka16i@45", 21, MPFR_RNDU); /* y = 100433627392042473064661483711179345482301462325708736552078 */ if (mpfr_cmp (x, y)) { @@ -396,7 +396,7 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 64); /* it was round down instead of up */ mpfr_set_prec (y, 64); mpfr_set_str_binary (x, "1.111111100000001111110000000000011111011111111111111111111111111e180"); - mpfr_set_str (y, "0.10j8j2k82ehahha56390df0a1de030@41", 23, GMP_RNDZ); + mpfr_set_str (y, "0.10j8j2k82ehahha56390df0a1de030@41", 23, MPFR_RNDZ); /* y = 3053110535624388280648330929253842828159081875986159414 */ if (mpfr_cmp (x, y)) { @@ -412,7 +412,7 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 64); mpfr_set_prec (y, 64); - mpfr_set_str (y, "0.jrchfhpp9en7hidqm9bmcofid9q3jg@39", 28, GMP_RNDU); + mpfr_set_str (y, "0.jrchfhpp9en7hidqm9bmcofid9q3jg@39", 28, MPFR_RNDU); /* y = 196159429139499688661464718784226062699788036696626429952 */ mpfr_set_str_binary (x, "0.1111111111111111111111111111111000000000000011100000001111100001E187"); if (mpfr_cmp (x, y)) @@ -429,7 +429,7 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 64); mpfr_set_prec (y, 64); - mpfr_set_str (y, "0.h148m5ld5cf8gk1kd70b6ege92g6ba@47", 24, GMP_RNDZ); + mpfr_set_str (y, "0.h148m5ld5cf8gk1kd70b6ege92g6ba@47", 24, MPFR_RNDZ); /* y = 52652933527468502324759448399183654588831274530295083078827114496 */ mpfr_set_str_binary (x, "0.1111111111111100000000001000000000000000000011111111111111101111E215"); if (mpfr_cmp (x, y)) @@ -448,7 +448,7 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); - mpfr_set_str (y, "5e125", 10, GMP_RNDN); + mpfr_set_str (y, "5e125", 10, MPFR_RNDN); mpfr_set_str_binary (x, "0.10111101000101110110011000100000101001010000000111111E418"); if (mpfr_cmp (x, y)) { @@ -462,7 +462,7 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str (y, "69e267", 10, GMP_RNDN); + mpfr_set_str (y, "69e267", 10, MPFR_RNDN); mpfr_set_str_binary (x, "0.10000101101111100101101100000110010011001010011011010E894"); if (mpfr_cmp (x, y)) { @@ -476,7 +476,7 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str (y, "623e100", 10, GMP_RNDN); + mpfr_set_str (y, "623e100", 10, MPFR_RNDN); mpfr_set_str_binary (x, "0.10110010000001010011000101111001110101000001111011111E342"); if (mpfr_cmp (x, y)) { @@ -490,7 +490,7 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str (y, "3571e263", 10, GMP_RNDN); + mpfr_set_str (y, "3571e263", 10, MPFR_RNDN); mpfr_set_str_binary (x, "0.10110001001100100010011000110000111010100000110101010E886"); if (mpfr_cmp (x, y)) { @@ -504,7 +504,7 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str (y, "75569e-254", 10, GMP_RNDN); + mpfr_set_str (y, "75569e-254", 10, MPFR_RNDN); mpfr_set_str_binary (x, "0.10101101001000110001011011001000111000110101010110011E-827"); if (mpfr_cmp (x, y)) { @@ -518,7 +518,7 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str (y, "920657e-23", 10, GMP_RNDN); + mpfr_set_str (y, "920657e-23", 10, MPFR_RNDN); mpfr_set_str_binary (x, "0.10101001110101001100110000101110110111101111001101100E-56"); if (mpfr_cmp (x, y)) { @@ -532,7 +532,7 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str (y, "9210917e80", 10, GMP_RNDN); + mpfr_set_str (y, "9210917e80", 10, MPFR_RNDN); mpfr_set_str_binary (x, "0.11101101000100011001000110100011111100110000000110010E289"); if (mpfr_cmp (x, y)) { @@ -546,7 +546,7 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str (y, "87575437e-309", 10, GMP_RNDN); + mpfr_set_str (y, "87575437e-309", 10, MPFR_RNDN); mpfr_set_str_binary (x, "0.11110000001110011001000000110000000100000010101101100E-1000"); if (mpfr_cmp (x, y)) { @@ -560,7 +560,7 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str (y, "245540327e122", 10, GMP_RNDN); + mpfr_set_str (y, "245540327e122", 10, MPFR_RNDN); mpfr_set_str_binary (x, "0.10001101101100010001100011110000110001100010111001011E434"); if (mpfr_cmp (x, y)) { @@ -574,7 +574,7 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str (y, "491080654e122", 10, GMP_RNDN); + mpfr_set_str (y, "491080654e122", 10, MPFR_RNDN); mpfr_set_str_binary (x, "0.10001101101100010001100011110000110001100010111001011E435"); if (mpfr_cmp (x, y)) { @@ -588,7 +588,7 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str (y, "83356057653e193", 10, GMP_RNDN); + mpfr_set_str (y, "83356057653e193", 10, MPFR_RNDN); mpfr_set_str_binary (x, "0.10101010001001110011011011010111011100010101000011000E678"); if (mpfr_cmp (x, y)) { @@ -602,150 +602,150 @@ main (int argc, char *argv[]) exit (1); } - CHECK53(y, "83356057653e193", GMP_RNDN, x, + CHECK53(y, "83356057653e193", MPFR_RNDN, x, "0.10101010001001110011011011010111011100010101000011000E678", 18); - CHECK53(y, "619534293513e124", GMP_RNDN, x, + CHECK53(y, "619534293513e124", MPFR_RNDN, x, "0.10001000011000010000000110000001111111110000011110001e452", 19); - CHECK53(y, "3142213164987e-294", GMP_RNDN, x, + CHECK53(y, "3142213164987e-294", MPFR_RNDN, x, "0.11101001101000000100111011111101111001010001001101111e-935", 20); - CHECK53(y, "36167929443327e-159", GMP_RNDN, x, + CHECK53(y, "36167929443327e-159", MPFR_RNDN, x, "0.11100111001110111110000101011001100110010100011111100e-483", 21); - CHECK53(y, "904198236083175e-161", GMP_RNDN, x, + CHECK53(y, "904198236083175e-161", MPFR_RNDN, x, "0.11100111001110111110000101011001100110010100011111100e-485", 22); - CHECK53(y, "3743626360493413e-165", GMP_RNDN, x, + CHECK53(y, "3743626360493413e-165", MPFR_RNDN, x, "0.11000100000100011101001010111101011011011111011111001e-496", 23); - CHECK53(y, "94080055902682397e-242", GMP_RNDN, x, + CHECK53(y, "94080055902682397e-242", MPFR_RNDN, x, "0.10110010010011000000111100011100111100110011011001010e-747", 24); - CHECK53(y, "7e-303", GMP_RNDD, x, + CHECK53(y, "7e-303", MPFR_RNDD, x, "0.10011001100111001000100110001110001000110111110001011e-1003", 25); - CHECK53(y, "7e-303", GMP_RNDU, x, + CHECK53(y, "7e-303", MPFR_RNDU, x, "0.10011001100111001000100110001110001000110111110001100e-1003", 26); - CHECK53(y, "93e-234", GMP_RNDD, x, + CHECK53(y, "93e-234", MPFR_RNDD, x, "0.10010011110110010111001001111001000010000000001110101E-770", 27); - CHECK53(y, "93e-234", GMP_RNDU, x, + CHECK53(y, "93e-234", MPFR_RNDU, x, "0.10010011110110010111001001111001000010000000001110110E-770", 28); - CHECK53(y, "755e174", GMP_RNDD, x, + CHECK53(y, "755e174", MPFR_RNDD, x, "0.10111110110010011000110010011111101111000111111000101E588", 29); - CHECK53(y, "755e174", GMP_RNDU, x, + CHECK53(y, "755e174", MPFR_RNDU, x, "0.10111110110010011000110010011111101111000111111000110E588", 30); - CHECK53(y, "8699e-276", GMP_RNDD, x, + CHECK53(y, "8699e-276", MPFR_RNDD, x, "0.10010110100101101111100100100011011101100110100101100E-903", 31); - CHECK53(y, "8699e-276", GMP_RNDU, x, + CHECK53(y, "8699e-276", MPFR_RNDU, x, "0.10010110100101101111100100100011011101100110100101101E-903", 32); - CHECK53(y, "82081e41", GMP_RNDD, x, + CHECK53(y, "82081e41", MPFR_RNDD, x, "0.10111000000010000010111011111001111010100011111001011E153", 33); - CHECK53(y, "82081e41", GMP_RNDU, x, + CHECK53(y, "82081e41", MPFR_RNDU, x, "0.10111000000010000010111011111001111010100011111001100E153", 34); - CHECK53(y, "584169e229", GMP_RNDD, x, + CHECK53(y, "584169e229", MPFR_RNDD, x, "0.11101011001010111000001011001110111000111100110101010E780", 35); - CHECK53(y, "584169e229", GMP_RNDU, x, + CHECK53(y, "584169e229", MPFR_RNDU, x, "0.11101011001010111000001011001110111000111100110101011E780", 36); - CHECK53(y, "5783893e-128", GMP_RNDD, x, + CHECK53(y, "5783893e-128", MPFR_RNDD, x, "0.10011000111100000110011110000101100111110011101110100E-402", 37); - CHECK53(y, "5783893e-128", GMP_RNDU, x, + CHECK53(y, "5783893e-128", MPFR_RNDU, x, "0.10011000111100000110011110000101100111110011101110101E-402", 38); - CHECK53(y, "87575437e-310", GMP_RNDD, x, + CHECK53(y, "87575437e-310", MPFR_RNDD, x, "0.11000000001011100000110011110011010000000010001010110E-1003", 39); - CHECK53(y, "87575437e-310", GMP_RNDU, x, + CHECK53(y, "87575437e-310", MPFR_RNDU, x, "0.11000000001011100000110011110011010000000010001010111E-1003", 40); - CHECK53(y, "245540327e121", GMP_RNDD, x, + CHECK53(y, "245540327e121", MPFR_RNDD, x, "0.11100010101101001111010010110100011100000100101000100E430", 41); - CHECK53(y, "245540327e121", GMP_RNDU, x, + CHECK53(y, "245540327e121", MPFR_RNDU, x, "0.11100010101101001111010010110100011100000100101000101E430", 42); - CHECK53(y, "9078555839e-109", GMP_RNDD, x, + CHECK53(y, "9078555839e-109", MPFR_RNDD, x, "0.11111110001010111010110000110011100110001010011101101E-329", 43); - CHECK53(y, "9078555839e-109", GMP_RNDU, x, + CHECK53(y, "9078555839e-109", MPFR_RNDU, x, "0.11111110001010111010110000110011100110001010011101110E-329", 44); - CHECK53(y, "42333842451e201", GMP_RNDD, x, + CHECK53(y, "42333842451e201", MPFR_RNDD, x, "0.10000000110001001101000100110110111110101011101011111E704", 45); - CHECK53(y, "42333842451e201", GMP_RNDU, x, + CHECK53(y, "42333842451e201", MPFR_RNDU, x, "0.10000000110001001101000100110110111110101011101100000E704", 46); - CHECK53(y, "778380362293e218", GMP_RNDD, x, + CHECK53(y, "778380362293e218", MPFR_RNDD, x, "0.11001101010111000001001100001100110010000001010010010E764", 47); - CHECK53(y, "778380362293e218", GMP_RNDU, x, + CHECK53(y, "778380362293e218", MPFR_RNDU, x, "0.11001101010111000001001100001100110010000001010010011E764", 48); - CHECK53(y, "7812878489261e-179", GMP_RNDD, x, + CHECK53(y, "7812878489261e-179", MPFR_RNDD, x, "0.10010011011011010111001111011101111101101101001110100E-551", 49); - CHECK53(y, "7812878489261e-179", GMP_RNDU, x, + CHECK53(y, "7812878489261e-179", MPFR_RNDU, x, "0.10010011011011010111001111011101111101101101001110101E-551", 50); - CHECK53(y, "77003665618895e-73", GMP_RNDD, x, + CHECK53(y, "77003665618895e-73", MPFR_RNDD, x, "0.11000101111110111111001111111101001101111000000101001E-196", 51); - CHECK53(y, "77003665618895e-73", GMP_RNDU, x, + CHECK53(y, "77003665618895e-73", MPFR_RNDU, x, "0.11000101111110111111001111111101001101111000000101010E-196", 52); - CHECK53(y, "834735494917063e-300", GMP_RNDD, x, + CHECK53(y, "834735494917063e-300", MPFR_RNDD, x, "0.11111110001101100001001101111100010011001110111010001E-947", 53); - CHECK53(y, "834735494917063e-300", GMP_RNDU, x, + CHECK53(y, "834735494917063e-300", MPFR_RNDU, x, "0.11111110001101100001001101111100010011001110111010010E-947", 54); - CHECK53(y, "6182410494241627e-119", GMP_RNDD, x, + CHECK53(y, "6182410494241627e-119", MPFR_RNDD, x, "0.10001101110010110010001011000010001000101110100000111E-342", 55); - CHECK53(y, "6182410494241627e-119", GMP_RNDU, x, + CHECK53(y, "6182410494241627e-119", MPFR_RNDU, x, "0.10001101110010110010001011000010001000101110100001000E-342", 56); - CHECK53(y, "26153245263757307e49", GMP_RNDD, x, + CHECK53(y, "26153245263757307e49", MPFR_RNDD, x, "0.10011110111100000000001011011110101100010000011011110E218", 57); - CHECK53(y, "26153245263757307e49", GMP_RNDU, x, + CHECK53(y, "26153245263757307e49", MPFR_RNDU, x, "0.10011110111100000000001011011110101100010000011011111E218", 58); @@ -758,7 +758,7 @@ main (int argc, char *argv[]) size_t nb_digit = mp_bits_per_limb; mp_limb_t check_limb[2] = {MPFR_LIMB_HIGHBIT, ~(MPFR_LIMB_HIGHBIT >> 1)}; int base[3] = {10, 16, 19}; - mp_rnd_t rnd[3] = {GMP_RNDU, GMP_RNDN, GMP_RNDD}; + mp_rnd_t rnd[3] = {MPFR_RNDU, MPFR_RNDN, MPFR_RNDD}; int cbase, climb, crnd; char *str; @@ -767,7 +767,7 @@ main (int argc, char *argv[]) str = (char*) (*__gmp_allocate_func) (N + 20); - mpfr_set_ui (x, 1, GMP_RNDN); /* ensures that x is not NaN or Inf */ + mpfr_set_ui (x, 1, MPFR_RNDN); /* ensures that x is not NaN or Inf */ for (; nb_digit < N; nb_digit *= 10) for (cbase = 0; cbase < 3; cbase++) for (climb = 0; climb < 2; climb++) @@ -813,13 +813,13 @@ main (int argc, char *argv[]) /* check that flags are correctly cleared */ mpfr_set_nan (x); - mpfr_set_str (x, "+0.0", 10, GMP_RNDN); + mpfr_set_str (x, "+0.0", 10, MPFR_RNDN); if (!mpfr_number_p(x) || mpfr_cmp_ui (x, 0) != 0 || mpfr_sgn (x) < 0) { printf ("x <- +0.0 failed after x=NaN\n"); exit (1); } - mpfr_set_str (x, "-0.0", 10, GMP_RNDN); + mpfr_set_str (x, "-0.0", 10, MPFR_RNDN); if (!mpfr_number_p(x) || mpfr_cmp_ui (x, 0) != 0 || mpfr_sgn (x) > 0) { printf ("x <- -0.0 failed after x=NaN\n"); @@ -827,24 +827,24 @@ main (int argc, char *argv[]) } /* check invalid input */ - ret = mpfr_set_str (x, "1E10toto", 10, GMP_RNDN); + ret = mpfr_set_str (x, "1E10toto", 10, MPFR_RNDN); MPFR_ASSERTN (ret == -1); - ret = mpfr_set_str (x, "1p10toto", 16, GMP_RNDN); + ret = mpfr_set_str (x, "1p10toto", 16, MPFR_RNDN); MPFR_ASSERTN (ret == -1); - ret = mpfr_set_str (x, "", 16, GMP_RNDN); + ret = mpfr_set_str (x, "", 16, MPFR_RNDN); MPFR_ASSERTN (ret == -1); - ret = mpfr_set_str (x, "+", 16, GMP_RNDN); + ret = mpfr_set_str (x, "+", 16, MPFR_RNDN); MPFR_ASSERTN (ret == -1); - ret = mpfr_set_str (x, "-", 16, GMP_RNDN); + ret = mpfr_set_str (x, "-", 16, MPFR_RNDN); MPFR_ASSERTN (ret == -1); - ret = mpfr_set_str (x, "this_is_an_invalid_number_in_base_36", 36, GMP_RNDN); + ret = mpfr_set_str (x, "this_is_an_invalid_number_in_base_36", 36, MPFR_RNDN); MPFR_ASSERTN (ret == -1); - ret = mpfr_set_str (x, "1.2.3", 10, GMP_RNDN); + ret = mpfr_set_str (x, "1.2.3", 10, MPFR_RNDN); MPFR_ASSERTN (ret == -1); mpfr_set_prec (x, 135); - ret = mpfr_set_str (x, "thisisavalidnumberinbase36", 36, GMP_RNDN); + ret = mpfr_set_str (x, "thisisavalidnumberinbase36", 36, MPFR_RNDN); mpfr_set_prec (y, 135); - mpfr_set_str (y, "23833565676460972739462619524519814462546", 10, GMP_RNDN); + mpfr_set_str (y, "23833565676460972739462619524519814462546", 10, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp (x, y) == 0 && ret == 0); /* coverage test for set_str_binary */ diff --git a/tests/tset_z.c b/tests/tset_z.c index 1db6c2796..f46387eda 100644 --- a/tests/tset_z.c +++ b/tests/tset_z.c @@ -36,7 +36,7 @@ static void check0(void) mpfr_init (x); mpz_init (y); mpz_set_si (y, 0); - for(r = 0; r < GMP_RND_MAX; r++) + for(r = 0; r < MPFR_RND_MAX; r++) { inexact = mpfr_set_z (x, y, (mp_rnd_t) r); if (!MPFR_IS_ZERO(x) || !MPFR_IS_POS(x) || inexact) @@ -64,7 +64,7 @@ check (long i, mp_rnd_t rnd) mpz_init (z); mpz_set_ui (z, i); mpfr_set_z (f, z, rnd); - if (mpfr_get_si (f, GMP_RNDZ) != i) + if (mpfr_get_si (f, MPFR_RNDZ) != i) { printf ("Error in mpfr_set_z for i=%ld rnd_mode=%d\n", i, rnd); exit (1); @@ -85,7 +85,7 @@ check_large (void) mpfr_init2 (y, 160); mpz_set_str (z, "77031627725494291259359895954016675357279104942148788042", 10); - mpfr_set_z (x, z, GMP_RNDN); + mpfr_set_z (x, z, MPFR_RNDN); mpfr_set_str_binary (y, "0.1100100100001111110110101010001000100001011010001100001000110100110001001100011001100010100010111000000011011100000111001101000100101001000000100100111000001001E186"); if (mpfr_cmp (x, y)) { @@ -97,12 +97,12 @@ check_large (void) emax = mpfr_get_emax (); set_emax (2); mpz_set_str (z, "7", 10); - mpfr_set_z (x, z, GMP_RNDU); + mpfr_set_z (x, z, MPFR_RNDU); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); set_emax (3); mpfr_set_prec (x, 2); mpz_set_str (z, "7", 10); - mpfr_set_z (x, z, GMP_RNDU); + mpfr_set_z (x, z, MPFR_RNDU); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); set_emax (emax); @@ -110,10 +110,10 @@ check_large (void) emin = mpfr_get_emin (); set_emin (3); mpz_set_str (z, "1", 10); - mpfr_set_z (x, z, GMP_RNDZ); + mpfr_set_z (x, z, MPFR_RNDZ); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x)); set_emin (2); - mpfr_set_z (x, z, GMP_RNDN); + mpfr_set_z (x, z, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x)); set_emin (emin); @@ -131,7 +131,7 @@ main (int argc, char *argv[]) tests_start_mpfr (); check_large (); - check (0, GMP_RNDN); + check (0, MPFR_RNDN); for (j = 0; j < 200000; j++) check (randlimb () & LONG_MAX, RND_RAND ()); check0 (); diff --git a/tests/tsi_op.c b/tests/tsi_op.c index 47af9668f..f709b0696 100644 --- a/tests/tsi_op.c +++ b/tests/tsi_op.c @@ -30,7 +30,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., {\ printf("Error for "s" and i=%d\n", i);\ printf("Expected %s\n", exp);\ - printf("Got "); mpfr_out_str (stdout, 16, 0, z, GMP_RNDN);\ + printf("Got "); mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);\ putchar ('\n');\ exit(1);\ } @@ -55,8 +55,8 @@ check_invert (void) mpfr_t x; mpfr_init2 (x, MPFR_PREC_MIN); - mpfr_set_ui (x, 0xC, GMP_RNDN); - mpfr_si_sub (x, -1, x, GMP_RNDD); /* -0001 - 1100 = - 1101 --> -1 0000 */ + mpfr_set_ui (x, 0xC, MPFR_RNDN); + mpfr_si_sub (x, -1, x, MPFR_RNDD); /* -0001 - 1100 = - 1101 --> -1 0000 */ if (mpfr_cmp_si (x, -0x10) ) { printf ("Special rounding error\n"); @@ -105,30 +105,30 @@ main (int argc, char *argv[]) mpfr_inits2 (53, x, z, (mpfr_ptr) 0); for(i = 0 ; i < numberof (tab) ; i++) { - mpfr_set_str (x, tab[i].op1, 16, GMP_RNDN); + mpfr_set_str (x, tab[i].op1, 16, MPFR_RNDN); y = tab[i].op2; - mpfr_add_si (z, x, y, GMP_RNDZ); - if (mpfr_cmp_str (z, tab[i].res_add, 16, GMP_RNDN)) + mpfr_add_si (z, x, y, MPFR_RNDZ); + if (mpfr_cmp_str (z, tab[i].res_add, 16, MPFR_RNDN)) ERROR1("add_si", i, z, tab[i].res_add); - mpfr_sub_si (z, x, y, GMP_RNDZ); - if (mpfr_cmp_str (z, tab[i].res_sub, 16, GMP_RNDN)) + mpfr_sub_si (z, x, y, MPFR_RNDZ); + if (mpfr_cmp_str (z, tab[i].res_sub, 16, MPFR_RNDN)) ERROR1("sub_si", i, z, tab[i].res_sub); - mpfr_si_sub (z, y, x, GMP_RNDZ); - mpfr_neg (z, z, GMP_RNDZ); - if (mpfr_cmp_str (z, tab[i].res_sub, 16, GMP_RNDN)) + mpfr_si_sub (z, y, x, MPFR_RNDZ); + mpfr_neg (z, z, MPFR_RNDZ); + if (mpfr_cmp_str (z, tab[i].res_sub, 16, MPFR_RNDN)) ERROR1("si_sub", i, z, tab[i].res_sub); - mpfr_mul_si (z, x, y, GMP_RNDZ); - if (mpfr_cmp_str (z, tab[i].res_mul, 16, GMP_RNDN)) + mpfr_mul_si (z, x, y, MPFR_RNDZ); + if (mpfr_cmp_str (z, tab[i].res_mul, 16, MPFR_RNDN)) ERROR1("mul_si", i, z, tab[i].res_mul); - mpfr_div_si (z, x, y, GMP_RNDZ); - if (mpfr_cmp_str (z, tab[i].res_div, 16, GMP_RNDN)) + mpfr_div_si (z, x, y, MPFR_RNDZ); + if (mpfr_cmp_str (z, tab[i].res_div, 16, MPFR_RNDN)) ERROR1("div_si", i, z, tab[i].res_div); } mpfr_set_str1 (x, "1"); - mpfr_si_div (z, 1024, x, GMP_RNDN); + mpfr_si_div (z, 1024, x, MPFR_RNDN); if (mpfr_cmp_str1 (z, "1024")) ERROR1("si_div", i, z, "1024"); - mpfr_si_div (z, -1024, x, GMP_RNDN); + mpfr_si_div (z, -1024, x, MPFR_RNDN); if (mpfr_cmp_str1 (z, "-1024")) ERROR1("si_div", i, z, "-1024"); diff --git a/tests/tsin.c b/tests/tsin.c index d9670317c..df662d503 100644 --- a/tests/tsin.c +++ b/tests/tsin.c @@ -31,7 +31,7 @@ static int test_sin (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode) { int res; - int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53; + int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53; if (ok) { mpfr_print_raw (b); @@ -63,7 +63,7 @@ check53 (const char *xs, const char *sin_xs, mp_rnd_t rnd_mode) printf ("mpfr_sin failed for x=%s, rnd=%s\n", xs, mpfr_print_rnd_mode (rnd_mode)); printf ("mpfr_sin gives sin(x)="); - mpfr_out_str (stdout, 10, 0, s, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, s, MPFR_RNDN); printf (", expected %s\n", sin_xs); exit (1); } @@ -78,14 +78,14 @@ check53b (const char *xs, const char *sin_xs, mp_rnd_t rnd_mode) mpfr_init2 (xx, 53); mpfr_init2 (s, 53); - mpfr_set_str (xx, xs, 2, GMP_RNDN); /* should be exact */ + mpfr_set_str (xx, xs, 2, MPFR_RNDN); /* should be exact */ test_sin (s, xx, rnd_mode); - if (mpfr_cmp_str (s, sin_xs, 2, GMP_RNDN)) + if (mpfr_cmp_str (s, sin_xs, 2, MPFR_RNDN)) { printf ("mpfr_sin failed in rounding mode %s for\n x = %s\n", mpfr_print_rnd_mode (rnd_mode), xs); printf (" got "); - mpfr_out_str (stdout, 2, 0, s, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN); printf ("\nexpected %s\n", sin_xs); exit (1); } @@ -100,17 +100,17 @@ test_sign (void) int p, k; mpfr_init2 (pid, 4096); - mpfr_const_pi (pid, GMP_RNDD); + mpfr_const_pi (pid, MPFR_RNDD); mpfr_init2 (piu, 4096); - mpfr_const_pi (piu, GMP_RNDU); + mpfr_const_pi (piu, MPFR_RNDU); mpfr_init (x); mpfr_init2 (y, 2); for (p = 8; p <= 128; p++) for (k = 2; k <= 6; k += 2) { mpfr_set_prec (x, p); - mpfr_mul_ui (x, pid, k, GMP_RNDD); - test_sin (y, x, GMP_RNDN); + mpfr_mul_ui (x, pid, k, MPFR_RNDD); + test_sin (y, x, MPFR_RNDN); if (MPFR_SIGN(y) > 0) { printf ("Error in test_sign for sin(%dpi-epsilon), prec = %d" @@ -118,8 +118,8 @@ test_sign (void) k, p); exit (1); } - mpfr_mul_ui (x, piu, k, GMP_RNDU); - test_sin (y, x, GMP_RNDN); + mpfr_mul_ui (x, piu, k, MPFR_RNDU); + test_sin (y, x, MPFR_RNDN); if (MPFR_SIGN(y) < 0) { printf ("Error in test_sign for sin(%dpi+epsilon), prec = %d" @@ -132,15 +132,15 @@ test_sign (void) /* worst case on 53 bits */ mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); - mpfr_set_str (x, "6134899525417045", 10, GMP_RNDN); - test_sin (y, x, GMP_RNDN); + mpfr_set_str (x, "6134899525417045", 10, MPFR_RNDN); + test_sin (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "11011010111101011110111100010101010101110000000001011E-106"); MPFR_ASSERTN(mpfr_cmp (x, y) == 0); /* Bug on Special cases */ mpfr_set_str_binary (x, "0.100011011010111101E-32"); - test_sin (y, x, GMP_RNDN); - if (mpfr_cmp_str (y, "0.10001101101011110100000000000000000000000000000000000E-32", 2, GMP_RNDN)) + test_sin (y, x, MPFR_RNDN); + if (mpfr_cmp_str (y, "0.10001101101011110100000000000000000000000000000000000E-32", 2, MPFR_RNDN)) { printf("sin special 97 error:\nx="); mpfr_dump (x); printf("y="); @@ -152,7 +152,7 @@ test_sign (void) mpfr_set_prec (y, 53); mpfr_set_str_binary (x, "1.1001001000011111101101010100010001000010110100010011"); mpfr_set_str_binary (y, "1.1111111111111111111111111111111111111111111111111111e-1"); - test_sin (x, x, GMP_RNDZ); + test_sin (x, x, MPFR_RNDZ); MPFR_ASSERTN(mpfr_cmp (x, y) == 0); mpfr_clear (pid); @@ -170,7 +170,7 @@ check_nans (void) mpfr_init2 (y, 123L); mpfr_set_nan (x); - test_sin (y, x, GMP_RNDN); + test_sin (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: sin(NaN) != NaN\n"); @@ -178,7 +178,7 @@ check_nans (void) } mpfr_set_inf (x, 1); - test_sin (y, x, GMP_RNDN); + test_sin (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: sin(Inf) != NaN\n"); @@ -186,7 +186,7 @@ check_nans (void) } mpfr_set_inf (x, -1); - test_sin (y, x, GMP_RNDN); + test_sin (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: sin(-Inf) != NaN\n"); @@ -213,11 +213,11 @@ check_regression (void) p = strlen (xs) - 2 - 3; mpfr_inits2 (p, x, y, (mpfr_ptr) 0); - mpfr_set_str (x, xs, 2, GMP_RNDN); - i = mpfr_sin (y, x, GMP_RNDN); + mpfr_set_str (x, xs, 2, MPFR_RNDN); + i = mpfr_sin (y, x, MPFR_RNDN); if (i >= 0 || mpfr_cmp_str (y, "0.111001110011110011110001010110011101110E-1", - 2, GMP_RNDN)) + 2, MPFR_RNDN)) { printf ("Regression test failed (1) i=%d\ny=", i); mpfr_dump (y); @@ -235,33 +235,33 @@ check_tiny (void) mpfr_init2 (x, 53); mpfr_init2 (y, 53); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_set_exp (x, mpfr_get_emin ()); - mpfr_sin (y, x, GMP_RNDD); + mpfr_sin (y, x, MPFR_RNDD); if (mpfr_cmp (x, y) < 0) { printf ("Error in check_tiny: got sin(x) > x for x = 2^(emin-1)\n"); exit (1); } - mpfr_sin (y, x, GMP_RNDU); - mpfr_mul_2ui (y, y, 1, GMP_RNDU); + mpfr_sin (y, x, MPFR_RNDU); + mpfr_mul_2ui (y, y, 1, MPFR_RNDU); if (mpfr_cmp (x, y) > 0) { printf ("Error in check_tiny: got sin(x) < x/2 for x = 2^(emin-1)\n"); exit (1); } - mpfr_neg (x, x, GMP_RNDN); - mpfr_sin (y, x, GMP_RNDU); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_sin (y, x, MPFR_RNDU); if (mpfr_cmp (x, y) > 0) { printf ("Error in check_tiny: got sin(x) < x for x = -2^(emin-1)\n"); exit (1); } - mpfr_sin (y, x, GMP_RNDD); - mpfr_mul_2ui (y, y, 1, GMP_RNDD); + mpfr_sin (y, x, MPFR_RNDD); + mpfr_mul_2ui (y, y, 1, MPFR_RNDD); if (mpfr_cmp (x, y) < 0) { printf ("Error in check_tiny: got sin(x) > x/2 for x = -2^(emin-1)\n"); @@ -283,38 +283,38 @@ main (int argc, char *argv[]) check_nans (); /* worst case from PhD thesis of Vincent Lefe`vre: x=8980155785351021/2^54 */ - check53 ("4.984987858808754279e-1", "4.781075595393330379e-1", GMP_RNDN); - check53 ("4.984987858808754279e-1", "4.781075595393329824e-1", GMP_RNDD); - check53 ("4.984987858808754279e-1", "4.781075595393329824e-1", GMP_RNDZ); - check53 ("4.984987858808754279e-1", "4.781075595393330379e-1", GMP_RNDU); - check53 ("1.00031274099908640274", "8.416399183372403892e-1", GMP_RNDN); - check53 ("1.00229256850978698523", "8.427074524447979442e-1", GMP_RNDZ); - check53 ("1.00288304857059840103", "8.430252033025980029e-1", GMP_RNDZ); - check53 ("1.00591265847407274059", "8.446508805292128885e-1", GMP_RNDN); + check53 ("4.984987858808754279e-1", "4.781075595393330379e-1", MPFR_RNDN); + check53 ("4.984987858808754279e-1", "4.781075595393329824e-1", MPFR_RNDD); + check53 ("4.984987858808754279e-1", "4.781075595393329824e-1", MPFR_RNDZ); + check53 ("4.984987858808754279e-1", "4.781075595393330379e-1", MPFR_RNDU); + check53 ("1.00031274099908640274", "8.416399183372403892e-1", MPFR_RNDN); + check53 ("1.00229256850978698523", "8.427074524447979442e-1", MPFR_RNDZ); + check53 ("1.00288304857059840103", "8.430252033025980029e-1", MPFR_RNDZ); + check53 ("1.00591265847407274059", "8.446508805292128885e-1", MPFR_RNDN); /* Other worst cases showing a bug introduced on 2005-01-29 in rev 3248 */ check53b ("1.0111001111010111010111111000010011010001110001111011e-21", "1.0111001111010111010111111000010011010001101001110001e-21", - GMP_RNDU); + MPFR_RNDU); check53b ("1.1011101111111010000001010111000010000111100100101101", "1.1111100100101100001111100000110011110011010001010101e-1", - GMP_RNDU); + MPFR_RNDU); mpfr_init2 (x, 2); - mpfr_set_str (x, "0.5", 10, GMP_RNDN); - test_sin (x, x, GMP_RNDD); + mpfr_set_str (x, "0.5", 10, MPFR_RNDN); + test_sin (x, x, MPFR_RNDD); if (mpfr_cmp_ui_2exp (x, 3, -3)) /* x != 0.375 = 3/8 */ { - printf ("mpfr_sin(0.5, GMP_RNDD) failed with precision=2\n"); + printf ("mpfr_sin(0.5, MPFR_RNDD) failed with precision=2\n"); exit (1); } /* bug found by Kevin Ryde */ - mpfr_const_pi (x, GMP_RNDN); - mpfr_mul_ui (x, x, 3L, GMP_RNDN); - mpfr_div_ui (x, x, 2L, GMP_RNDN); - test_sin (x, x, GMP_RNDN); + mpfr_const_pi (x, MPFR_RNDN); + mpfr_mul_ui (x, x, 3L, MPFR_RNDN); + mpfr_div_ui (x, x, 2L, MPFR_RNDN); + test_sin (x, x, MPFR_RNDN); if (mpfr_cmp_ui (x, 0) >= 0) { printf ("Error: wrong sign for sin(3*Pi/2)\n"); @@ -323,13 +323,13 @@ main (int argc, char *argv[]) /* Can fail on an assert */ mpfr_set_prec (x, 53); - mpfr_set_str (x, "77291789194529019661184401408", 10, GMP_RNDN); + mpfr_set_str (x, "77291789194529019661184401408", 10, MPFR_RNDN); mpfr_init2 (c, 4); mpfr_init2 (s, 42); mpfr_init2 (c2, 4); mpfr_init2 (s2, 42); - test_sin (s, x, GMP_RNDN); - mpfr_cos (c, x, GMP_RNDN); - mpfr_sin_cos (s2, c2, x, GMP_RNDN); + test_sin (s, x, MPFR_RNDN); + mpfr_cos (c, x, MPFR_RNDN); + mpfr_sin_cos (s2, c2, x, MPFR_RNDN); if (mpfr_cmp (c2, c)) { printf("cos differs for x=77291789194529019661184401408"); @@ -342,8 +342,8 @@ 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, GMP_RNDN)) + test_sin (x, x, MPFR_RNDZ); + if (mpfr_cmp_str (x, "1.1111111111111111111111111111111111111111111111111111e-1", 2, MPFR_RNDN)) { printf ("Error for x= 1.1001001000011111101101010100010001000010110100010011\nGot "); mpfr_dump (x); diff --git a/tests/tsin_cos.c b/tests/tsin_cos.c index f637493d5..b44ab8e32 100644 --- a/tests/tsin_cos.c +++ b/tests/tsin_cos.c @@ -34,11 +34,11 @@ large_test (int prec, int N) mpfr_init2 (x, prec); mpfr_init2 (s, prec); mpfr_init2 (c, prec); - mpfr_set_ui (x, 3, GMP_RNDN); - mpfr_sqrt (x, x, GMP_RNDN); + mpfr_set_ui (x, 3, MPFR_RNDN); + mpfr_sqrt (x, x, MPFR_RNDN); for (i=0; i 0); mpfr_set_inf (x, -1); - mpfr_sinh (x, x, GMP_RNDN); + mpfr_sinh (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0); mpfr_set_prec (x, 10); mpfr_set_str_binary (x, "-0.1001011001"); - mpfr_sinh (x, x, GMP_RNDN); + mpfr_sinh (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_si_2exp (x, -159, -8) == 0); /* corner case */ mpfr_set_prec (x, 2); mpfr_set_str_binary (x, "1E-6"); - mpfr_sinh (x, x, GMP_RNDN); + mpfr_sinh (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui_2exp (x, 1, -6) == 0); mpfr_clear_flags (); mpfr_set_str_binary (x, "1E1000000000"); - i = mpfr_sinh (x, x, GMP_RNDN); + i = mpfr_sinh (x, x, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); - i = mpfr_sinh (x, x, GMP_RNDN); + i = mpfr_sinh (x, x, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) < 0); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == -1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); - i = mpfr_sinh (x, x, GMP_RNDD); + i = mpfr_sinh (x, x, MPFR_RNDD); MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) < 0); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == -1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); - i = mpfr_sinh (x, x, GMP_RNDU); + i = mpfr_sinh (x, x, MPFR_RNDU); MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) < 0); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == 1); diff --git a/tests/tsinh_cosh.c b/tests/tsinh_cosh.c index 58467ad19..edbc86c4a 100644 --- a/tests/tsinh_cosh.c +++ b/tests/tsinh_cosh.c @@ -31,15 +31,15 @@ static void failed (mpfr_t x, mpfr_t esh, mpfr_t gsh, mpfr_t ech, mpfr_t gch) { printf ("error : mpfr_sinh_cosh (x) x = "); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDD); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDD); printf ("\nsinh(x) expected "); - mpfr_out_str (stdout, 10, 0, esh, GMP_RNDD); + mpfr_out_str (stdout, 10, 0, esh, MPFR_RNDD); printf ("\n got "); - mpfr_out_str (stdout, 10, 0, gsh, GMP_RNDD); + mpfr_out_str (stdout, 10, 0, gsh, MPFR_RNDD); printf ("\ncosh(x) expected "); - mpfr_out_str (stdout, 10, 0, ech, GMP_RNDD); + mpfr_out_str (stdout, 10, 0, ech, MPFR_RNDD); printf ("\n got "); - mpfr_out_str (stdout, 10, 0, gch, GMP_RNDD); + mpfr_out_str (stdout, 10, 0, gch, MPFR_RNDD); putchar ('\n'); mpfr_clears (x, esh, gsh, ech, gch, (mpfr_ptr) 0); @@ -77,13 +77,13 @@ check_nans (void) /* nan */ mpfr_set_nan (x); - mpfr_sinh_cosh (sh, ch, x, GMP_RNDN); + mpfr_sinh_cosh (sh, ch, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (sh)); MPFR_ASSERTN (mpfr_nan_p (ch)); /* +inf */ mpfr_set_inf (x, 1); - mpfr_sinh_cosh (sh, ch, x, GMP_RNDN); + mpfr_sinh_cosh (sh, ch, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (sh)); MPFR_ASSERTN (mpfr_sgn (sh) > 0); MPFR_ASSERTN (mpfr_inf_p (ch)); @@ -91,7 +91,7 @@ check_nans (void) /* -inf */ mpfr_set_inf (x, -1); - mpfr_sinh_cosh (sh, ch, x, GMP_RNDN); + mpfr_sinh_cosh (sh, ch, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (sh)); MPFR_ASSERTN (mpfr_sgn (sh) < 0); MPFR_ASSERTN (mpfr_inf_p (ch)); @@ -114,16 +114,16 @@ main (int argc, char *argv[]) /* check against values given by sinh(x), cosh(x) */ mpfr_init2 (x, 53); - mpfr_set_str (x, "FEDCBA987654321p-48", 16, GMP_RNDN); + mpfr_set_str (x, "FEDCBA987654321p-48", 16, MPFR_RNDN); for (i = 0; i < 10; ++i) { /* x = i - x / 2 : boggle sign and bits */ - mpfr_ui_sub (x, i, x, GMP_RNDD); - mpfr_div_2ui (x, x, 2, GMP_RNDD); + mpfr_ui_sub (x, i, x, MPFR_RNDD); + mpfr_div_2ui (x, x, 2, MPFR_RNDD); - check (x, GMP_RNDN); - check (x, GMP_RNDU); - check (x, GMP_RNDD); + check (x, MPFR_RNDN); + check (x, MPFR_RNDU); + check (x, MPFR_RNDD); } mpfr_clear (x); diff --git a/tests/tsprintf.c b/tests/tsprintf.c index a1ee9787a..0fdbb9ef8 100644 --- a/tests/tsprintf.c +++ b/tests/tsprintf.c @@ -255,8 +255,8 @@ decimal (void) check_sprintf (" nan", "%010Re", x); /* positive numbers */ - mpfr_set_str (x, "18993474.61279296875", 10, GMP_RNDN); - mpfr_set_ui (z, 0, GMP_RNDD); + mpfr_set_str (x, "18993474.61279296875", 10, MPFR_RNDN); + mpfr_set_ui (z, 0, MPFR_RNDD); /* simplest case right justified */ check_sprintf (" 1.899347461279296875e+07", "%30Re", x); @@ -283,12 +283,12 @@ decimal (void) check_sprintf ("+0e+00 ", "%+-30.0Re", z); check_sprintf ("+0 ", "%+-30.0Rf", z); /* decimal point, left justified, precision and rounding parameter */ - check_vsprintf ("1.9E+07 ", "%#-10.*R*E", 1, GMP_RNDN, x); - check_vsprintf ("2.E+07 ", "%#*.*R*E", -10, 0, GMP_RNDN, x); - check_vsprintf ("2.E+07 ", "%#-10.*R*G", 0, GMP_RNDN, x); - check_vsprintf ("0.E+00 ", "%#-10.*R*E", 0, GMP_RNDN, z); - check_vsprintf ("0. ", "%#-10.*R*F", 0, GMP_RNDN, z); - check_vsprintf ("0. ", "%#-10.*R*G", 0, GMP_RNDN, z); + check_vsprintf ("1.9E+07 ", "%#-10.*R*E", 1, MPFR_RNDN, x); + check_vsprintf ("2.E+07 ", "%#*.*R*E", -10, 0, MPFR_RNDN, x); + check_vsprintf ("2.E+07 ", "%#-10.*R*G", 0, MPFR_RNDN, x); + check_vsprintf ("0.E+00 ", "%#-10.*R*E", 0, MPFR_RNDN, z); + check_vsprintf ("0. ", "%#-10.*R*F", 0, MPFR_RNDN, z); + check_vsprintf ("0. ", "%#-10.*R*G", 0, MPFR_RNDN, z); /* sign or space */ check_sprintf (" 1.899e+07", "% .3RNe", x); check_sprintf (" 2e+07", "% .0RNe", x); @@ -305,8 +305,8 @@ decimal (void) check_sprintf (" 1.E+07 ", "%- #11.0RDE", x); /* negative numbers */ - mpfr_mul_si (x, x, -1, GMP_RNDD); - mpfr_mul_si (z, z, -1, GMP_RNDD); + mpfr_mul_si (x, x, -1, MPFR_RNDD); + mpfr_mul_si (z, z, -1, MPFR_RNDD); /* sign + or - */ check_sprintf (" -1.8e+07", "%+10.1RUe", x); @@ -316,7 +316,7 @@ decimal (void) /* neighborhood of 1 */ - mpfr_set_str (x, "0.9999", 10, GMP_RNDN); + mpfr_set_str (x, "0.9999", 10, MPFR_RNDN); check_sprintf ("1E+00 ", "%-10.0RE", x); check_sprintf ("1.0E+00 ", "%-10.1RE", x); check_sprintf ("9.9990E-01", "%-10.4RE", x); @@ -331,7 +331,7 @@ decimal (void) check_sprintf ("0.9999 ", "%-#10.4RG", x); /* multiple of 10 */ - mpfr_set_str (x, "1e17", 10, GMP_RNDN); + mpfr_set_str (x, "1e17", 10, MPFR_RNDN); check_sprintf ("1e+17", "%Re", x); check_sprintf ("1.000e+17", "%.3Re", x); check_sprintf ("100000000000000000", "%Rf", x); @@ -339,7 +339,7 @@ decimal (void) check_sprintf ("100000000000000000", "%'Rf", x); check_sprintf ("100000000000000000.0", "%'.1Rf", x); - mpfr_ui_div (x, 1, x, GMP_RNDN); /* x=1e-17 */ + mpfr_ui_div (x, 1, x, MPFR_RNDN); /* x=1e-17 */ check_sprintf ("1e-17", "%Re", x); check_sprintf ("0.00000000000000001", "%Rf", x); check_sprintf ("1e-17", "%Rg", x); @@ -349,20 +349,20 @@ decimal (void) check_sprintf ("1", "%.0RUf", x); /* check rounding mode */ - mpfr_set_str (x, "0.0076", 10, GMP_RNDN); + mpfr_set_str (x, "0.0076", 10, MPFR_RNDN); check_sprintf ("0.007", "%.3RDF", x); check_sprintf ("0.007", "%.3RZF", x); check_sprintf ("0.008", "%.3RF", x); check_sprintf ("0.008", "%.3RUF", x); /* limit test for the choice beetwen %f-style and %g-style */ - mpfr_set_str (x, "0.0000999", 10, GMP_RNDN); + mpfr_set_str (x, "0.0000999", 10, MPFR_RNDN); check_sprintf ("0.0001", "%.0Rg", x); check_sprintf ("9e-05", "%.0RDg", x); check_sprintf ("0.0001", "%.2Rg", x); /* trailing zeros */ - mpfr_set_si_2exp (x, -1, -15, GMP_RNDN); /* x=-2^-15 */ + mpfr_set_si_2exp (x, -1, -15, MPFR_RNDN); /* x=-2^-15 */ check_sprintf ("-3.0517578125e-05", "%.30Rg", x); check_sprintf ("-3.051757812500000000000000000000e-05", "%.30Re", x); check_sprintf ("-3.05175781250000000000000000000e-05", "%#.30Rg", x); @@ -370,13 +370,13 @@ decimal (void) /* bug 20081023 */ check_sprintf ("-3.0517578125e-05", "%.30Rg", x); - mpfr_set_str (x, "1.9999", 10, GMP_RNDN); + mpfr_set_str (x, "1.9999", 10, MPFR_RNDN); check_sprintf ("1.999900 ", "%-#10.7RG", x); check_sprintf ("1.9999 ", "%-10.7RG", x); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); check_sprintf ("1.00000000000000000000000000000", "%#.30Rg", x); check_sprintf ("1", "%.30Rg", x); - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); check_sprintf ("0.000000000000000000000000000000", "%#.30Rg", x); check_sprintf ("0", "%.30Rg", x); @@ -384,11 +384,11 @@ decimal (void) mpfr_set_prec (x, 53); /* Exponent zero has a plus sign */ - mpfr_set_str (x, "-9.95645044213728791504536275169812142849e-01", 10, GMP_RNDN); + mpfr_set_str (x, "-9.95645044213728791504536275169812142849e-01", 10, MPFR_RNDN); check_sprintf ("-1.0e+00", "%- #0.1Re", x); /* Decimal point and no figure after it with '#' flag and 'G' style */ - mpfr_set_str (x, "-9.90597761233942053494e-01", 10, GMP_RNDN); + mpfr_set_str (x, "-9.90597761233942053494e-01", 10, MPFR_RNDN); check_sprintf ("-1.", "%- #0.1RG", x); mpfr_clears (x, z, (mpfr_ptr) 0); @@ -415,8 +415,8 @@ hexadecimal (void) check_sprintf (nan_uc_str, "%RA", x); /* regular numbers */ - mpfr_set_str (x, "FEDCBA9.87654321", 16, GMP_RNDN); - mpfr_set_ui (z, 0, GMP_RNDZ); + mpfr_set_str (x, "FEDCBA9.87654321", 16, MPFR_RNDN); + mpfr_set_ui (z, 0, MPFR_RNDZ); /* simplest case right justified */ check_sprintf (" 0xf.edcba987654321p+24", "%25Ra", x); @@ -431,9 +431,9 @@ hexadecimal (void) check_sprintf ("+0x8p+25 ", "%+-25.0Ra", x); check_sprintf ("+0x0p+0 ", "%+-25.0Ra", z); /* decimal point, left justified, precision and rounding parameter */ - check_vsprintf ("0XF.FP+24 ", "%#-10.*R*A", 1, GMP_RNDN, x); - check_vsprintf ("0X8.P+25 ", "%#-10.*R*A", 0, GMP_RNDN, x); - check_vsprintf ("0X0.P+0 ", "%#-10.*R*A", 0, GMP_RNDN, z); + check_vsprintf ("0XF.FP+24 ", "%#-10.*R*A", 1, MPFR_RNDN, x); + check_vsprintf ("0X8.P+25 ", "%#-10.*R*A", 0, MPFR_RNDN, x); + check_vsprintf ("0X0.P+0 ", "%#-10.*R*A", 0, MPFR_RNDN, z); /* sign or space */ check_sprintf (" 0xf.eddp+24", "% .3RNa", x); check_sprintf (" 0x8p+25", "% .0RNa", x); @@ -448,8 +448,8 @@ hexadecimal (void) check_sprintf (" 0XF.EP+24 " , "%- #11.1RDA", x); check_sprintf (" 0XF.P+24 " , "%- #11.0RDA", x); - mpfr_mul_si (x, x, -1, GMP_RNDD); - mpfr_mul_si (z, z, -1, GMP_RNDD); + mpfr_mul_si (x, x, -1, MPFR_RNDD); + mpfr_mul_si (z, z, -1, MPFR_RNDD); /* sign + or - */ check_sprintf ("-0xf.ep+24", "%+10.1RUa", x); @@ -457,12 +457,12 @@ hexadecimal (void) check_sprintf (" -0x0p+0", "%+10.0RUa", z); /* rounding bit is zero */ - mpfr_set_str (x, "0xF.7", 16, GMP_RNDN); + mpfr_set_str (x, "0xF.7", 16, MPFR_RNDN); check_sprintf ("0XFP+0", "%.0RNA", x); /* tie case in round to nearest mode */ - mpfr_set_str (x, "0x0.8800000000000000p+3", 16, GMP_RNDN); + mpfr_set_str (x, "0x0.8800000000000000p+3", 16, MPFR_RNDN); check_sprintf ("0x8.p-1", "%#.0RNa", x); - mpfr_set_str (x, "-0x0.9800000000000000p+3", 16, GMP_RNDN); + mpfr_set_str (x, "-0x0.9800000000000000p+3", 16, MPFR_RNDN); check_sprintf ("-0xap-1", "%.0RNa", x); /* trailing zeros in fractional part */ check_sprintf ("-0X4.C0000000000000000000P+0", "%.20RNA", x); @@ -489,8 +489,8 @@ binary (void) check_sprintf (nan_str, "%Rb", x); /* regular numbers */ - mpfr_set_str (x, "1110010101.1001101", 2, GMP_RNDN); - mpfr_set_ui (z, 0, GMP_RNDN); + mpfr_set_str (x, "1110010101.1001101", 2, MPFR_RNDN); + mpfr_set_ui (z, 0, MPFR_RNDN); /* simplest case: right justified */ check_sprintf (" 1.1100101011001101p+9", "%25Rb", x); @@ -515,8 +515,8 @@ binary (void) check_sprintf (" 1.1p+9 " , "%- #11.1RDb", x); check_sprintf (" 1.1p+9 " , "%- #11.0RDb", x); - mpfr_mul_si (x, x, -1, GMP_RNDD); - mpfr_mul_si (z, z, -1, GMP_RNDD); + mpfr_mul_si (x, x, -1, MPFR_RNDD); + mpfr_mul_si (z, z, -1, MPFR_RNDD); /* sign + or - */ check_sprintf (" -1.1p+9", "%+10.1RUb", x); @@ -554,8 +554,8 @@ mixed (void) mpz_init (mpz); mpz_fib_ui (mpz, 64); mpfr_init (x); - mpfr_set_str (x, "-12345678.875", 10, GMP_RNDN); - rnd = GMP_RNDD; + mpfr_set_str (x, "-12345678.875", 10, MPFR_RNDN); + rnd = MPFR_RNDD; check_vsprintf ("121%", "%i%%", i); check_vsprintf ("121% -1.2345678875E+07", "%i%% %RNE", i, x); @@ -563,7 +563,7 @@ mixed (void) check_vsprintf ("10610209857723, -1.2345678875e+07", "%Zi, %R*e", mpz, rnd, x); check_vsprintf ("-12345678.9, 121", "%.1Rf, %i", x, i); - check_vsprintf ("-12345678, 1e240/45b352", "%.0R*f, %Qx", GMP_RNDZ, x, mpq); + check_vsprintf ("-12345678, 1e240/45b352", "%.0R*f, %Qx", MPFR_RNDZ, x, mpq); n1 = check_vsprintf ("121, -12345678.875000000000, 1.290323", "%i, %.*Rf, %Ff%n", i, 12, x, mpf, &n2); if (n1 != n2) @@ -600,7 +600,7 @@ locale_da_DK (void) mpfr_init2 (x, p); /* positive numbers */ - mpfr_set_str (x, "18993474.61279296875", 10, GMP_RNDN); + mpfr_set_str (x, "18993474.61279296875", 10, MPFR_RNDN); /* simplest case right justified with thousands separator */ check_sprintf (" 1,899347461279296875e+07", "%'30Re", x); @@ -614,8 +614,8 @@ locale_da_DK (void) check_sprintf (" 000000018.993.474,61279296875", "%' 030.19RG", x); check_sprintf (" 000000018.993.474,61279296875", "%' 030RF", x); - mpfr_set_ui (x, 50, GMP_RNDN); - mpfr_exp10 (x, x, GMP_RNDN); + mpfr_set_ui (x, 50, MPFR_RNDN); + mpfr_exp10 (x, x, MPFR_RNDN); check_sprintf ("100000000000000000000000000000000000000000000000000", "%Rf", x); check_sprintf @@ -697,8 +697,8 @@ random_double (void) if (randlimb () % 2 == 0) y = -y; - mpfr_set_d (x, y, GMP_RNDN); - if (y != mpfr_get_d (x, GMP_RNDN)) + mpfr_set_d (x, y, MPFR_RNDN); + if (y != mpfr_get_d (x, MPFR_RNDN)) /* conversion error: skip this one */ continue; @@ -787,7 +787,7 @@ bug20080610 (void) mpfr_init2 (x, MPFR_LDBL_MANT_DIG); y = -9.95645044213728791504536275169812142849e-01; - mpfr_set_d (x, y, GMP_RNDN); + mpfr_set_d (x, y, MPFR_RNDN); xi = mpfr_asprintf (&xs, "%- #0.*Re", 1, x); yi = mpfr_asprintf (&ys, "%- #0.*e", 1, y); @@ -822,7 +822,7 @@ bug20081214 (void) mpfr_init2 (x, MPFR_LDBL_MANT_DIG); y = -9.90597761233942053494e-01; - mpfr_set_d (x, y, GMP_RNDN); + mpfr_set_d (x, y, MPFR_RNDN); xi = mpfr_asprintf (&xs, "%- #0.*RG", 1, x); yi = mpfr_asprintf (&ys, "%- #0.*G", 1, y); diff --git a/tests/tsqr.c b/tests/tsqr.c index a7988f9f0..15f153d01 100644 --- a/tests/tsqr.c +++ b/tests/tsqr.c @@ -68,7 +68,7 @@ check_random (mpfr_prec_t p) { mpfr_urandomb (x, RANDS); if (MPFR_IS_PURE_FP(x)) - for (r = 0 ; r < GMP_RND_MAX ; r++) + for (r = 0 ; r < MPFR_RND_MAX ; r++) { inexact1 = mpfr_mul (y, x, x, (mp_rnd_t) r); inexact2 = mpfr_sqr (z, x, (mp_rnd_t) r); @@ -91,27 +91,27 @@ check_special (void) mpfr_init (y); mpfr_set_nan (x); - mpfr_sqr (y, x, GMP_RNDN); + mpfr_sqr (y, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (y)); mpfr_set_inf (x, 1); - mpfr_sqr (y, x, GMP_RNDN); + mpfr_sqr (y, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (y) && mpfr_sgn (y) > 0); mpfr_set_inf (x, -1); - mpfr_sqr (y, x, GMP_RNDN); + mpfr_sqr (y, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (y) && mpfr_sgn (y) > 0); - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_sqr (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_sqr (y, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_zero_p (y)); emin = mpfr_get_emin (); mpfr_set_emin (0); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_div_2ui (x, x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_div_2ui (x, x, 1, MPFR_RNDN); MPFR_ASSERTN (!mpfr_zero_p (x)); - mpfr_sqr (y, x, GMP_RNDN); + mpfr_sqr (y, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_zero_p (y)); mpfr_set_emin (emin); diff --git a/tests/tsqrt.c b/tests/tsqrt.c index 20b87a5df..fccfac057 100644 --- a/tests/tsqrt.c +++ b/tests/tsqrt.c @@ -30,7 +30,7 @@ static int test_sqrt (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode) { int res; - int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b); + int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b); if (ok) { mpfr_print_raw (b); @@ -61,7 +61,7 @@ check3 (const char *as, mp_rnd_t rnd_mode, const char *qs) printf ("mpfr_sqrt failed for a=%s, rnd_mode=%s\n", as, mpfr_print_rnd_mode (rnd_mode)); printf ("expected sqrt is %s, got ",qs); - mpfr_out_str (stdout, 10, 0, q, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, q, MPFR_RNDN); putchar ('\n'); exit (1); } @@ -76,12 +76,12 @@ check4 (const char *as, mp_rnd_t rnd_mode, const char *Qs) mpfr_init2 (q, 53); mpfr_set_str1 (q, as); test_sqrt (q, q, rnd_mode); - if (mpfr_cmp_str (q, Qs, 16, GMP_RNDN)) + if (mpfr_cmp_str (q, Qs, 16, MPFR_RNDN)) { printf ("mpfr_sqrt failed for a=%s, rnd_mode=%s\n", as, mpfr_print_rnd_mode(rnd_mode)); printf ("expected "); - mpfr_out_str (stdout, 16, 0, q, GMP_RNDN); + mpfr_out_str (stdout, 16, 0, q, MPFR_RNDN); printf ("\ngot %s\n", Qs); mpfr_clear (q); exit (1); @@ -102,7 +102,7 @@ check24 (const char *as, mp_rnd_t rnd_mode, const char *qs) printf ("mpfr_sqrt failed for a=%s, prec=24, rnd_mode=%s\n", as, mpfr_print_rnd_mode(rnd_mode)); printf ("expected sqrt is %s, got ",qs); - mpfr_out_str (stdout, 10, 0, q, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, q, MPFR_RNDN); printf ("\n"); exit (1); } @@ -116,13 +116,13 @@ check_diverse (const char *as, mp_prec_t p, const char *qs) mpfr_init2 (q, p); mpfr_set_str1 (q, as); - test_sqrt (q, q, GMP_RNDN); + test_sqrt (q, q, MPFR_RNDN); if (mpfr_cmp_str1 (q, qs)) { printf ("mpfr_sqrt failed for a=%s, prec=%lu, rnd_mode=%s\n", - as, p, mpfr_print_rnd_mode (GMP_RNDN)); + as, p, mpfr_print_rnd_mode (MPFR_RNDN)); printf ("expected sqrt is %s, got ", qs); - mpfr_out_str (stdout, 10, 0, q, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, q, MPFR_RNDN); printf ("\n"); exit (1); } @@ -134,52 +134,52 @@ check_diverse (const char *as, mp_prec_t p, const char *qs) static void check_float (void) { - check24("70368760954880.0", GMP_RNDN, "8.388609e6"); - check24("281474943156224.0", GMP_RNDN, "1.6777215e7"); - check24("70368777732096.0", GMP_RNDN, "8.388610e6"); - check24("281474909601792.0", GMP_RNDN, "1.6777214e7"); - check24("100216216748032.0", GMP_RNDN, "1.0010805e7"); - check24("120137273311232.0", GMP_RNDN, "1.0960715e7"); - check24("229674600890368.0", GMP_RNDN, "1.5155019e7"); - check24("70368794509312.0", GMP_RNDN, "8.388611e6"); - check24("281474876047360.0", GMP_RNDN, "1.6777213e7"); - check24("91214552498176.0", GMP_RNDN, "9.550631e6"); - - check24("70368760954880.0", GMP_RNDZ, "8.388608e6"); - check24("281474943156224.0", GMP_RNDZ, "1.6777214e7"); - check24("70368777732096.0", GMP_RNDZ, "8.388609e6"); - check24("281474909601792.0", GMP_RNDZ, "1.6777213e7"); - check24("100216216748032.0", GMP_RNDZ, "1.0010805e7"); - check24("120137273311232.0", GMP_RNDZ, "1.0960715e7"); - check24("229674600890368.0", GMP_RNDZ, "1.5155019e7"); - check24("70368794509312.0", GMP_RNDZ, "8.38861e6"); - check24("281474876047360.0", GMP_RNDZ, "1.6777212e7"); - check24("91214552498176.0", GMP_RNDZ, "9.550631e6"); - - check24("70368760954880.0", GMP_RNDU, "8.388609e6"); - check24("281474943156224.0",GMP_RNDU, "1.6777215e7"); - check24("70368777732096.0", GMP_RNDU, "8.388610e6"); - check24("281474909601792.0", GMP_RNDU, "1.6777214e7"); - check24("100216216748032.0", GMP_RNDU, "1.0010806e7"); - check24("120137273311232.0", GMP_RNDU, "1.0960716e7"); - check24("229674600890368.0", GMP_RNDU, "1.515502e7"); - check24("70368794509312.0", GMP_RNDU, "8.388611e6"); - check24("281474876047360.0", GMP_RNDU, "1.6777213e7"); - check24("91214552498176.0", GMP_RNDU, "9.550632e6"); - - check24("70368760954880.0", GMP_RNDD, "8.388608e6"); - check24("281474943156224.0", GMP_RNDD, "1.6777214e7"); - check24("70368777732096.0", GMP_RNDD, "8.388609e6"); - check24("281474909601792.0", GMP_RNDD, "1.6777213e7"); - check24("100216216748032.0", GMP_RNDD, "1.0010805e7"); - check24("120137273311232.0", GMP_RNDD, "1.0960715e7"); - check24("229674600890368.0", GMP_RNDD, "1.5155019e7"); - check24("70368794509312.0", GMP_RNDD, "8.38861e6"); - check24("281474876047360.0", GMP_RNDD, "1.6777212e7"); - check24("91214552498176.0", GMP_RNDD, "9.550631e6"); + check24("70368760954880.0", MPFR_RNDN, "8.388609e6"); + check24("281474943156224.0", MPFR_RNDN, "1.6777215e7"); + check24("70368777732096.0", MPFR_RNDN, "8.388610e6"); + check24("281474909601792.0", MPFR_RNDN, "1.6777214e7"); + check24("100216216748032.0", MPFR_RNDN, "1.0010805e7"); + check24("120137273311232.0", MPFR_RNDN, "1.0960715e7"); + check24("229674600890368.0", MPFR_RNDN, "1.5155019e7"); + check24("70368794509312.0", MPFR_RNDN, "8.388611e6"); + check24("281474876047360.0", MPFR_RNDN, "1.6777213e7"); + check24("91214552498176.0", MPFR_RNDN, "9.550631e6"); + + check24("70368760954880.0", MPFR_RNDZ, "8.388608e6"); + check24("281474943156224.0", MPFR_RNDZ, "1.6777214e7"); + check24("70368777732096.0", MPFR_RNDZ, "8.388609e6"); + check24("281474909601792.0", MPFR_RNDZ, "1.6777213e7"); + check24("100216216748032.0", MPFR_RNDZ, "1.0010805e7"); + check24("120137273311232.0", MPFR_RNDZ, "1.0960715e7"); + check24("229674600890368.0", MPFR_RNDZ, "1.5155019e7"); + check24("70368794509312.0", MPFR_RNDZ, "8.38861e6"); + check24("281474876047360.0", MPFR_RNDZ, "1.6777212e7"); + check24("91214552498176.0", MPFR_RNDZ, "9.550631e6"); + + check24("70368760954880.0", MPFR_RNDU, "8.388609e6"); + check24("281474943156224.0",MPFR_RNDU, "1.6777215e7"); + check24("70368777732096.0", MPFR_RNDU, "8.388610e6"); + check24("281474909601792.0", MPFR_RNDU, "1.6777214e7"); + check24("100216216748032.0", MPFR_RNDU, "1.0010806e7"); + check24("120137273311232.0", MPFR_RNDU, "1.0960716e7"); + check24("229674600890368.0", MPFR_RNDU, "1.515502e7"); + check24("70368794509312.0", MPFR_RNDU, "8.388611e6"); + check24("281474876047360.0", MPFR_RNDU, "1.6777213e7"); + check24("91214552498176.0", MPFR_RNDU, "9.550632e6"); + + check24("70368760954880.0", MPFR_RNDD, "8.388608e6"); + check24("281474943156224.0", MPFR_RNDD, "1.6777214e7"); + check24("70368777732096.0", MPFR_RNDD, "8.388609e6"); + check24("281474909601792.0", MPFR_RNDD, "1.6777213e7"); + check24("100216216748032.0", MPFR_RNDD, "1.0010805e7"); + check24("120137273311232.0", MPFR_RNDD, "1.0960715e7"); + check24("229674600890368.0", MPFR_RNDD, "1.5155019e7"); + check24("70368794509312.0", MPFR_RNDD, "8.38861e6"); + check24("281474876047360.0", MPFR_RNDD, "1.6777212e7"); + check24("91214552498176.0", MPFR_RNDD, "9.550631e6"); /* check that rounding away is just rounding towards plus infinity */ - check24("91214552498176.0", GMP_RNDA, "9.550632e6"); + check24("91214552498176.0", MPFR_RNDA, "9.550632e6"); } static void @@ -196,7 +196,7 @@ special (void) mpfr_set_prec (x, 64); mpfr_set_str_binary (x, "1010000010100011011001010101010010001100001101011101110001011001E-1"); mpfr_set_prec (y, 32); - test_sqrt (y, x, GMP_RNDN); + test_sqrt (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 2405743844UL)) { printf ("Error for n^2+n+1/2 with n=2405743843\n"); @@ -206,7 +206,7 @@ special (void) mpfr_set_prec (x, 65); mpfr_set_str_binary (x, "10100000101000110110010101010100100011000011010111011100010110001E-2"); mpfr_set_prec (y, 32); - test_sqrt (y, x, GMP_RNDN); + test_sqrt (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 2405743844UL)) { printf ("Error for n^2+n+1/4 with n=2405743843\n"); @@ -217,7 +217,7 @@ special (void) mpfr_set_prec (x, 66); mpfr_set_str_binary (x, "101000001010001101100101010101001000110000110101110111000101100011E-3"); mpfr_set_prec (y, 32); - test_sqrt (y, x, GMP_RNDN); + test_sqrt (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 2405743844UL)) { printf ("Error for n^2+n+1/4+1/8 with n=2405743843\n"); @@ -228,7 +228,7 @@ special (void) mpfr_set_prec (x, 66); mpfr_set_str_binary (x, "101000001010001101100101010101001000110000110101110111000101100001E-3"); mpfr_set_prec (y, 32); - test_sqrt (y, x, GMP_RNDN); + test_sqrt (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 2405743843UL)) { printf ("Error for n^2+n+1/8 with n=2405743843\n"); @@ -238,7 +238,7 @@ special (void) mpfr_set_prec (x, 27); mpfr_set_str_binary (x, "0.110100111010101000010001011"); - if ((inexact = test_sqrt (x, x, GMP_RNDZ)) >= 0) + if ((inexact = test_sqrt (x, x, MPFR_RNDZ)) >= 0) { printf ("Wrong inexact flag: expected -1, got %d\n", inexact); exit (1); @@ -248,9 +248,9 @@ special (void) for (p=2; p<1000; p++) { mpfr_set_prec (z, p); - mpfr_set_ui (z, 1, GMP_RNDN); + mpfr_set_ui (z, 1, MPFR_RNDN); mpfr_nexttoinf (z); - test_sqrt (x, z, GMP_RNDU); + test_sqrt (x, z, MPFR_RNDU); if (mpfr_cmp_ui_2exp(x, 3, -1)) { printf ("Error: sqrt(1+ulp(1), up) should give 1.5 (prec=%u)\n", @@ -263,7 +263,7 @@ special (void) /* check inexact flag */ mpfr_set_prec (x, 5); mpfr_set_str_binary (x, "1.1001E-2"); - if ((inexact = test_sqrt (x, x, GMP_RNDN))) + if ((inexact = test_sqrt (x, x, MPFR_RNDN))) { printf ("Wrong inexact flag: expected 0, got %d\n", inexact); exit (1); @@ -273,9 +273,9 @@ special (void) mpfr_set_prec (z, 2); /* checks the sign is correctly set */ - mpfr_set_si (x, 1, GMP_RNDN); - mpfr_set_si (z, -1, GMP_RNDN); - test_sqrt (z, x, GMP_RNDN); + mpfr_set_si (x, 1, MPFR_RNDN); + mpfr_set_si (z, -1, MPFR_RNDN); + test_sqrt (z, x, MPFR_RNDN); if (mpfr_cmp_ui (z, 0) < 0) { printf ("Error: square root of 1 gives "); @@ -288,14 +288,14 @@ special (void) mpfr_set_prec (z, 160); mpfr_set_str_binary (z, "0.1011010100000100100100100110011001011100100100000011000111011001011101101101110000110100001000100001100001011000E1"); mpfr_set_prec (x, 160); - test_sqrt(x, z, GMP_RNDN); - test_sqrt(z, x, GMP_RNDN); + test_sqrt(x, z, MPFR_RNDN); + test_sqrt(z, x, MPFR_RNDN); mpfr_set_prec (x, 53); - mpfr_set_str (x, "8093416094703476.0", 10, GMP_RNDN); - mpfr_div_2exp (x, x, 1075, GMP_RNDN); - test_sqrt (x, x, GMP_RNDN); - mpfr_set_str (z, "1e55596835b5ef@-141", 16, GMP_RNDN); + mpfr_set_str (x, "8093416094703476.0", 10, MPFR_RNDN); + mpfr_div_2exp (x, x, 1075, MPFR_RNDN); + test_sqrt (x, x, MPFR_RNDN); + mpfr_set_str (z, "1e55596835b5ef@-141", 16, MPFR_RNDN); if (mpfr_cmp (x, z)) { printf ("Error: square root of 8093416094703476*2^(-1075)\n"); @@ -307,7 +307,7 @@ special (void) mpfr_set_prec (x, 33); mpfr_set_str_binary (x, "0.111011011011110001100111111001000e-10"); mpfr_set_prec (z, 157); - inexact = test_sqrt (z, x, GMP_RNDN); + inexact = test_sqrt (z, x, MPFR_RNDN); mpfr_set_prec (x, 157); mpfr_set_str_binary (x, "0.11110110101100101111001011100011100011100001101010111011010000100111011000111110100001001011110011111100101110010110010110011001011011010110010000011001101E-5"); if (mpfr_cmp (x, z)) @@ -326,48 +326,48 @@ special (void) for (p = 2; p < 1000; p++) { mpfr_set_prec (x, p); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_nextabove (x); /* 1.0 < x <= 1.5 thus 1 < sqrt(x) <= 1.23 */ - inexact = test_sqrt (z, x, GMP_RNDN); + inexact = test_sqrt (z, x, MPFR_RNDN); MPFR_ASSERTN(inexact < 0 && mpfr_cmp_ui (z, 1) == 0); - inexact = test_sqrt (z, x, GMP_RNDZ); + inexact = test_sqrt (z, x, MPFR_RNDZ); MPFR_ASSERTN(inexact < 0 && mpfr_cmp_ui (z, 1) == 0); - inexact = test_sqrt (z, x, GMP_RNDU); + inexact = test_sqrt (z, x, MPFR_RNDU); MPFR_ASSERTN(inexact > 0 && mpfr_cmp_ui_2exp (z, 3, -1) == 0); - inexact = test_sqrt (z, x, GMP_RNDD); + inexact = test_sqrt (z, x, MPFR_RNDD); MPFR_ASSERTN(inexact < 0 && mpfr_cmp_ui (z, 1) == 0); - inexact = test_sqrt (z, x, GMP_RNDA); + inexact = test_sqrt (z, x, MPFR_RNDA); MPFR_ASSERTN(inexact > 0 && mpfr_cmp_ui_2exp (z, 3, -1) == 0); } /* corner case rw = 0 in rounding to nearest */ mpfr_set_prec (z, BITS_PER_MP_LIMB - 1); mpfr_set_prec (y, BITS_PER_MP_LIMB - 1); - mpfr_set_ui (y, 1, GMP_RNDN); - mpfr_mul_2exp (y, y, BITS_PER_MP_LIMB - 1, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_mul_2exp (y, y, BITS_PER_MP_LIMB - 1, MPFR_RNDN); mpfr_nextabove (y); for (p = 2 * BITS_PER_MP_LIMB - 1; p <= 1000; p++) { mpfr_set_prec (x, p); - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_set_exp (x, BITS_PER_MP_LIMB); - mpfr_add_ui (x, x, 1, GMP_RNDN); + mpfr_add_ui (x, x, 1, MPFR_RNDN); /* now x = 2^(BITS_PER_MP_LIMB - 1) + 1 (BITS_PER_MP_LIMB bits) */ - MPFR_ASSERTN (mpfr_mul (x, x, x, GMP_RNDN) == 0); /* exact */ - inexact = test_sqrt (z, x, GMP_RNDN); + MPFR_ASSERTN (mpfr_mul (x, x, x, MPFR_RNDN) == 0); /* exact */ + inexact = test_sqrt (z, x, MPFR_RNDN); /* even rule: z should be 2^(BITS_PER_MP_LIMB - 1) */ MPFR_ASSERTN (inexact < 0); MPFR_ASSERTN (mpfr_cmp_ui_2exp (z, 1, BITS_PER_MP_LIMB - 1) == 0); mpfr_nextbelow (x); /* now x is just below [2^(BITS_PER_MP_LIMB - 1) + 1]^2 */ - inexact = test_sqrt (z, x, GMP_RNDN); + inexact = test_sqrt (z, x, MPFR_RNDN); MPFR_ASSERTN(inexact < 0 && mpfr_cmp_ui_2exp (z, 1, BITS_PER_MP_LIMB - 1) == 0); mpfr_nextabove (x); mpfr_nextabove (x); /* now x is just above [2^(BITS_PER_MP_LIMB - 1) + 1]^2 */ - inexact = test_sqrt (z, x, GMP_RNDN); + inexact = test_sqrt (z, x, MPFR_RNDN); if (mpfr_cmp (z, y)) { printf ("Error for sqrt(x) in rounding to nearest\n"); @@ -384,9 +384,9 @@ special (void) } mpfr_set_prec (x, 1000); - mpfr_set_ui (x, 9, GMP_RNDN); + mpfr_set_ui (x, 9, MPFR_RNDN); mpfr_set_prec (y, 10); - inexact = test_sqrt (y, x, GMP_RNDN); + inexact = test_sqrt (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 3) || inexact != 0) { printf ("Error in sqrt(9:1000) for prec=10\n"); @@ -394,7 +394,7 @@ special (void) } mpfr_set_prec (y, BITS_PER_MP_LIMB); mpfr_nextabove (x); - inexact = test_sqrt (y, x, GMP_RNDN); + inexact = test_sqrt (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 3) || inexact >= 0) { printf ("Error in sqrt(9:1000) for prec=%d\n", (int) BITS_PER_MP_LIMB); @@ -402,10 +402,10 @@ special (void) } mpfr_set_prec (x, 2 * BITS_PER_MP_LIMB); mpfr_set_prec (y, BITS_PER_MP_LIMB); - mpfr_set_ui (y, 1, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); mpfr_nextabove (y); - mpfr_set (x, y, GMP_RNDN); - inexact = test_sqrt (y, x, GMP_RNDN); + mpfr_set (x, y, MPFR_RNDN); + inexact = test_sqrt (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1) || inexact >= 0) { printf ("Error in sqrt(1) for prec=%d\n", (int) BITS_PER_MP_LIMB); @@ -466,32 +466,32 @@ check_nan (void) /* sqrt(NaN) == NaN */ MPFR_CLEAR_FLAGS (x); MPFR_SET_NAN (x); - MPFR_ASSERTN (test_sqrt (got, x, GMP_RNDZ) == 0); /* exact */ + MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_nan_p (got)); /* sqrt(-1) == NaN */ - mpfr_set_si (x, -1L, GMP_RNDZ); - MPFR_ASSERTN (test_sqrt (got, x, GMP_RNDZ) == 0); /* exact */ + mpfr_set_si (x, -1L, MPFR_RNDZ); + MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_nan_p (got)); /* sqrt(+inf) == +inf */ MPFR_CLEAR_FLAGS (x); MPFR_SET_INF (x); MPFR_SET_POS (x); - MPFR_ASSERTN (test_sqrt (got, x, GMP_RNDZ) == 0); /* exact */ + MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_inf_p (got)); /* sqrt(-inf) == NaN */ MPFR_CLEAR_FLAGS (x); MPFR_SET_INF (x); MPFR_SET_NEG (x); - MPFR_ASSERTN (test_sqrt (got, x, GMP_RNDZ) == 0); /* exact */ + MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_nan_p (got)); /* sqrt(-0) == 0 */ - mpfr_set_si (x, 0L, GMP_RNDZ); + mpfr_set_si (x, 0L, MPFR_RNDZ); MPFR_SET_NEG (x); - MPFR_ASSERTN (test_sqrt (got, x, GMP_RNDZ) == 0); /* exact */ + MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_number_p (got)); MPFR_ASSERTN (mpfr_cmp_ui (got, 0L) == 0); @@ -572,10 +572,10 @@ main (void) for (p = MPFR_PREC_MIN; p <= 128; p++) { - test_property1 (p, GMP_RNDN); - test_property1 (p, GMP_RNDU); - test_property1 (p, GMP_RNDA); - test_property2 (p, GMP_RNDN); + test_property1 (p, MPFR_RNDN); + test_property1 (p, MPFR_RNDU); + test_property1 (p, MPFR_RNDA); + test_property2 (p, MPFR_RNDN); } check_diverse ("635030154261163106768013773815762607450069292760790610550915652722277604820131530404842415587328", 160, "796887792767063979679855997149887366668464780637"); @@ -587,103 +587,103 @@ main (void) check_inexact (p); check_float(); - check3 ("-0.0", GMP_RNDN, "0.0"); - check4 ("6.37983013646045901440e+32", GMP_RNDN, "5.9bc5036d09e0c@13"); - check4 ("1.0", GMP_RNDN, "1"); - check4 ("1.0", GMP_RNDZ, "1"); - check4 ("3.725290298461914062500000e-9", GMP_RNDN, "4@-4"); - check4 ("3.725290298461914062500000e-9", GMP_RNDZ, "4@-4"); - check4 ("1190456976439861.0", GMP_RNDZ, "2.0e7957873529a@6"); - check4 ("1219027943874417664.0", GMP_RNDZ, "4.1cf2af0e6a534@7"); + check3 ("-0.0", MPFR_RNDN, "0.0"); + check4 ("6.37983013646045901440e+32", MPFR_RNDN, "5.9bc5036d09e0c@13"); + check4 ("1.0", MPFR_RNDN, "1"); + check4 ("1.0", MPFR_RNDZ, "1"); + check4 ("3.725290298461914062500000e-9", MPFR_RNDN, "4@-4"); + check4 ("3.725290298461914062500000e-9", MPFR_RNDZ, "4@-4"); + check4 ("1190456976439861.0", MPFR_RNDZ, "2.0e7957873529a@6"); + check4 ("1219027943874417664.0", MPFR_RNDZ, "4.1cf2af0e6a534@7"); /* the following examples are bugs in Cygnus compiler/system, found by Fabrice Rouillier while porting mpfr to Windows */ - check4 ("9.89438396044940256501e-134", GMP_RNDU, "8.7af7bf0ebbee@-56"); - check4 ("7.86528588050363751914e+31", GMP_RNDZ, "1.f81fc40f32062@13"); - check4 ("0.99999999999999988897", GMP_RNDN, "f.ffffffffffff8@-1"); - check4 ("1.00000000000000022204", GMP_RNDN, "1"); + check4 ("9.89438396044940256501e-134", MPFR_RNDU, "8.7af7bf0ebbee@-56"); + check4 ("7.86528588050363751914e+31", MPFR_RNDZ, "1.f81fc40f32062@13"); + check4 ("0.99999999999999988897", MPFR_RNDN, "f.ffffffffffff8@-1"); + check4 ("1.00000000000000022204", MPFR_RNDN, "1"); /* the following examples come from the paper "Number-theoretic Test Generation for Directed Rounding" from Michael Parks, Table 4 */ - check4 ("78652858805036375191418371571712.0", GMP_RNDN, + check4 ("78652858805036375191418371571712.0", MPFR_RNDN, "1.f81fc40f32063@13"); - check4 ("38510074998589467860312736661504.0", GMP_RNDN, + check4 ("38510074998589467860312736661504.0", MPFR_RNDN, "1.60c012a92fc65@13"); - check4 ("35318779685413012908190921129984.0", GMP_RNDN, + check4 ("35318779685413012908190921129984.0", MPFR_RNDN, "1.51d17526c7161@13"); - check4 ("26729022595358440976973142425600.0", GMP_RNDN, + check4 ("26729022595358440976973142425600.0", MPFR_RNDN, "1.25e19302f7e51@13"); - check4 ("22696567866564242819241453027328.0", GMP_RNDN, + check4 ("22696567866564242819241453027328.0", MPFR_RNDN, "1.0ecea7dd2ec3d@13"); - check4 ("22696888073761729132924856434688.0", GMP_RNDN, + check4 ("22696888073761729132924856434688.0", MPFR_RNDN, "1.0ecf250e8e921@13"); - check4 ("36055652513981905145251657416704.0", GMP_RNDN, + check4 ("36055652513981905145251657416704.0", MPFR_RNDN, "1.5552f3eedcf33@13"); - check4 ("30189856268896404997497182748672.0", GMP_RNDN, + check4 ("30189856268896404997497182748672.0", MPFR_RNDN, "1.3853ee10c9c99@13"); - check4 ("36075288240584711210898775080960.0", GMP_RNDN, + check4 ("36075288240584711210898775080960.0", MPFR_RNDN, "1.556abe212b56f@13"); - check4 ("72154663483843080704304789585920.0", GMP_RNDN, + check4 ("72154663483843080704304789585920.0", MPFR_RNDN, "1.e2d9a51977e6e@13"); - check4 ("78652858805036375191418371571712.0", GMP_RNDZ, + check4 ("78652858805036375191418371571712.0", MPFR_RNDZ, "1.f81fc40f32062@13"); - check4 ("38510074998589467860312736661504.0", GMP_RNDZ, + check4 ("38510074998589467860312736661504.0", MPFR_RNDZ, "1.60c012a92fc64@13"); - check4 ("35318779685413012908190921129984.0", GMP_RNDZ, "1.51d17526c716@13"); - check4 ("26729022595358440976973142425600.0", GMP_RNDZ, "1.25e19302f7e5@13"); - check4 ("22696567866564242819241453027328.0", GMP_RNDZ, + check4 ("35318779685413012908190921129984.0", MPFR_RNDZ, "1.51d17526c716@13"); + check4 ("26729022595358440976973142425600.0", MPFR_RNDZ, "1.25e19302f7e5@13"); + check4 ("22696567866564242819241453027328.0", MPFR_RNDZ, "1.0ecea7dd2ec3c@13"); - check4 ("22696888073761729132924856434688.0", GMP_RNDZ, "1.0ecf250e8e92@13"); - check4 ("36055652513981905145251657416704.0", GMP_RNDZ, + check4 ("22696888073761729132924856434688.0", MPFR_RNDZ, "1.0ecf250e8e92@13"); + check4 ("36055652513981905145251657416704.0", MPFR_RNDZ, "1.5552f3eedcf32@13"); - check4 ("30189856268896404997497182748672.0", GMP_RNDZ, + check4 ("30189856268896404997497182748672.0", MPFR_RNDZ, "1.3853ee10c9c98@13"); - check4 ("36075288240584711210898775080960.0", GMP_RNDZ, + check4 ("36075288240584711210898775080960.0", MPFR_RNDZ, "1.556abe212b56e@13"); - check4 ("72154663483843080704304789585920.0", GMP_RNDZ, + check4 ("72154663483843080704304789585920.0", MPFR_RNDZ, "1.e2d9a51977e6d@13"); - check4 ("78652858805036375191418371571712.0", GMP_RNDU, + check4 ("78652858805036375191418371571712.0", MPFR_RNDU, "1.f81fc40f32063@13"); - check4 ("38510074998589467860312736661504.0", GMP_RNDU, + check4 ("38510074998589467860312736661504.0", MPFR_RNDU, "1.60c012a92fc65@13"); - check4 ("35318779685413012908190921129984.0", GMP_RNDU, + check4 ("35318779685413012908190921129984.0", MPFR_RNDU, "1.51d17526c7161@13"); - check4 ("26729022595358440976973142425600.0", GMP_RNDU, + check4 ("26729022595358440976973142425600.0", MPFR_RNDU, "1.25e19302f7e51@13"); - check4 ("22696567866564242819241453027328.0", GMP_RNDU, + check4 ("22696567866564242819241453027328.0", MPFR_RNDU, "1.0ecea7dd2ec3d@13"); - check4 ("22696888073761729132924856434688.0", GMP_RNDU, + check4 ("22696888073761729132924856434688.0", MPFR_RNDU, "1.0ecf250e8e921@13"); - check4 ("36055652513981905145251657416704.0", GMP_RNDU, + check4 ("36055652513981905145251657416704.0", MPFR_RNDU, "1.5552f3eedcf33@13"); - check4 ("30189856268896404997497182748672.0", GMP_RNDU, + check4 ("30189856268896404997497182748672.0", MPFR_RNDU, "1.3853ee10c9c99@13"); - check4 ("36075288240584711210898775080960.0", GMP_RNDU, + check4 ("36075288240584711210898775080960.0", MPFR_RNDU, "1.556abe212b56f@13"); - check4 ("72154663483843080704304789585920.0", GMP_RNDU, + check4 ("72154663483843080704304789585920.0", MPFR_RNDU, "1.e2d9a51977e6e@13"); - check4 ("78652858805036375191418371571712.0", GMP_RNDD, + check4 ("78652858805036375191418371571712.0", MPFR_RNDD, "1.f81fc40f32062@13"); - check4 ("38510074998589467860312736661504.0", GMP_RNDD, + check4 ("38510074998589467860312736661504.0", MPFR_RNDD, "1.60c012a92fc64@13"); - check4 ("35318779685413012908190921129984.0", GMP_RNDD, "1.51d17526c716@13"); - check4 ("26729022595358440976973142425600.0", GMP_RNDD, "1.25e19302f7e5@13"); - check4 ("22696567866564242819241453027328.0", GMP_RNDD, + check4 ("35318779685413012908190921129984.0", MPFR_RNDD, "1.51d17526c716@13"); + check4 ("26729022595358440976973142425600.0", MPFR_RNDD, "1.25e19302f7e5@13"); + check4 ("22696567866564242819241453027328.0", MPFR_RNDD, "1.0ecea7dd2ec3c@13"); - check4 ("22696888073761729132924856434688.0", GMP_RNDD, "1.0ecf250e8e92@13"); - check4 ("36055652513981905145251657416704.0", GMP_RNDD, + check4 ("22696888073761729132924856434688.0", MPFR_RNDD, "1.0ecf250e8e92@13"); + check4 ("36055652513981905145251657416704.0", MPFR_RNDD, "1.5552f3eedcf32@13"); - check4 ("30189856268896404997497182748672.0", GMP_RNDD, + check4 ("30189856268896404997497182748672.0", MPFR_RNDD, "1.3853ee10c9c98@13"); - check4 ("36075288240584711210898775080960.0", GMP_RNDD, + check4 ("36075288240584711210898775080960.0", MPFR_RNDD, "1.556abe212b56e@13"); - check4 ("72154663483843080704304789585920.0", GMP_RNDD, + check4 ("72154663483843080704304789585920.0", MPFR_RNDD, "1.e2d9a51977e6d@13"); /* check that rounding away is just rounding towards plus infinity */ - check4 ("72154663483843080704304789585920.0", GMP_RNDA, + check4 ("72154663483843080704304789585920.0", MPFR_RNDA, "1.e2d9a51977e6e@13"); test_generic (2, 300, 15); diff --git a/tests/tsqrt_ui.c b/tests/tsqrt_ui.c index 5288fb908..6eac24594 100644 --- a/tests/tsqrt_ui.c +++ b/tests/tsqrt_ui.c @@ -37,7 +37,7 @@ check (unsigned long a, mp_rnd_t rnd_mode, const char *qs) printf ("mpfr_sqrt_ui failed for a=%lu, rnd_mode=%s\n", a, mpfr_print_rnd_mode (rnd_mode)); printf ("sqrt gives %s, mpfr_sqrt_ui gives ", qs); - mpfr_out_str(stdout, 10, 0, q, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, q, MPFR_RNDN); exit (1); } mpfr_clear (q); @@ -48,8 +48,8 @@ main (void) { tests_start_mpfr (); - check (0, GMP_RNDN, "0.0"); - check (2116118, GMP_RNDU, "1.45468828276026215e3"); + check (0, MPFR_RNDN, "0.0"); + check (2116118, MPFR_RNDU, "1.45468828276026215e3"); tests_end_mpfr (); return 0; diff --git a/tests/tstckintc.c b/tests/tstckintc.c index f4775db0a..4b26351b1 100644 --- a/tests/tstckintc.c +++ b/tests/tstckintc.c @@ -85,9 +85,9 @@ test1 (void) org = stack; x = new_mpfr (p); y = new_mpfr (p); - mpfr_set_ui (x, 42, GMP_RNDN); - mpfr_set_ui (y, 17, GMP_RNDN); - mpfr_add (y, x, y, GMP_RNDN); + mpfr_set_ui (x, 42, MPFR_RNDN); + mpfr_set_ui (y, 17, MPFR_RNDN); + mpfr_add (y, x, y, MPFR_RNDN); y = return_mpfr (y, org); if (y != x || mpfr_cmp_ui (y, 59) != 0) { @@ -119,7 +119,7 @@ dummy_set_si (long si) mpfr_t x; long * r = dummy_new (); (mpfr_custom_init_set) (x, 0, 0, p, &r[2]); - mpfr_set_si (x, si, GMP_RNDN); + mpfr_set_si (x, si, MPFR_RNDN); r[0] = mpfr_custom_get_kind (x); r[1] = mpfr_custom_get_exp (x); return r; @@ -133,7 +133,7 @@ dummy_add (long *a, long *b) mpfr_custom_init_set (x, 0, 0, p, &r[2]); (mpfr_custom_init_set) (y, a[0], a[1], p, &a[2]); mpfr_custom_init_set (z, b[0], b[1], p, &b[2]); - mpfr_add (x, y, z, GMP_RNDN); + mpfr_add (x, y, z, MPFR_RNDN); r[0] = (mpfr_custom_get_kind) (x); r[1] = (mpfr_custom_get_exp) (x); return r; diff --git a/tests/tstrtofr.c b/tests/tstrtofr.c index bc200b7b2..047d9f9a7 100644 --- a/tests/tstrtofr.c +++ b/tests/tstrtofr.c @@ -38,8 +38,8 @@ check_special (void) mpfr_init (y); /* Check dummy case */ - res = mpfr_strtofr (x, "1234567.89E1", NULL, 10, GMP_RNDN); - mpfr_set_str (y, "1234567.89E1", 10, GMP_RNDN); + res = mpfr_strtofr (x, "1234567.89E1", NULL, 10, MPFR_RNDN); + mpfr_set_str (y, "1234567.89E1", 10, MPFR_RNDN); if (mpfr_cmp (x, y)) { printf ("Results differ between strtofr and set_str.\n" @@ -51,57 +51,57 @@ check_special (void) } /* Check NAN */ - mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */ - res = mpfr_strtofr (x, "NaN", &s, 10, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */ + res = mpfr_strtofr (x, "NaN", &s, 10, MPFR_RNDN); if (res != 0 || !mpfr_nan_p (x) || *s != 0) { printf ("Error for setting NAN (1)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */ - res = mpfr_strtofr (x, "+NaN", &s, 10, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */ + res = mpfr_strtofr (x, "+NaN", &s, 10, MPFR_RNDN); if (res != 0 || !mpfr_nan_p (x) || *s != 0) { printf ("Error for setting +NAN (1)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */ - res = mpfr_strtofr (x, " -NaN", &s, 10, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */ + res = mpfr_strtofr (x, " -NaN", &s, 10, MPFR_RNDN); if (res != 0 || !mpfr_nan_p (x) || *s != 0) { printf ("Error for setting -NAN (1)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */ - res = mpfr_strtofr (x, "@nAn@xx", &s, 16, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */ + res = mpfr_strtofr (x, "@nAn@xx", &s, 16, MPFR_RNDN); if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "xx") ) { printf ("Error for setting NAN (2)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */ - res = mpfr_strtofr (x, "NAN(abcdEDF__1256)Hello", &s, 10, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */ + res = mpfr_strtofr (x, "NAN(abcdEDF__1256)Hello", &s, 10, MPFR_RNDN); if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "Hello") ) { printf ("Error for setting NAN (3)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */ - res = mpfr_strtofr (x, "NAN(abcdEDF)__1256)Hello", &s, 10, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */ + res = mpfr_strtofr (x, "NAN(abcdEDF)__1256)Hello", &s, 10, MPFR_RNDN); if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "__1256)Hello") ) { printf ("Error for setting NAN (4)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */ - res = mpfr_strtofr (x, "NAN(abc%dEDF)__1256)Hello", &s, 10, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */ + res = mpfr_strtofr (x, "NAN(abc%dEDF)__1256)Hello", &s, 10, MPFR_RNDN); if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "(abc%dEDF)__1256)Hello") ) { printf ("Error for setting NAN (5)\n"); exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); /* make sure that x is modified */ - res = mpfr_strtofr (x, "NAN((abc))", &s, 10, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */ + res = mpfr_strtofr (x, "NAN((abc))", &s, 10, MPFR_RNDN); if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "((abc))") ) { printf ("Error for setting NAN (6)\n"); @@ -109,21 +109,21 @@ check_special (void) } /* Check INF */ - res = mpfr_strtofr (x, "INFINITY", &s, 8, GMP_RNDN); + res = mpfr_strtofr (x, "INFINITY", &s, 8, MPFR_RNDN); if (res != 0 || !mpfr_inf_p (x) || *s != 0) { printf ("Error for setting INFINITY (1)\n s=%s\n x=", s); mpfr_dump (x); exit (1); } - res = mpfr_strtofr (x, "INFANITY", &s, 8, GMP_RNDN); + res = mpfr_strtofr (x, "INFANITY", &s, 8, MPFR_RNDN); if (res != 0 || !mpfr_inf_p (x) || strcmp(s, "ANITY")) { printf ("Error for setting INFINITY (2)\n s=%s\n x=", s); mpfr_dump (x); exit (1); } - res = mpfr_strtofr (x, "@INF@*2", &s, 11, GMP_RNDN); + res = mpfr_strtofr (x, "@INF@*2", &s, 11, MPFR_RNDN); if (res != 0 || !mpfr_inf_p (x) || strcmp(s, "*2")) { printf ("Error for setting INFINITY (3)\n s=%s\n x=", s); @@ -132,7 +132,7 @@ check_special (void) } /* Check Zero */ - res = mpfr_strtofr (x, " 00000", &s, 11, GMP_RNDN); + res = mpfr_strtofr (x, " 00000", &s, 11, MPFR_RNDN); if (res != 0 || !mpfr_zero_p (x) || s[0] != 0) { printf ("Error for setting ZERO (1)\n s=%s\n x=", s); @@ -141,95 +141,95 @@ check_special (void) } /* Check base 62 */ - res = mpfr_strtofr (x, "A", NULL, 62, GMP_RNDN); + res = mpfr_strtofr (x, "A", NULL, 62, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (x, 10)) { printf ("Error for setting 'A' in base 62\n x="); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - res = mpfr_strtofr (x, "a", NULL, 62, GMP_RNDN); + res = mpfr_strtofr (x, "a", NULL, 62, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (x, 36)) { printf ("Error for setting 'a' in base 62\n x="); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - res = mpfr_strtofr (x, "Z", NULL, 62, GMP_RNDN); + res = mpfr_strtofr (x, "Z", NULL, 62, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (x, 35)) { printf ("Error for setting 'Z' in base 62\n x="); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - res = mpfr_strtofr (x, "z", NULL, 62, GMP_RNDN); + res = mpfr_strtofr (x, "z", NULL, 62, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (x, 61)) { printf ("Error for setting 'z' in base 62\n x="); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - res = mpfr_strtofr (x, "ZA", NULL, 62, GMP_RNDN); + res = mpfr_strtofr (x, "ZA", NULL, 62, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (x, 2180)) { printf ("Error for setting 'ZA' in base 62\n x="); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - res = mpfr_strtofr (x, "za", NULL, 62, GMP_RNDN); + res = mpfr_strtofr (x, "za", NULL, 62, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (x, 3818)) { printf ("Error for setting 'za' in base 62\n x="); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - res = mpfr_strtofr (x, "aZ", NULL, 62, GMP_RNDN); + res = mpfr_strtofr (x, "aZ", NULL, 62, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (x, 2267)) { printf ("Error for setting 'aZ' in base 62\n x="); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - res = mpfr_strtofr (x, "Az", NULL, 62, GMP_RNDN); + res = mpfr_strtofr (x, "Az", NULL, 62, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (x, 681)) { printf ("Error for setting 'Az' in base 62\n x="); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } /* Check base 60 */ - res = mpfr_strtofr (x, "Aa", NULL, 60, GMP_RNDN); + res = mpfr_strtofr (x, "Aa", NULL, 60, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (x, 636)) { printf ("Error for setting 'Aa' in base 60\n x="); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - res = mpfr_strtofr (x, "Zz", &s, 60, GMP_RNDN); + res = mpfr_strtofr (x, "Zz", &s, 60, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (x, 35) || strcmp(s, "z") ) { printf ("Error for setting 'Zz' in base 60\n x="); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } /* Check base 61 */ - res = mpfr_strtofr (x, "z", &s, 61, GMP_RNDN); + res = mpfr_strtofr (x, "z", &s, 61, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (x, 0) || strcmp(s, "z") ) { printf ("Error for setting 'z' in base 61\n x="); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } @@ -269,11 +269,11 @@ main (void) e = randomab (-1<<15, 1<<15); mpfr_set_prec (x, p); mpfr_urandomb (x, RANDS); - mpfr_mul_2si (x, x, e, GMP_RNDN); + mpfr_mul_2si (x, x, e, MPFR_RNDN); printf("{%lu, %d,\n\"", p, base); - mpfr_out_str (stdout, base, p, x, GMP_RNDN); + mpfr_out_str (stdout, base, p, x, MPFR_RNDN); printf ("\",\n\""); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\"}%c\n", i == MAX_NUM-1 ? ' ' : ',' ); } printf("};\n"); @@ -606,7 +606,7 @@ check_reftable (void) mpfr_set_prec (x, p); mpfr_set_prec (y, p); mpfr_set_str_binary (x, RefTable[i].binstr); - mpfr_strtofr (y, RefTable[i].str, &s, base, GMP_RNDN); + mpfr_strtofr (y, RefTable[i].str, &s, base, MPFR_RNDN); if (s == NULL || *s != 0) { printf ("strtofr didn't parse entire input for i=%d:\n" @@ -621,10 +621,10 @@ check_reftable (void) printf (" strtofr gives: "); mpfr_dump (y); printf (" setstr gives: "); - mpfr_set_str (x, RefTable[i].str, base, GMP_RNDN); + mpfr_set_str (x, RefTable[i].str, base, MPFR_RNDN); mpfr_dump (x); mpfr_set_prec (x, 2*p); - mpfr_set_str (x, RefTable[i].str, base, GMP_RNDN); + mpfr_set_str (x, RefTable[i].str, base, MPFR_RNDN); printf (" setstr ++ gives: "); mpfr_dump (x); exit (1); @@ -644,8 +644,8 @@ check_parse (void) mpfr_init (x); /* Invalid data */ - mpfr_set_si (x, -1, GMP_RNDN); - res = mpfr_strtofr (x, " invalid", NULL, 10, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + res = mpfr_strtofr (x, " invalid", NULL, 10, MPFR_RNDN); if (MPFR_NOTZERO (x) || MPFR_IS_NEG (x)) { printf ("Failed parsing ' invalid' (1)\n X="); @@ -653,8 +653,8 @@ check_parse (void) exit (1); } MPFR_ASSERTN (res == 0); - mpfr_set_si (x, -1, GMP_RNDN); - res = mpfr_strtofr (x, " invalid", &s, 0, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + res = mpfr_strtofr (x, " invalid", &s, 0, MPFR_RNDN); if (MPFR_NOTZERO (x) || MPFR_IS_NEG (x) || strcmp (s, " invalid")) { printf ("Failed parsing ' invalid' (2)\n S=%s\n X=", s); @@ -663,7 +663,7 @@ check_parse (void) } MPFR_ASSERTN (res == 0); /* Check if it stops correctly */ - mpfr_strtofr (x, "15*x", &s, 10, GMP_RNDN); + mpfr_strtofr (x, "15*x", &s, 10, MPFR_RNDN); if (mpfr_cmp_ui (x, 15) || strcmp (s, "*x")) { printf ("Failed parsing '15*x'\n S=%s\n X=", s); @@ -671,7 +671,7 @@ check_parse (void) exit (1); } /* Check for leading spaces */ - mpfr_strtofr (x, " 1.5E-10 *x^2", &s, 10, GMP_RNDN); + mpfr_strtofr (x, " 1.5E-10 *x^2", &s, 10, MPFR_RNDN); if (mpfr_cmp_str1 (x, "1.5E-10") || strcmp (s, " *x^2")) { printf ("Failed parsing '1.5E-10*x^2'\n S=%s\n X=", s); @@ -679,196 +679,196 @@ check_parse (void) exit (1); } /* Check for leading sign */ - mpfr_strtofr (x, " +17.5E-42E ", &s, 10, GMP_RNDN); + mpfr_strtofr (x, " +17.5E-42E ", &s, 10, MPFR_RNDN); if (mpfr_cmp_str1 (x, "17.5E-42") || strcmp (s, "E ")) { printf ("Failed parsing '+17.5E-42E '\n S=%s\n X=", s); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, "-17.5E+42E\n", &s, 10, GMP_RNDN); + mpfr_strtofr (x, "-17.5E+42E\n", &s, 10, MPFR_RNDN); if (mpfr_cmp_str1 (x, "-17.5E42") || strcmp (s, "E\n")) { printf ("Failed parsing '-17.5E+42\\n'\n S=%s\n X=", s); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } /* P form */ - mpfr_strtofr (x, "0x42P17", &s, 16, GMP_RNDN); - if (mpfr_cmp_str (x, "8650752", 10, GMP_RNDN) || *s != 0) + mpfr_strtofr (x, "0x42P17", &s, 16, MPFR_RNDN); + if (mpfr_cmp_str (x, "8650752", 10, MPFR_RNDN) || *s != 0) { printf ("Failed parsing '0x42P17' (base = 16)\n S='%s'\n X=", s); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, "-0X42p17", &s, 16, GMP_RNDN); - if (mpfr_cmp_str (x, "-8650752", 10, GMP_RNDN) || *s != 0) + mpfr_strtofr (x, "-0X42p17", &s, 16, MPFR_RNDN); + if (mpfr_cmp_str (x, "-8650752", 10, MPFR_RNDN) || *s != 0) { printf ("Failed parsing '-0x42p17' (base = 16)\n S='%s'\n X=", s); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, "42p17", &s, 16, GMP_RNDN); - if (mpfr_cmp_str (x, "8650752", 10, GMP_RNDN) || *s != 0) + mpfr_strtofr (x, "42p17", &s, 16, MPFR_RNDN); + if (mpfr_cmp_str (x, "8650752", 10, MPFR_RNDN) || *s != 0) { printf ("Failed parsing '42p17' (base = 16)\n S='%s'\n X=", s); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, "-42P17", &s, 16, GMP_RNDN); - if (mpfr_cmp_str (x, "-8650752", 10, GMP_RNDN) || *s != 0) + mpfr_strtofr (x, "-42P17", &s, 16, MPFR_RNDN); + if (mpfr_cmp_str (x, "-8650752", 10, MPFR_RNDN) || *s != 0) { printf ("Failed parsing '-42P17' (base = 16)\n S='%s'\n X=", s); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, "0b1001P17", &s, 2, GMP_RNDN); - if (mpfr_cmp_str (x, "1179648", 10, GMP_RNDN) || *s != 0) + mpfr_strtofr (x, "0b1001P17", &s, 2, MPFR_RNDN); + if (mpfr_cmp_str (x, "1179648", 10, MPFR_RNDN) || *s != 0) { printf ("Failed parsing '0b1001P17' (base = 2)\n S='%s'\n X=", s); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, "-0B1001p17", &s, 2, GMP_RNDN); - if (mpfr_cmp_str (x, "-1179648", 10, GMP_RNDN) || *s != 0) + mpfr_strtofr (x, "-0B1001p17", &s, 2, MPFR_RNDN); + if (mpfr_cmp_str (x, "-1179648", 10, MPFR_RNDN) || *s != 0) { printf ("Failed parsing '-0B1001p17' (base = 2)\n S='%s'\n X=", s); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, "1001p17", &s, 2, GMP_RNDN); - if (mpfr_cmp_str (x, "1179648", 10, GMP_RNDN) || *s != 0) + mpfr_strtofr (x, "1001p17", &s, 2, MPFR_RNDN); + if (mpfr_cmp_str (x, "1179648", 10, MPFR_RNDN) || *s != 0) { printf ("Failed parsing '1001p17' (base = 2)\n S='%s'\n X=", s); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, "-1001P17", &s, 2, GMP_RNDN); - if (mpfr_cmp_str (x, "-1179648", 10, GMP_RNDN) || *s != 0) + mpfr_strtofr (x, "-1001P17", &s, 2, MPFR_RNDN); + if (mpfr_cmp_str (x, "-1179648", 10, MPFR_RNDN) || *s != 0) { printf ("Failed parsing '-1001P17' (base = 2)\n S='%s'\n X=", s); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } /* Check for auto-detection of the base */ - mpfr_strtofr (x, "+0x42P17", &s, 0, GMP_RNDN); - if (mpfr_cmp_str (x, "42P17", 16, GMP_RNDN) || *s != 0) + mpfr_strtofr (x, "+0x42P17", &s, 0, MPFR_RNDN); + if (mpfr_cmp_str (x, "42P17", 16, MPFR_RNDN) || *s != 0) { printf ("Failed parsing '+0x42P17'\n S=%s\n X=", s); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, "-42E17", &s, 0, GMP_RNDN); - if (mpfr_cmp_str (x, "-42E17", 10, GMP_RNDN) || *s != 0) + mpfr_strtofr (x, "-42E17", &s, 0, MPFR_RNDN); + if (mpfr_cmp_str (x, "-42E17", 10, MPFR_RNDN) || *s != 0) { printf ("Failed parsing '-42E17'\n S=%s\n X=", s); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, "-42P17", &s, 0, GMP_RNDN); - if (mpfr_cmp_str (x, "-42", 10, GMP_RNDN) || strcmp (s, "P17")) + mpfr_strtofr (x, "-42P17", &s, 0, MPFR_RNDN); + if (mpfr_cmp_str (x, "-42", 10, MPFR_RNDN) || strcmp (s, "P17")) { printf ("Failed parsing '-42P17' (base = 0)\n S='%s'\n X=", s); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, " 0b0101.011@42", &s, 0, GMP_RNDN); - if (mpfr_cmp_str (x, "0101.011@42", 2, GMP_RNDN) || *s != 0) + mpfr_strtofr (x, " 0b0101.011@42", &s, 0, MPFR_RNDN); + if (mpfr_cmp_str (x, "0101.011@42", 2, MPFR_RNDN) || *s != 0) { printf ("Failed parsing '0101.011@42'\n S=%s\n X=", s); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, " 0b0101.011P42", &s, 0, GMP_RNDN); - if (mpfr_cmp_str (x, "0101.011@42", 2, GMP_RNDN) || *s != 0) + mpfr_strtofr (x, " 0b0101.011P42", &s, 0, MPFR_RNDN); + if (mpfr_cmp_str (x, "0101.011@42", 2, MPFR_RNDN) || *s != 0) { printf ("Failed parsing '0101.011@42'\n S=%s\n X=", s); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, "+0x42@17", &s, 0, GMP_RNDN); - if (mpfr_cmp_str (x, "4.2@18", 16, GMP_RNDN) || *s != 0) + mpfr_strtofr (x, "+0x42@17", &s, 0, MPFR_RNDN); + if (mpfr_cmp_str (x, "4.2@18", 16, MPFR_RNDN) || *s != 0) { printf ("Failed parsing '+0x42P17'\n S=%s\n X=", s); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } /* Check for space inside the mantissa */ - mpfr_strtofr (x, "+0x4 2@17", &s, 0, GMP_RNDN); + mpfr_strtofr (x, "+0x4 2@17", &s, 0, MPFR_RNDN); if (mpfr_cmp_ui (x, 4) || strcmp(s," 2@17")) { printf ("Failed parsing '+0x4 2@17'\n S=%s\n X=", s); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, "+0x42 P17", &s, 0, GMP_RNDN); + mpfr_strtofr (x, "+0x42 P17", &s, 0, MPFR_RNDN); if (mpfr_cmp_ui (x, 0x42) || strcmp(s," P17")) { printf ("Failed parsing '+0x42 P17'\n S=%s\n X=", s); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } /* Space between mantissa and exponent */ - mpfr_strtofr (x, " -0b0101P 17", &s, 0, GMP_RNDN); + mpfr_strtofr (x, " -0b0101P 17", &s, 0, MPFR_RNDN); if (mpfr_cmp_si (x, -5) || strcmp(s,"P 17")) { printf ("Failed parsing '-0b0101P 17'\n S=%s\n X=", s); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } /* Check for Invalid exponent. */ - mpfr_strtofr (x, " -0b0101PF17", &s, 0, GMP_RNDN); + mpfr_strtofr (x, " -0b0101PF17", &s, 0, MPFR_RNDN); if (mpfr_cmp_si (x, -5) || strcmp(s,"PF17")) { printf ("Failed parsing '-0b0101PF17'\n S=%s\n X=", s); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } /* At least one digit in the mantissa. */ - mpfr_strtofr (x, " .E10", &s, 0, GMP_RNDN); + mpfr_strtofr (x, " .E10", &s, 0, MPFR_RNDN); if (strcmp(s," .E10")) { printf ("Failed parsing ' .E10'\n S=%s\n X=", s); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } /* Check 2 '.': 2.3.4 */ - mpfr_strtofr (x, "-1.2.3E4", &s, 0, GMP_RNDN); + mpfr_strtofr (x, "-1.2.3E4", &s, 0, MPFR_RNDN); if (mpfr_cmp_str1 (x, "-1.2") || strcmp(s,".3E4")) { printf ("Failed parsing '-1.2.3E4'\n S=%s\n X=", s); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } /* Check for 0x and 0b */ - mpfr_strtofr (x, " 0xG", &s, 0, GMP_RNDN); + mpfr_strtofr (x, " 0xG", &s, 0, MPFR_RNDN); if (mpfr_cmp_ui (x, 0) || strcmp(s,"xG")) { printf ("Failed parsing ' 0xG'\n S=%s\n X=", s); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, " 0b2", &s, 0, GMP_RNDN); + mpfr_strtofr (x, " 0b2", &s, 0, MPFR_RNDN); if (mpfr_cmp_ui (x, 0) || strcmp(s,"b2")) { printf ("Failed parsing ' 0b2'\n S=%s\n X=", s); - mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, "-0x.23@2Z33", &s, 0, GMP_RNDN); + mpfr_strtofr (x, "-0x.23@2Z33", &s, 0, MPFR_RNDN); if (mpfr_cmp_si (x, -0x23) || strcmp(s,"Z33")) { printf ("Failed parsing '-0x.23@2Z33'\n S=%s\n X=", s); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } - mpfr_strtofr (x, " 0x", &s, 0, GMP_RNDN); + mpfr_strtofr (x, " 0x", &s, 0, MPFR_RNDN); if (mpfr_cmp_ui (x, 0) || strcmp(s,"x")) { printf ("Failed parsing ' 0x'\n S=%s\n X=", s); - mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); putchar ('\n'); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n'); exit (1); } @@ -884,14 +884,14 @@ check_overflow (void) mpfr_init (x); /* Huge overflow */ - mpfr_strtofr (x, "123456789E2147483646", &s, 0, GMP_RNDN); + mpfr_strtofr (x, "123456789E2147483646", &s, 0, MPFR_RNDN); if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x) ) { printf ("Check overflow failed (1) with:\n s=%s\n x=", s); mpfr_dump (x); exit (1); } - mpfr_strtofr (x, "123456789E9223372036854775807", &s, 0, GMP_RNDN); + mpfr_strtofr (x, "123456789E9223372036854775807", &s, 0, MPFR_RNDN); if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x) ) { printf ("Check overflow failed (2) with:\n s='%s'\n x=", s); @@ -899,7 +899,7 @@ check_overflow (void) exit (1); } mpfr_strtofr (x, "123456789E170141183460469231731687303715884105728", - &s, 0, GMP_RNDN); + &s, 0, MPFR_RNDN); if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x) ) { printf ("Check overflow failed (3) with:\n s=%s\n x=", s); @@ -908,28 +908,28 @@ check_overflow (void) } /* Limit overflow */ - mpfr_strtofr (x, "12E2147483646", &s, 0, GMP_RNDN); + mpfr_strtofr (x, "12E2147483646", &s, 0, MPFR_RNDN); if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x) ) { printf ("Check overflow failed (4) with:\n s=%s\n x=", s); mpfr_dump (x); exit (1); } - mpfr_strtofr (x, "12E2147483645", &s, 0, GMP_RNDN); + mpfr_strtofr (x, "12E2147483645", &s, 0, MPFR_RNDN); if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x)) { printf ("Check overflow failed (5) with:\n s=%s\n x=", s); mpfr_dump (x); exit (1); } - mpfr_strtofr (x, "0123456789ABCDEF@2147483640", &s, 16, GMP_RNDN); + mpfr_strtofr (x, "0123456789ABCDEF@2147483640", &s, 16, MPFR_RNDN); if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x)) { printf ("Check overflow failed (6) with:\n s=%s\n x=", s); mpfr_dump (x); exit (1); } - mpfr_strtofr (x, "0123456789ABCDEF@540000000", &s, 16, GMP_RNDN); + mpfr_strtofr (x, "0123456789ABCDEF@540000000", &s, 16, MPFR_RNDN); if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x)) { printf ("Check overflow failed (7) with:\n s=%s\n x=", s); @@ -938,14 +938,14 @@ check_overflow (void) } /* Check underflow */ - mpfr_strtofr (x, "123456789E-2147483646", &s, 0, GMP_RNDN); + mpfr_strtofr (x, "123456789E-2147483646", &s, 0, MPFR_RNDN); if (s[0] != 0 || !MPFR_IS_ZERO (x) || !MPFR_IS_POS (x) ) { printf ("Check underflow failed (1) with:\n s=%s\n x=", s); mpfr_dump (x); exit (1); } - mpfr_strtofr (x, "123456789E-9223372036854775807", &s, 0, GMP_RNDN); + mpfr_strtofr (x, "123456789E-9223372036854775807", &s, 0, MPFR_RNDN); if (s[0] != 0 || !MPFR_IS_ZERO (x) || !MPFR_IS_POS (x) ) { printf ("Check underflow failed (2) with:\n s='%s'\n x=", s); @@ -953,14 +953,14 @@ check_overflow (void) exit (1); } mpfr_strtofr (x, "-123456789E-170141183460469231731687303715884105728", - &s, 0, GMP_RNDN); + &s, 0, MPFR_RNDN); if (s[0] != 0 || !MPFR_IS_ZERO (x) || !MPFR_IS_NEG (x) ) { printf ("Check underflow failed (3) with:\n s=%s\n x=", s); mpfr_dump (x); exit (1); } - mpfr_strtofr (x, "0123456789ABCDEF@-540000000", &s, 16, GMP_RNDN); + mpfr_strtofr (x, "0123456789ABCDEF@-540000000", &s, 16, MPFR_RNDN); if (s[0] != 0 || !MPFR_IS_ZERO (x) || !MPFR_IS_POS (x)) { printf ("Check overflow failed (7) with:\n s=%s\n x=", s); @@ -979,11 +979,11 @@ check_retval (void) mpfr_init2 (x, 10); - res = mpfr_strtofr (x, "01011000111", NULL, 2, GMP_RNDN); + res = mpfr_strtofr (x, "01011000111", NULL, 2, MPFR_RNDN); MPFR_ASSERTN (res == 0); - res = mpfr_strtofr (x, "11011000111", NULL, 2, GMP_RNDN); + res = mpfr_strtofr (x, "11011000111", NULL, 2, MPFR_RNDN); MPFR_ASSERTN (res > 0); - res = mpfr_strtofr (x, "110110001101", NULL, 2, GMP_RNDN); + res = mpfr_strtofr (x, "110110001101", NULL, 2, MPFR_RNDN); MPFR_ASSERTN (res < 0); mpfr_clear (x); @@ -996,32 +996,32 @@ static struct bug20081025_test { const char *str; const char *binstr; } Bug20081028Table[] = { - {GMP_RNDN, -1, "1.00000000000000000006", "1"}, - {GMP_RNDZ, -1, "1.00000000000000000006", "1"}, - {GMP_RNDU, +1, "1.00000000000000000006", + {MPFR_RNDN, -1, "1.00000000000000000006", "1"}, + {MPFR_RNDZ, -1, "1.00000000000000000006", "1"}, + {MPFR_RNDU, +1, "1.00000000000000000006", "10000000000000000000000000000001e-31"}, - {GMP_RNDD, -1, "1.00000000000000000006", "1"}, + {MPFR_RNDD, -1, "1.00000000000000000006", "1"}, - {GMP_RNDN, +1, "-1.00000000000000000006", "-1"}, - {GMP_RNDZ, +1, "-1.00000000000000000006", "-1"}, - {GMP_RNDU, +1, "-1.00000000000000000006", "-1"}, - {GMP_RNDD, -1, "-1.00000000000000000006", + {MPFR_RNDN, +1, "-1.00000000000000000006", "-1"}, + {MPFR_RNDZ, +1, "-1.00000000000000000006", "-1"}, + {MPFR_RNDU, +1, "-1.00000000000000000006", "-1"}, + {MPFR_RNDD, -1, "-1.00000000000000000006", "-10000000000000000000000000000001e-31"}, - {GMP_RNDN, +1, "0.999999999999999999999999999999999999999999999", "1"}, - {GMP_RNDZ, -1, "0.999999999999999999999999999999999999999999999", + {MPFR_RNDN, +1, "0.999999999999999999999999999999999999999999999", "1"}, + {MPFR_RNDZ, -1, "0.999999999999999999999999999999999999999999999", "11111111111111111111111111111111e-32"}, - {GMP_RNDU, +1, "0.999999999999999999999999999999999999999999999", "1"}, - {GMP_RNDD, -1, "0.999999999999999999999999999999999999999999999", + {MPFR_RNDU, +1, "0.999999999999999999999999999999999999999999999", "1"}, + {MPFR_RNDD, -1, "0.999999999999999999999999999999999999999999999", "11111111111111111111111111111111e-32"}, - {GMP_RNDN, -1, "-0.999999999999999999999999999999999999999999999", "-1"}, - {GMP_RNDZ, +1, "-0.999999999999999999999999999999999999999999999", + {MPFR_RNDN, -1, "-0.999999999999999999999999999999999999999999999", "-1"}, + {MPFR_RNDZ, +1, "-0.999999999999999999999999999999999999999999999", "-11111111111111111111111111111111e-32"}, - {GMP_RNDU, +1, "-0.999999999999999999999999999999999999999999999", + {MPFR_RNDU, +1, "-0.999999999999999999999999999999999999999999999", "-11111111111111111111111111111111e-32"}, - {GMP_RNDD, -1, "-0.999999999999999999999999999999999999999999999", "-1"} + {MPFR_RNDD, -1, "-0.999999999999999999999999999999999999999999999", "-1"} }; static void diff --git a/tests/tsub.c b/tests/tsub.c index d2967a60c..e69feceb6 100644 --- a/tests/tsub.c +++ b/tests/tsub.c @@ -30,7 +30,7 @@ static int test_sub (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) { int res; - int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_number_p (c); + int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c); if (ok) { mpfr_print_raw (b); @@ -66,7 +66,7 @@ check_diverse (void) mpfr_set_prec (z, 2); mpfr_setmax (y, __gmpfr_emax); mpfr_set_str_binary (z, "0.1E-10"); /* tiny */ - test_sub (x, y, z, GMP_RNDN); /* should round to 2^emax, i.e. overflow */ + test_sub (x, y, z, MPFR_RNDN); /* should round to 2^emax, i.e. overflow */ if (!mpfr_inf_p (x) || mpfr_sgn (x) < 0) { printf ("Error in mpfr_sub(a,b,c,RNDN) for b=maxfloat, prec(a)prec(x)\n"); exit (1); } - if (test_sub (x, z, y, GMP_RNDN) >= 0) + if (test_sub (x, z, y, MPFR_RNDN) >= 0) { printf ("Wrong inexact flag in x=mpfr_sub(z,0) for prec(z)>prec(x)\n"); exit (1); @@ -325,13 +325,13 @@ bug_ddefour(void) mpfr_init2(tot, 150); mpfr_init2(tot1, 150); - mpfr_set_ui( ex, 1, GMP_RNDN); - mpfr_mul_2exp( ex, ex, 906, GMP_RNDN); - mpfr_log( tot, ex, GMP_RNDN); - mpfr_set( ex1, tot, GMP_RNDN); /* ex1 = high(tot) */ - test_sub( ex2, tot, ex1, GMP_RNDN); /* ex2 = high(tot - ex1) */ - test_sub( tot1, tot, ex1, GMP_RNDN); /* tot1 = tot - ex1 */ - mpfr_set( ex3, tot1, GMP_RNDN); /* ex3 = high(tot - ex1) */ + mpfr_set_ui( ex, 1, MPFR_RNDN); + mpfr_mul_2exp( ex, ex, 906, MPFR_RNDN); + mpfr_log( tot, ex, MPFR_RNDN); + mpfr_set( ex1, tot, MPFR_RNDN); /* ex1 = high(tot) */ + test_sub( ex2, tot, ex1, MPFR_RNDN); /* ex2 = high(tot - ex1) */ + test_sub( tot1, tot, ex1, MPFR_RNDN); /* tot1 = tot - ex1 */ + mpfr_set( ex3, tot1, MPFR_RNDN); /* ex3 = high(tot - ex1) */ if (mpfr_cmp(ex2, ex3)) { @@ -366,7 +366,7 @@ check_two_sum (mp_prec_t p) mpfr_urandomb (y, RANDS); if (mpfr_cmpabs (x, y) < 0) mpfr_swap (x, y); - rnd = GMP_RNDN; + rnd = MPFR_RNDN; inexact = test_sub (u, x, y, rnd); test_sub (v, u, x, rnd); mpfr_add (w, v, y, rnd); @@ -408,12 +408,12 @@ check_inexact (void) mpfr_init (u); mpfr_set_prec (x, 2); - mpfr_set_ui (x, 6, GMP_RNDN); - mpfr_div_2exp (x, x, 4, GMP_RNDN); /* x = 6/16 */ + mpfr_set_ui (x, 6, MPFR_RNDN); + mpfr_div_2exp (x, x, 4, MPFR_RNDN); /* x = 6/16 */ mpfr_set_prec (y, 2); - mpfr_set_si (y, -1, GMP_RNDN); - mpfr_div_2exp (y, y, 4, GMP_RNDN); /* y = -1/16 */ - inexact = test_sub (y, y, x, GMP_RNDN); /* y = round(-7/16) = -1/2 */ + mpfr_set_si (y, -1, MPFR_RNDN); + mpfr_div_2exp (y, y, 4, MPFR_RNDN); /* y = -1/16 */ + inexact = test_sub (y, y, x, MPFR_RNDN); /* y = round(-7/16) = -1/2 */ if (inexact >= 0) { printf ("Error: wrong inexact flag for -1/16 - (6/16)\n"); diff --git a/tests/tsub1sp.c b/tests/tsub1sp.c index 0fe5c6600..2e0782e1f 100644 --- a/tests/tsub1sp.c +++ b/tests/tsub1sp.c @@ -81,7 +81,7 @@ check_random (mpfr_prec_t p) mpfr_urandomb (y, RANDS); mpfr_urandomb (z, RANDS); if (MPFR_IS_PURE_FP(y) && MPFR_IS_PURE_FP(z)) - for(r = 0 ; r < GMP_RND_MAX ; r++) + for(r = 0 ; r < MPFR_RND_MAX ; r++) { inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r); inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r); @@ -106,7 +106,7 @@ check_special (void) mpfr_inits (x, y, z, x2, (mpfr_ptr) 0); - for (r = 0 ; r < GMP_RND_MAX ; r++) + for (r = 0 ; r < MPFR_RND_MAX ; r++) { p = 53; mpfr_set_prec(x, 53); diff --git a/tests/tsub_d.c b/tests/tsub_d.c index 9350b1c20..1366d2ca2 100644 --- a/tests/tsub_d.c +++ b/tests/tsub_d.c @@ -40,7 +40,7 @@ check_nans (void) /* nan - 1.0 is nan */ mpfr_set_nan (x); mpfr_clear_flags (); - inexact = mpfr_sub_d (y, x, 1.0, GMP_RNDN); + inexact = mpfr_sub_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); MPFR_ASSERTN (mpfr_nan_p (y)); @@ -48,7 +48,7 @@ check_nans (void) /* +inf - 1.0 == +inf */ mpfr_set_inf (x, 1); mpfr_clear_flags (); - inexact = mpfr_sub_d (y, x, 1.0, GMP_RNDN); + inexact = mpfr_sub_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_inf_p (y)); @@ -57,7 +57,7 @@ check_nans (void) /* -inf - 1.0 == -inf */ mpfr_set_inf (x, -1); mpfr_clear_flags (); - inexact = mpfr_sub_d (y, x, 1.0, GMP_RNDN); + inexact = mpfr_sub_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_inf_p (y)); @@ -85,24 +85,24 @@ main (void) mpfr_init2 (y, IEEE_DBL_MANT_DIG); mpfr_init2 (z, IEEE_DBL_MANT_DIG); - mpfr_set_str (y, "4096", 10, GMP_RNDN); + mpfr_set_str (y, "4096", 10, MPFR_RNDN); d = 0.125; mpfr_clear_flags (); - inexact = mpfr_sub_d (x, y, d, GMP_RNDN); + inexact = mpfr_sub_d (x, y, d, MPFR_RNDN); if (inexact != 0) { printf ("Inexact flag error in mpfr_sub_d\n"); exit (1); } - mpfr_set_str (z, "4095.875", 10, GMP_RNDN); + mpfr_set_str (z, "4095.875", 10, MPFR_RNDN); if (mpfr_cmp (z, x)) { printf ("Error in mpfr_sub_d ("); - mpfr_out_str (stdout, 10, 7, y, GMP_RNDN); + mpfr_out_str (stdout, 10, 7, y, MPFR_RNDN); printf (" + %.20g)\nexpected ", d); - mpfr_out_str (stdout, 10, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN); printf ("\ngot "); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } diff --git a/tests/tsub_ui.c b/tests/tsub_ui.c index 680268f39..0bd2ee923 100644 --- a/tests/tsub_ui.c +++ b/tests/tsub_ui.c @@ -64,7 +64,7 @@ check_two_sum (mp_prec_t p) } while (x < 1); mpfr_urandomb (y, RANDS); - rnd = GMP_RNDN; + rnd = MPFR_RNDN; inexact = mpfr_sub_ui (u, y, x, rnd); mpfr_add_ui (v, u, x, rnd); mpfr_sub (w, v, y, rnd); @@ -96,18 +96,18 @@ check_nans (void) /* nan - 1 == nan */ mpfr_set_nan (x); - mpfr_sub_ui (y, x, 1L, GMP_RNDN); + mpfr_sub_ui (y, x, 1L, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (y)); /* +inf - 1 == +inf */ mpfr_set_inf (x, 1); - mpfr_sub_ui (y, x, 1L, GMP_RNDN); + mpfr_sub_ui (y, x, 1L, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (y)); MPFR_ASSERTN (mpfr_sgn (y) > 0); /* -inf - 1 == -inf */ mpfr_set_inf (x, -1); - mpfr_sub_ui (y, x, 1L, GMP_RNDN); + mpfr_sub_ui (y, x, 1L, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (y)); MPFR_ASSERTN (mpfr_sgn (y) < 0); @@ -134,7 +134,7 @@ main (int argc, char *argv[]) for (k=0; k<200; k++) check_two_sum (p); - check3 ("0.9999999999", 1, GMP_RNDN, + check3 ("0.9999999999", 1, MPFR_RNDN, "-10000000827403709990903735160827636718750e-50"); test_generic_ui (2, 1000, 100); diff --git a/tests/tsubnormal.c b/tests/tsubnormal.c index 42fb561ad..af3aac550 100644 --- a/tests/tsubnormal.c +++ b/tests/tsubnormal.c @@ -32,22 +32,22 @@ static const struct { mp_rnd_t rnd; const char *out; } tab[] ={ - {"1E1", 0, GMP_RNDN, "1E1"}, - {"1E1", -1, GMP_RNDZ, "1E1"}, - {"1E1", -1, GMP_RNDD, "1E1"}, - {"1E1", 1, GMP_RNDU, "1E1"}, - {"0.10000E-10", 0, GMP_RNDN, "0.1E-10"}, - {"0.10001E-10", 0, GMP_RNDN, "0.1E-10"}, - {"0.11001E-10", 0, GMP_RNDN, "0.1E-9"}, - {"0.11001E-10", 0, GMP_RNDZ, "0.1E-10"}, - {"0.11001E-10", 0, GMP_RNDU, "0.1E-9"}, - {"0.11000E-10", 0, GMP_RNDN, "0.1E-9"}, - {"0.11000E-10", -1, GMP_RNDN, "0.1E-9"}, - {"0.11000E-10", 1, GMP_RNDN, "0.1E-10"}, - {"0.11111E-8", 0, GMP_RNDN, "0.10E-7"}, - {"0.10111E-8", 0, GMP_RNDN, "0.11E-8"}, - {"0.11110E-8", -1, GMP_RNDN, "0.10E-7"}, - {"0.10110E-8", 1, GMP_RNDN, "0.101E-8"} + {"1E1", 0, MPFR_RNDN, "1E1"}, + {"1E1", -1, MPFR_RNDZ, "1E1"}, + {"1E1", -1, MPFR_RNDD, "1E1"}, + {"1E1", 1, MPFR_RNDU, "1E1"}, + {"0.10000E-10", 0, MPFR_RNDN, "0.1E-10"}, + {"0.10001E-10", 0, MPFR_RNDN, "0.1E-10"}, + {"0.11001E-10", 0, MPFR_RNDN, "0.1E-9"}, + {"0.11001E-10", 0, MPFR_RNDZ, "0.1E-10"}, + {"0.11001E-10", 0, MPFR_RNDU, "0.1E-9"}, + {"0.11000E-10", 0, MPFR_RNDN, "0.1E-9"}, + {"0.11000E-10", -1, MPFR_RNDN, "0.1E-9"}, + {"0.11000E-10", 1, MPFR_RNDN, "0.1E-10"}, + {"0.11111E-8", 0, MPFR_RNDN, "0.10E-7"}, + {"0.10111E-8", 0, MPFR_RNDN, "0.11E-8"}, + {"0.11110E-8", -1, MPFR_RNDN, "0.10E-7"}, + {"0.10110E-8", 1, MPFR_RNDN, "0.101E-8"} }; static void @@ -66,14 +66,14 @@ check1 (void) mpfr_init (x); for (i = 0; i < (sizeof (tab) / sizeof (tab[0])); i++) - for (s = 0; s <= (tab[i].rnd == GMP_RNDN); s++) + for (s = 0; s <= (tab[i].rnd == MPFR_RNDN); s++) for (k = 0; k <= 1; k++) { - mpfr_set_str (x, tab[i].in, 2, GMP_RNDN); + mpfr_set_str (x, tab[i].in, 2, MPFR_RNDN); old_inex = tab[i].i; if (s) { - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); old_inex = - old_inex; } if (k && old_inex) @@ -81,15 +81,15 @@ check1 (void) j = mpfr_subnormalize (x, old_inex, tab[i].rnd); /* TODO: test j. */ if (s) - mpfr_neg (x, x, GMP_RNDN); - if (mpfr_cmp_str (x, tab[i].out, 2, GMP_RNDN) != 0) + mpfr_neg (x, x, MPFR_RNDN); + if (mpfr_cmp_str (x, tab[i].out, 2, MPFR_RNDN) != 0) { 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); if (s) - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); mpfr_dump (x); exit (1); } @@ -117,17 +117,17 @@ check2 (void) mpfr_init2 (y, 32); mpfr_init2 (z, 32); - mpfr_set_ui (x, 0xC0000000U, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); - mpfr_set_ui (y, 0xFFFFFFFEU, GMP_RNDN); + mpfr_set_ui (x, 0xC0000000U, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_set_ui (y, 0xFFFFFFFEU, MPFR_RNDN); mpfr_set_exp (x, 0); mpfr_set_exp (y, 0); mpfr_set_emin (-29); - tern = mpfr_mul (z, x, y, GMP_RNDN); + tern = mpfr_mul (z, x, y, MPFR_RNDN); /* z = -0.BFFFFFFE, tern > 0 */ - tern = mpfr_subnormalize (z, tern, GMP_RNDN); + tern = mpfr_subnormalize (z, tern, MPFR_RNDN); /* z should be -0.75 */ MPFR_ASSERTN (tern < 0 && mpfr_cmp_si_2exp (z, -3, -2) == 0); @@ -154,18 +154,18 @@ check3 (void) mpfr_init2 (y, 32); mpfr_init2 (z, 32); - mpfr_set_ui (x, 0xBFFFFFFFU, GMP_RNDN); /* 3221225471/2^32 */ - mpfr_set_ui (y, 0x80000001U, GMP_RNDN); /* 2147483649/2^32 */ + mpfr_set_ui (x, 0xBFFFFFFFU, MPFR_RNDN); /* 3221225471/2^32 */ + mpfr_set_ui (y, 0x80000001U, MPFR_RNDN); /* 2147483649/2^32 */ mpfr_set_exp (x, 0); mpfr_set_exp (y, 0); mpfr_set_emin (-1); /* the exact product is 6917529028714823679/2^64, which is rounded to 3/8 = 0.375, which is smaller, thus tern < 0 */ - tern = mpfr_mul (z, x, y, GMP_RNDN); + tern = mpfr_mul (z, x, y, MPFR_RNDN); MPFR_ASSERTN (tern < 0 && mpfr_cmp_ui_2exp (z, 3, -3) == 0); - tern = mpfr_subnormalize (z, tern, GMP_RNDN); + tern = mpfr_subnormalize (z, tern, MPFR_RNDN); /* since emin = -1, and EXP(z)=-1, z should be rounded to precision EXP(z)-emin+1 = 1, i.e., z should be a multiple of the smallest possible positive representable value with emin=-1, which is 1/4. The two @@ -177,14 +177,14 @@ check3 (void) first, thus we have to round down */ mpfr_set_str_binary (x, "0.11111111111010110101011011011011"); mpfr_set_str_binary (y, "0.01100000000001111100000000001110"); - tern = mpfr_mul (z, x, y, GMP_RNDN); + tern = mpfr_mul (z, x, y, MPFR_RNDN); MPFR_ASSERTN (tern > 0 && mpfr_cmp_ui_2exp (z, 3, -3) == 0); - tern = mpfr_subnormalize (z, tern, GMP_RNDN); + tern = mpfr_subnormalize (z, tern, MPFR_RNDN); MPFR_ASSERTN (tern < 0 && mpfr_cmp_ui_2exp (z, 1, -2) == 0); /* finally the case where z was exact, which we simulate here */ - mpfr_set_ui_2exp (z, 3, -3, GMP_RNDN); - tern = mpfr_subnormalize (z, 0, GMP_RNDN); + mpfr_set_ui_2exp (z, 3, -3, MPFR_RNDN); + tern = mpfr_subnormalize (z, 0, MPFR_RNDN); MPFR_ASSERTN (tern > 0 && mpfr_cmp_ui_2exp (z, 1, -1) == 0); mpfr_clear (x); diff --git a/tests/tsum.c b/tests/tsum.c index c87366851..81afc0258 100644 --- a/tests/tsum.c +++ b/tests/tsum.c @@ -88,10 +88,10 @@ algo_exact (mpfr_t somme, mpfr_t *tab, unsigned long n, mp_prec_t f) prec_max = get_prec_max(tab, n, f); mpfr_set_prec (somme, prec_max); - mpfr_set_ui (somme, 0, GMP_RNDN); + mpfr_set_ui (somme, 0, MPFR_RNDN); for (i = 0; i < n; i++) { - if (mpfr_add(somme, somme, tab[i], GMP_RNDN)) + if (mpfr_add(somme, somme, tab[i], MPFR_RNDN)) { printf ("FIXME: algo_exact is buggy.\n"); exit (1); @@ -157,7 +157,7 @@ test_sum (mp_prec_t f, unsigned long n) for (i = 0; i < n; i++) mpfr_urandomb (tab[i], RANDS); algo_exact (real_non_rounded, tab, n, f); - for (rnd_mode = 0; rnd_mode < GMP_RND_MAX; rnd_mode++) + for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX; rnd_mode++) { sum_tab (sum, tab, n, (mp_rnd_t) rnd_mode); mpfr_set (real_sum, real_non_rounded, (mp_rnd_t) rnd_mode); @@ -177,7 +177,7 @@ test_sum (mp_prec_t f, unsigned long n) mpfr_set_exp (tab[i], randlimb () %1000); } algo_exact (real_non_rounded, tab, n, f); - for (rnd_mode = 0; rnd_mode < GMP_RND_MAX; rnd_mode++) + for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX; rnd_mode++) { sum_tab (sum, tab, n, (mp_rnd_t) rnd_mode); mpfr_set (real_sum, real_non_rounded, (mp_rnd_t) rnd_mode); @@ -209,24 +209,24 @@ void check_special (void) tabp[1] = tab[1]; tabp[2] = tab[2]; - i = mpfr_sum (r, tabp, 0, GMP_RNDN); + i = mpfr_sum (r, tabp, 0, MPFR_RNDN); if (!MPFR_IS_ZERO (r) || !MPFR_IS_POS (r) || i != 0) { printf ("Special case n==0 failed!\n"); exit (1); } - mpfr_set_ui (tab[0], 42, GMP_RNDN); - i = mpfr_sum (r, tabp, 1, GMP_RNDN); + mpfr_set_ui (tab[0], 42, MPFR_RNDN); + i = mpfr_sum (r, tabp, 1, MPFR_RNDN); if (mpfr_cmp_ui (r, 42) || i != 0) { printf ("Special case n==1 failed!\n"); exit (1); } - mpfr_set_ui (tab[1], 17, GMP_RNDN); + mpfr_set_ui (tab[1], 17, MPFR_RNDN); MPFR_SET_NAN (tab[2]); - i = mpfr_sum (r, tabp, 3, GMP_RNDN); + i = mpfr_sum (r, tabp, 3, MPFR_RNDN); if (!MPFR_IS_NAN (r) || i != 0) { printf ("Special case NAN failed!\n"); @@ -235,7 +235,7 @@ void check_special (void) MPFR_SET_INF (tab[2]); MPFR_SET_POS (tab[2]); - i = mpfr_sum (r, tabp, 3, GMP_RNDN); + i = mpfr_sum (r, tabp, 3, MPFR_RNDN); if (!MPFR_IS_INF (r) || !MPFR_IS_POS (r) || i != 0) { printf ("Special case +INF failed!\n"); @@ -244,7 +244,7 @@ void check_special (void) MPFR_SET_INF (tab[2]); MPFR_SET_NEG (tab[2]); - i = mpfr_sum (r, tabp, 3, GMP_RNDN); + i = mpfr_sum (r, tabp, 3, MPFR_RNDN); if (!MPFR_IS_INF (r) || !MPFR_IS_NEG (r) || i != 0) { printf ("Special case -INF failed!\n"); @@ -252,7 +252,7 @@ void check_special (void) } MPFR_SET_ZERO (tab[1]); - i = mpfr_sum (r, tabp, 2, GMP_RNDN); + i = mpfr_sum (r, tabp, 2, MPFR_RNDN); if (mpfr_cmp_ui (r, 42) || i != 0) { printf ("Special case 42+0 failed!\n"); @@ -260,7 +260,7 @@ void check_special (void) } MPFR_SET_NAN (tab[0]); - i = mpfr_sum (r, tabp, 3, GMP_RNDN); + i = mpfr_sum (r, tabp, 3, MPFR_RNDN); if (!MPFR_IS_NAN (r) || i != 0) { printf ("Special case NAN+0+-INF failed!\n"); @@ -268,9 +268,9 @@ void check_special (void) } mpfr_set_inf (tab[0], 1); - mpfr_set_ui (tab[1], 59, GMP_RNDN); + mpfr_set_ui (tab[1], 59, MPFR_RNDN); mpfr_set_inf (tab[2], -1); - i = mpfr_sum (r, tabp, 3, GMP_RNDN); + i = mpfr_sum (r, tabp, 3, MPFR_RNDN); if (!MPFR_IS_NAN (r) || i != 0) { printf ("Special case +INF + 59 +-INF failed!\n"); diff --git a/tests/tswap.c b/tests/tswap.c index c1c5299b4..36f8a76a6 100644 --- a/tests/tswap.c +++ b/tests/tswap.c @@ -34,7 +34,7 @@ main (void) mpfr_init2 (u, 24); mpfr_init2 (v, 53); - mpfr_set_ui (u, 16777215, GMP_RNDN); /* 2^24 - 1 */ + mpfr_set_ui (u, 16777215, MPFR_RNDN); /* 2^24 - 1 */ mpfr_set_str1 (v, "9007199254740991.0"); /* 2^53 - 1 */ mpfr_swap (u, v); mpfr_swap (u, v); diff --git a/tests/ttan.c b/tests/ttan.c index 2d3d66ded..3c827291a 100644 --- a/tests/ttan.c +++ b/tests/ttan.c @@ -38,7 +38,7 @@ check_nans (void) mpfr_init2 (y, 123L); mpfr_set_nan (x); - mpfr_tan (y, x, GMP_RNDN); + mpfr_tan (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: tan(NaN) != NaN\n"); @@ -46,7 +46,7 @@ check_nans (void) } mpfr_set_inf (x, 1); - mpfr_tan (y, x, GMP_RNDN); + mpfr_tan (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: tan(Inf) != NaN\n"); @@ -54,7 +54,7 @@ check_nans (void) } mpfr_set_inf (x, -1); - mpfr_tan (y, x, GMP_RNDN); + mpfr_tan (y, x, MPFR_RNDN); if (! mpfr_nan_p (y)) { printf ("Error: tan(-Inf) != NaN\n"); @@ -65,18 +65,18 @@ check_nans (void) mpfr_set_prec (x, 14); mpfr_set_str_binary (x, "0.10100000101010E0"); mpfr_set_prec (y, 24); - mpfr_tan (y, x, GMP_RNDU); + mpfr_tan (y, x, MPFR_RNDU); mpfr_set_prec (x, 24); mpfr_set_str_binary (x, "101110011011001100100001E-24"); MPFR_ASSERTN(mpfr_cmp (x, y) == 0); /* Compute ~Pi/2 to check overflow */ mpfr_set_prec (x, 20000); - mpfr_const_pi (x, GMP_RNDD); - mpfr_div_2ui (x, x, 1, GMP_RNDN); + mpfr_const_pi (x, MPFR_RNDD); + mpfr_div_2ui (x, x, 1, MPFR_RNDN); mpfr_set_prec (y, 24); - mpfr_tan (y, x, GMP_RNDN); - if (mpfr_cmp_str (y, "0.100011101101011000100011E20001", 2, GMP_RNDN)) + mpfr_tan (y, x, MPFR_RNDN); + if (mpfr_cmp_str (y, "0.100011101101011000100011E20001", 2, MPFR_RNDN)) { printf("Error computing tan(~Pi/2)\n"); mpfr_dump (y); @@ -87,7 +87,7 @@ check_nans (void) mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); mpfr_set_str_binary (x, "0.10011100110111000001000010110100101000000000000000000E34"); - mpfr_tan (y, x, GMP_RNDN); + mpfr_tan (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.1000010011001010001000010100000110100111000011010101E41"); MPFR_ASSERTN(mpfr_cmp (x, y) == 0); @@ -110,11 +110,11 @@ main (int argc, char *argv[]) mpfr_init (x); mpfr_set_prec (x, 2); - mpfr_set_str (x, "0.5", 10, GMP_RNDN); - mpfr_tan (x, x, GMP_RNDD); + mpfr_set_str (x, "0.5", 10, MPFR_RNDN); + mpfr_tan (x, x, MPFR_RNDD); if (mpfr_cmp_ui_2exp(x, 1, -1)) { - printf ("mpfr_tan(0.5, GMP_RNDD) failed\n" + printf ("mpfr_tan(0.5, MPFR_RNDD) failed\n" "expected 0.5, got"); mpfr_print_binary(x); putchar('\n'); @@ -125,10 +125,10 @@ main (int argc, char *argv[]) for (i=0; i<10; i++) { mpfr_set_prec (x, prec[i]); - mpfr_const_pi (x, GMP_RNDN); - mpfr_mul_ui (x, x, 3, GMP_RNDN); - mpfr_div_ui (x, x, 4, GMP_RNDN); - mpfr_tan (x, x, GMP_RNDN); + mpfr_const_pi (x, MPFR_RNDN); + mpfr_mul_ui (x, x, 3, MPFR_RNDN); + mpfr_div_ui (x, x, 4, MPFR_RNDN); + mpfr_tan (x, x, MPFR_RNDN); if (mpfr_cmp_si (x, -1)) { printf ("tan(3*Pi/4) fails for prec=%u\n", prec[i]); @@ -140,10 +140,10 @@ main (int argc, char *argv[]) for (i=0; i<10; i++) { mpfr_set_prec (x, prec2[i]); - mpfr_const_pi (x, GMP_RNDN); - mpfr_mul_ui (x, x, 7, GMP_RNDN); - mpfr_div_ui (x, x, 4, GMP_RNDN); - mpfr_tan (x, x, GMP_RNDN); + mpfr_const_pi (x, MPFR_RNDN); + mpfr_mul_ui (x, x, 7, MPFR_RNDN); + mpfr_div_ui (x, x, 4, MPFR_RNDN); + mpfr_tan (x, x, MPFR_RNDN); if (mpfr_cmp_si (x, -1)) { printf ("tan(3*Pi/4) fails for prec=%u\n", prec2[i]); diff --git a/tests/ttanh.c b/tests/ttanh.c index 6e14c209a..5833edccf 100644 --- a/tests/ttanh.c +++ b/tests/ttanh.c @@ -38,20 +38,20 @@ special (void) mpfr_init (x); mpfr_set_nan (x); - mpfr_tanh (x, x, GMP_RNDN); + mpfr_tanh (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (x)); mpfr_set_inf (x, 1); - mpfr_tanh (x, x, GMP_RNDN); + mpfr_tanh (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0); mpfr_set_inf (x, -1); - mpfr_tanh (x, x, GMP_RNDN); + mpfr_tanh (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_si (x, -1) == 0); mpfr_set_prec (x, 10); mpfr_set_str_binary (x, "-0.1001011001"); - mpfr_tanh (x, x, GMP_RNDN); + mpfr_tanh (x, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_si_2exp (x, -135, -8) == 0); mpfr_clear (x); @@ -74,7 +74,7 @@ special_overflow (void) mpfr_init2 (y, 24); mpfr_set_str_binary (x, "0.101100100000000000110100E7"); - i = mpfr_tanh (y, x, GMP_RNDN); + i = mpfr_tanh (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1) || i != 1) { printf("Overflow error (1). i=%d\ny=", i); @@ -83,8 +83,8 @@ special_overflow (void) } MPFR_ASSERTN (!mpfr_overflow_p ()); - i = mpfr_tanh (y, x, GMP_RNDZ); - if (mpfr_cmp_str (y, "0.111111111111111111111111E0", 2, GMP_RNDN) + i = mpfr_tanh (y, x, MPFR_RNDZ); + if (mpfr_cmp_str (y, "0.111111111111111111111111E0", 2, MPFR_RNDN) || i != -1) { printf("Overflow error (2).i=%d\ny=", i); @@ -97,7 +97,7 @@ special_overflow (void) set_emax (emax); mpfr_set_str_binary (x, "0.1E1000000000"); - i = mpfr_tanh (y, x, GMP_RNDN); + i = mpfr_tanh (y, x, MPFR_RNDN); if (mpfr_cmp_ui (y, 1) || i != 1) { printf("Overflow error (3). i=%d\ny=", i); @@ -106,8 +106,8 @@ special_overflow (void) } MPFR_ASSERTN (!mpfr_overflow_p ()); mpfr_set_str_binary (x, "-0.1E1000000000"); - i = mpfr_tanh (y, x, GMP_RNDU); - if (mpfr_cmp_str (y, "-0.111111111111111111111111E0", 2, GMP_RNDN) + i = mpfr_tanh (y, x, MPFR_RNDU); + if (mpfr_cmp_str (y, "-0.111111111111111111111111E0", 2, MPFR_RNDN) || i != 1) { printf("Overflow error (4). i=%d\ny=", i); diff --git a/tests/ttrunc.c b/tests/ttrunc.c index 0de72029c..e45709daa 100644 --- a/tests/ttrunc.c +++ b/tests/ttrunc.c @@ -47,7 +47,7 @@ main (void) exit (1); } - mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_ceil(y, x); if (mpfr_cmp_ui(y,0)) { @@ -57,7 +57,7 @@ main (void) exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_ceil(y, x); if (mpfr_cmp_ui(y,1)) { @@ -82,13 +82,13 @@ main (void) mpfr_set_prec(t2, k); mpfr_floor(y, x); - mpfr_set(y2, x, GMP_RNDD); + mpfr_set(y2, x, MPFR_RNDD); mpfr_trunc(z, x); - mpfr_set(z2, x, GMP_RNDZ); + mpfr_set(z2, x, MPFR_RNDZ); mpfr_ceil(t, x); - mpfr_set(t2, x, GMP_RNDU); + mpfr_set(t2, x, MPFR_RNDU); if (!mpfr_eq(y, y2, k)) { diff --git a/tests/tui_div.c b/tests/tui_div.c index 8f3ffca80..ec5acdcfd 100644 --- a/tests/tui_div.c +++ b/tests/tui_div.c @@ -37,7 +37,7 @@ check (unsigned long y, const char *xs, mp_rnd_t rnd_mode, const char *zs) if (mpfr_cmp_str1(zz, zs)) { printf ("expected quotient is %s, got ", zs); - mpfr_out_str (stdout, 10, 0, zz, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, zz, MPFR_RNDN); printf ("mpfr_ui_div failed for y=%lu x=%s with rnd_mode=%s\n", y, xs, mpfr_print_rnd_mode (rnd_mode)); exit (1); @@ -71,7 +71,7 @@ check_inexact (void) { mpfr_set_prec (y, py); mpfr_set_prec (z, py + px); - for (rnd = 0; rnd < GMP_RND_MAX; rnd++) + for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) { inexact = mpfr_ui_div (y, u, x, (mp_rnd_t) rnd); if (mpfr_mul (z, y, x, (mp_rnd_t) rnd)) @@ -113,7 +113,7 @@ check_nan (void) MPFR_CLEAR_FLAGS (d); MPFR_SET_INF (d); MPFR_SET_POS (d); - MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, GMP_RNDZ) == 0); /* exact */ + MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_number_p (q)); MPFR_ASSERTN (mpfr_sgn (q) == 0); @@ -121,39 +121,39 @@ check_nan (void) MPFR_CLEAR_FLAGS (d); MPFR_SET_INF (d); MPFR_SET_NEG (d); - MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, GMP_RNDZ) == 0); /* exact */ + MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_number_p (q)); MPFR_ASSERTN (mpfr_sgn (q) == 0); /* 1/nan == nan */ MPFR_SET_NAN (d); - MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, GMP_RNDZ) == 0); /* exact */ + MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_nan_p (q)); /* 0/0 == nan */ - mpfr_set_ui (d, 0L, GMP_RNDN); - MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_ui (d, 0L, MPFR_RNDN); + MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_nan_p (q)); /* 1/+0 = +inf */ - mpfr_set_ui (d, 0L, GMP_RNDN); - MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_ui (d, 0L, MPFR_RNDN); + MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0); /* 1/-0 = -inf */ - mpfr_set_ui (d, 0L, GMP_RNDN); - mpfr_neg (d, d, GMP_RNDN); - MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_ui (d, 0L, MPFR_RNDN); + mpfr_neg (d, d, MPFR_RNDN); + MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) < 0); /* 0/1 = +0 */ - mpfr_set_ui (d, 1L, GMP_RNDN); - MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_ui (d, 1L, MPFR_RNDN); + MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_cmp_ui (q, 0) == 0 && MPFR_IS_POS (q)); /* 0/-1 = -0 */ - mpfr_set_si (d, -1, GMP_RNDN); - MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_si (d, -1, MPFR_RNDN); + MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_cmp_ui (q, 0) == 0 && MPFR_IS_NEG (q)); mpfr_clear (d); @@ -173,15 +173,15 @@ main (int argc, char *argv[]) check_nan (); check_inexact (); - check(948002822, "1.22191250737771397120e+20", GMP_RNDN, + check(948002822, "1.22191250737771397120e+20", MPFR_RNDN, "7.758352715731357946e-12"); - check(1976245324, "1.25296395864546893357e+232", GMP_RNDZ, + check(1976245324, "1.25296395864546893357e+232", MPFR_RNDZ, "1.5772563211925444801e-223"); - check(740454110, "2.11496253355831863313e+183", GMP_RNDZ, + check(740454110, "2.11496253355831863313e+183", MPFR_RNDZ, "3.5010270784996976041e-175"); - check(1690540942, "1.28278599852446657468e-276", GMP_RNDU, + check(1690540942, "1.28278599852446657468e-276", MPFR_RNDU, "1.3178666932321966062e285"); - check(1476599377, "-2.14191393656148625995e+305", GMP_RNDD, + check(1476599377, "-2.14191393656148625995e+305", MPFR_RNDD, "-6.8938315017943889615e-297"); /* inv is for 1/x */ diff --git a/tests/tui_pow.c b/tests/tui_pow.c index deec2b242..a15a1b254 100644 --- a/tests/tui_pow.c +++ b/tests/tui_pow.c @@ -38,12 +38,12 @@ test1 (void) mpfr_init2 (a, 17); mpfr_set_str_binary (x, "-0.101110001001011011011e-9"); - mpfr_ui_pow (y, 7, x, GMP_RNDN); + mpfr_ui_pow (y, 7, x, MPFR_RNDN); mpfr_set_prec (x, 40); mpfr_set_str_binary (x, "-0.1100101100101111011001010010110011110110E-1"); mpfr_set_prec (y, 74); - mpfr_ui_pow (y, 8, x, GMP_RNDN); + mpfr_ui_pow (y, 8, x, MPFR_RNDN); mpfr_set_prec (x, 74); mpfr_set_str_binary (x, "0.11100000010100111101000011111011011010011000011000101011010011010101000011E-1"); if (mpfr_cmp (x, y)) @@ -53,14 +53,14 @@ test1 (void) } /* Check for ui_pow_ui */ - mpfr_ui_pow_ui (x, 0, 1, GMP_RNDN); + mpfr_ui_pow_ui (x, 0, 1, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x)); - mpfr_ui_pow_ui (x, 0, 4, GMP_RNDN); + mpfr_ui_pow_ui (x, 0, 4, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x)); - res1 = mpfr_ui_pow_ui (z, 17, 42, GMP_RNDD); - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_set_ui (y, 42, GMP_RNDN); - res2 = mpfr_pow (a, x, y, GMP_RNDD); + res1 = mpfr_ui_pow_ui (z, 17, 42, MPFR_RNDD); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_set_ui (y, 42, MPFR_RNDN); + res2 = mpfr_pow (a, x, y, MPFR_RNDD); if (mpfr_cmp (z, a) || res1 != res2) { printf ("Error for ui_pow_ui for 17^42\n" @@ -70,8 +70,8 @@ test1 (void) exit (1); } mpfr_set_prec (x, 2); - mpfr_ui_pow_ui (x, 65537, 65535, GMP_RNDN); - if (mpfr_cmp_str (x, "0.11E1048562", 2, GMP_RNDN) != 0) + mpfr_ui_pow_ui (x, 65537, 65535, MPFR_RNDN); + if (mpfr_cmp_str (x, "0.11E1048562", 2, MPFR_RNDN) != 0) { printf ("Error for ui_pow_ui for 65537 ^65535 with 2 bits of precision\n"); mpfr_dump (x); @@ -101,7 +101,7 @@ check1 (mpfr_ptr x, mp_prec_t prec, unsigned long nt, mp_rnd_t rnd) mpfr_set_prec (t, prec); compare = mpfr_ui_pow (y, nt, x, rnd); - err = (rnd == GMP_RNDN) ? yprec + 1 : yprec; + err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec; if (mpfr_can_round (y, err, rnd, rnd, prec)) { mpfr_set (t, y, rnd); @@ -109,15 +109,15 @@ check1 (mpfr_ptr x, mp_prec_t prec, unsigned long nt, mp_rnd_t rnd) if (mpfr_cmp (t, z)) { printf ("results differ for x="); - mpfr_out_str (stdout, 2, prec, x, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN); printf (" n=%lu", nt); printf (" prec=%u rnd_mode=%s\n", (unsigned) prec, mpfr_print_rnd_mode (rnd)); printf ("got "); - mpfr_out_str (stdout, 2, prec, z, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); puts (""); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, GMP_RNDN); + mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); puts (""); printf ("approx "); mpfr_print_binary (y); @@ -127,7 +127,7 @@ check1 (mpfr_ptr x, mp_prec_t prec, unsigned long nt, mp_rnd_t rnd) compare2 = mpfr_cmp (t, y); /* if rounding to nearest, cannot know the sign of t - f(x) because of composed rounding: y = o(f(x)) and t = o(y) */ - if ((rnd != GMP_RNDN) && (compare * compare2 >= 0)) + if ((rnd != MPFR_RNDN) && (compare * compare2 >= 0)) compare = compare + compare2; else compare = inexact; /* cannot determine sign(t-f(x)) */ @@ -163,7 +163,7 @@ main (int argc, char *argv[]) n = randlimb (); MPFR_SET_INF(x); - mpfr_ui_pow (y, n, x, GMP_RNDN); + mpfr_ui_pow (y, n, x, MPFR_RNDN); if(!MPFR_IS_INF(y)) { printf ("evaluation of function in INF does not return INF\n"); @@ -171,7 +171,7 @@ main (int argc, char *argv[]) } MPFR_CHANGE_SIGN(x); - mpfr_ui_pow (y, n, x, GMP_RNDN); + mpfr_ui_pow (y, n, x, MPFR_RNDN); if(!MPFR_IS_ZERO(y)) { printf ("evaluation of function in -INF does not return 0"); @@ -179,7 +179,7 @@ main (int argc, char *argv[]) } MPFR_SET_NAN(x); - mpfr_ui_pow (y, n, x, GMP_RNDN); + mpfr_ui_pow (y, n, x, MPFR_RNDN); if(!MPFR_IS_NAN(y)) { printf ("evaluation of function in NAN does not return NAN"); @@ -202,17 +202,17 @@ main (int argc, char *argv[]) /* check exact power */ mpfr_set_str_binary (t, "0.110000E5"); - mpfr_ui_pow (z, 3, t, GMP_RNDN); + mpfr_ui_pow (z, 3, t, MPFR_RNDN); mpfr_set_prec (x, 2); mpfr_set_prec (y, 2); - mpfr_set_str (x, "-0.5", 10, GMP_RNDZ); - mpfr_ui_pow (y, 4, x, GMP_RNDD); + mpfr_set_str (x, "-0.5", 10, MPFR_RNDZ); + mpfr_ui_pow (y, 4, x, MPFR_RNDD); if (mpfr_cmp_ui_2exp(y, 1, -1)) { - fprintf (stderr, "Error for 4^(-0.5), prec=2, GMP_RNDD\n"); + fprintf (stderr, "Error for 4^(-0.5), prec=2, MPFR_RNDD\n"); fprintf (stderr, "expected 0.5, got "); - mpfr_out_str (stderr, 2, 0, y, GMP_RNDN); + mpfr_out_str (stderr, 2, 0, y, MPFR_RNDN); fprintf (stderr, "\n"); exit (1); } @@ -221,13 +221,13 @@ main (int argc, char *argv[]) (03 Sep 2003) */ mpfr_set_prec (x, 2); mpfr_set_prec (y, 2); - mpfr_set_str (x, "0.5", 10, GMP_RNDN); - mpfr_ui_pow (y, 398441521, x, GMP_RNDN); + mpfr_set_str (x, "0.5", 10, MPFR_RNDN); + mpfr_ui_pow (y, 398441521, x, MPFR_RNDN); if (mpfr_cmp_ui_2exp(y, 1, 14)) { - fprintf (stderr, "Error for 398441521^(0.5), prec=2, GMP_RNDN\n"); + fprintf (stderr, "Error for 398441521^(0.5), prec=2, MPFR_RNDN\n"); fprintf (stderr, "expected 1.0e14, got "); - mpfr_out_str (stderr, 2, 0, y, GMP_RNDN); + mpfr_out_str (stderr, 2, 0, y, MPFR_RNDN); fprintf (stderr, "\n"); exit (1); } @@ -236,8 +236,8 @@ main (int argc, char *argv[]) mpfr_clear (t); mpfr_set_prec (x, 2); - mpfr_set_str (x, "0.5", 10, GMP_RNDN); - check1 (x, 2, 398441521, GMP_RNDN); /* 398441521 = 19961^2 */ + mpfr_set_str (x, "0.5", 10, MPFR_RNDN); + check1 (x, 2, 398441521, MPFR_RNDN); /* 398441521 = 19961^2 */ /* generic test */ for (prec = p0; prec <= p1; prec++) diff --git a/tests/tui_sub.c b/tests/tui_sub.c index f6613dd87..4c75261cc 100644 --- a/tests/tui_sub.c +++ b/tests/tui_sub.c @@ -39,7 +39,7 @@ special (void) mpfr_set_prec (x, 24); mpfr_set_prec (y, 24); mpfr_set_str_binary (y, "0.111100110001011010111"); - inexact = mpfr_ui_sub (x, 1, y, GMP_RNDN); + inexact = mpfr_ui_sub (x, 1, y, MPFR_RNDN); if (inexact) { printf ("Wrong inexact flag: got %d, expected 0\n", inexact); @@ -49,7 +49,7 @@ special (void) mpfr_set_prec (x, 24); mpfr_set_prec (y, 24); mpfr_set_str_binary (y, "0.111100110001011010111"); - if ((inexact = mpfr_ui_sub (x, 38181761, y, GMP_RNDN)) >= 0) + if ((inexact = mpfr_ui_sub (x, 38181761, y, MPFR_RNDN)) >= 0) { printf ("Wrong inexact flag: got %d, expected -1\n", inexact); exit (1); @@ -58,7 +58,7 @@ special (void) mpfr_set_prec (x, 63); mpfr_set_prec (y, 63); mpfr_set_str_binary (y, "0.111110010010100100110101101010001001100101110001000101110111111E-1"); - if ((inexact = mpfr_ui_sub (x, 1541116494, y, GMP_RNDN)) <= 0) + if ((inexact = mpfr_ui_sub (x, 1541116494, y, MPFR_RNDN)) <= 0) { printf ("Wrong inexact flag: got %d, expected +1\n", inexact); exit (1); @@ -67,7 +67,7 @@ special (void) mpfr_set_prec (x, 32); mpfr_set_prec (y, 32); mpfr_set_str_binary (y, "0.11011000110111010001011100011100E-1"); - if ((inexact = mpfr_ui_sub (x, 2000375416, y, GMP_RNDN)) >= 0) + if ((inexact = mpfr_ui_sub (x, 2000375416, y, MPFR_RNDN)) >= 0) { printf ("Wrong inexact flag: got %d, expected -1\n", inexact); exit (1); @@ -76,7 +76,7 @@ special (void) mpfr_set_prec (x, 24); mpfr_set_prec (y, 24); mpfr_set_str_binary (y, "0.110011011001010011110111E-2"); - if ((inexact = mpfr_ui_sub (x, 927694848, y, GMP_RNDN)) <= 0) + if ((inexact = mpfr_ui_sub (x, 927694848, y, MPFR_RNDN)) <= 0) { printf ("Wrong inexact flag: got %d, expected +1\n", inexact); exit (1); @@ -88,34 +88,34 @@ special (void) mpfr_set_prec (res, 5); mpfr_set_str_binary (x, "1e-12"); - mpfr_ui_sub (y, 1, x, GMP_RNDD); + mpfr_ui_sub (y, 1, x, MPFR_RNDD); mpfr_set_str_binary (res, "0.11111"); if (mpfr_cmp (y, res)) { - printf ("Error in mpfr_ui_sub (y, 1, x, GMP_RNDD) for x=2^(-12)\nexpected 1.1111e-1, got "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + printf ("Error in mpfr_ui_sub (y, 1, x, MPFR_RNDD) for x=2^(-12)\nexpected 1.1111e-1, got "); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); exit (1); } - mpfr_ui_sub (y, 1, x, GMP_RNDU); + mpfr_ui_sub (y, 1, x, MPFR_RNDU); mpfr_set_str_binary (res, "1.0"); if (mpfr_cmp (y, res)) { - printf ("Error in mpfr_ui_sub (y, 1, x, GMP_RNDU) for x=2^(-12)\n" + printf ("Error in mpfr_ui_sub (y, 1, x, MPFR_RNDU) for x=2^(-12)\n" "expected 1.0, got "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); exit (1); } - mpfr_ui_sub (y, 1, x, GMP_RNDN); + mpfr_ui_sub (y, 1, x, MPFR_RNDN); mpfr_set_str_binary (res, "1.0"); if (mpfr_cmp (y, res)) { - printf ("Error in mpfr_ui_sub (y, 1, x, GMP_RNDN) for x=2^(-12)\n" + printf ("Error in mpfr_ui_sub (y, 1, x, MPFR_RNDN) for x=2^(-12)\n" "expected 1.0, got "); - mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); printf ("\n"); exit (1); } @@ -123,7 +123,7 @@ special (void) mpfr_set_prec (x, 10); mpfr_set_prec (y, 10); mpfr_urandomb (x, RANDS); - mpfr_ui_sub (y, 0, x, GMP_RNDN); + mpfr_ui_sub (y, 0, x, MPFR_RNDN); if (MPFR_IS_ZERO(x)) MPFR_ASSERTN(MPFR_IS_ZERO(y)); else @@ -131,7 +131,7 @@ special (void) mpfr_set_prec (x, 73); mpfr_set_str_binary (x, "0.1101111010101011011011100011010000000101110001011111001011011000101111101E-99"); - mpfr_ui_sub (x, 1, x, GMP_RNDZ); + mpfr_ui_sub (x, 1, x, MPFR_RNDZ); mpfr_nextabove (x); MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0); @@ -152,7 +152,7 @@ check (unsigned long y, const char *xs, mp_rnd_t rnd_mode, const char *zs) if (mpfr_cmp_str1 (zz, zs) ) { printf ("expected difference is %s, got\n",zs); - mpfr_out_str(stdout, 10, 0, zz, GMP_RNDN); + mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN); printf ("mpfr_ui_sub failed for y=%lu x=%s with rnd_mode=%s\n", y, xs, mpfr_print_rnd_mode (rnd_mode)); exit (1); @@ -176,7 +176,7 @@ check_two_sum (mp_prec_t p) } while (x < 1); mpfr_urandomb (y, RANDS); - rnd = GMP_RNDN; + rnd = MPFR_RNDN; inexact = mpfr_ui_sub (u, x, y, rnd); mpfr_sub_ui (v, u, x, rnd); mpfr_add (w, v, y, rnd); @@ -208,18 +208,18 @@ check_nans (void) /* 1 - nan == nan */ mpfr_set_nan (x); - mpfr_ui_sub (y, 1L, x, GMP_RNDN); + mpfr_ui_sub (y, 1L, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (y)); /* 1 - +inf == -inf */ mpfr_set_inf (x, 1); - mpfr_ui_sub (y, 1L, x, GMP_RNDN); + mpfr_ui_sub (y, 1L, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (y)); MPFR_ASSERTN (mpfr_sgn (y) < 0); /* 1 - -inf == +inf */ mpfr_set_inf (x, -1); - mpfr_ui_sub (y, 1L, x, GMP_RNDN); + mpfr_ui_sub (y, 1L, x, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (y)); MPFR_ASSERTN (mpfr_sgn (y) > 0); @@ -240,7 +240,7 @@ static void check_neg (void) for (i = 0; i <= 25; i++) { - mpfr_sqrt_ui (x, i, GMP_RNDN); + mpfr_sqrt_ui (x, i, MPFR_RNDN); for (s = 0; s <= 1; s++) { RND_LOOP (r) @@ -253,7 +253,7 @@ static void check_neg (void) MPFR_ASSERTN (!(MPFR_IS_POS (yneg) ^ MPFR_IS_POS (ysub))); MPFR_ASSERTN (tneg == tsub); } - mpfr_neg (x, x, GMP_RNDN); + mpfr_neg (x, x, MPFR_RNDN); } } @@ -277,21 +277,21 @@ main (int argc, char *argv[]) for (k=0; k<100; k++) check_two_sum (p); - check(1196426492, "1.4218093058435347e-3", GMP_RNDN, + check(1196426492, "1.4218093058435347e-3", MPFR_RNDN, "1.1964264919985781e9"); - check(1092583421, "-1.0880649218158844e9", GMP_RNDN, + check(1092583421, "-1.0880649218158844e9", MPFR_RNDN, "2.1806483428158845901e9"); - check(948002822, "1.22191250737771397120e+20", GMP_RNDN, + check(948002822, "1.22191250737771397120e+20", MPFR_RNDN, "-1.2219125073682338611e20"); - check(832100416, "4.68311314939691330000e-215", GMP_RNDD, + check(832100416, "4.68311314939691330000e-215", MPFR_RNDD, "8.3210041599999988079e8"); - check(1976245324, "1.25296395864546893357e+232", GMP_RNDZ, + check(1976245324, "1.25296395864546893357e+232", MPFR_RNDZ, "-1.2529639586454686577e232"); - check(2128997392, "-1.08496826129284207724e+187", GMP_RNDU, + check(2128997392, "-1.08496826129284207724e+187", MPFR_RNDU, "1.0849682612928422704e187"); - check(293607738, "-1.9967571564050541e-5", GMP_RNDU, + check(293607738, "-1.9967571564050541e-5", MPFR_RNDU, "2.9360773800002003e8"); - check(354270183, "2.9469161763489528e3", GMP_RNDN, + check(354270183, "2.9469161763489528e3", MPFR_RNDN, "3.5426723608382362e8"); check_neg (); diff --git a/tests/ty0.c b/tests/ty0.c index 34dda218b..f788e0c76 100644 --- a/tests/ty0.c +++ b/tests/ty0.c @@ -41,45 +41,45 @@ main (int argc, char *argv[]) /* special values */ mpfr_set_nan (x); - mpfr_y0 (y, x, GMP_RNDN); + mpfr_y0 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); mpfr_set_inf (x, 1); /* +Inf */ - mpfr_y0 (y, x, GMP_RNDN); + mpfr_y0 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); mpfr_set_inf (x, -1); /* -Inf */ - mpfr_y0 (y, x, GMP_RNDN); + mpfr_y0 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); - mpfr_set_ui (x, 0, GMP_RNDN); /* +0 */ - mpfr_y0 (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */ + mpfr_y0 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y0(+0)=-Inf */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); /* -0 */ - mpfr_y0 (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); /* -0 */ + mpfr_y0 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y0(-0)=-Inf */ mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_y0 (y, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_y0 (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.00010110100110000000001000100110111100110101100011011111"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_y0 for x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_y0 for x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_y0 (y, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_y0 (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { - printf ("Error in mpfr_y0 for x=-1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_y0 for x=-1, rnd=MPFR_RNDN\n"); printf ("Expected NaN\n"); printf ("Got "); mpfr_dump (y); exit (1); diff --git a/tests/ty1.c b/tests/ty1.c index 2d5b3e9c6..f66acbf53 100644 --- a/tests/ty1.c +++ b/tests/ty1.c @@ -41,45 +41,45 @@ main (int argc, char *argv[]) /* special values */ mpfr_set_nan (x); - mpfr_y1 (y, x, GMP_RNDN); + mpfr_y1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); mpfr_set_inf (x, 1); /* +Inf */ - mpfr_y1 (y, x, GMP_RNDN); + mpfr_y1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); mpfr_set_inf (x, -1); /* -Inf */ - mpfr_y1 (y, x, GMP_RNDN); + mpfr_y1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); - mpfr_set_ui (x, 0, GMP_RNDN); /* +0 */ - mpfr_y1 (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */ + mpfr_y1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y1(+0)=-Inf */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); /* -0 */ - mpfr_y1 (y, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); /* -0 */ + mpfr_y1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y1(-0)=-Inf */ mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_y1 (y, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_y1 (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "-0.110001111111110110010000001111101011001101011100101"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_y1 for x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_y1 for x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_y1 (y, x, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_y1 (y, x, MPFR_RNDN); if (!mpfr_nan_p (y)) { - printf ("Error in mpfr_y1 for x=-1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_y1 for x=-1, rnd=MPFR_RNDN\n"); printf ("Expected NaN\n"); printf ("Got "); mpfr_dump (y); exit (1); diff --git a/tests/tyn.c b/tests/tyn.c index ac4b11d25..c6661953b 100644 --- a/tests/tyn.c +++ b/tests/tyn.c @@ -48,136 +48,136 @@ main (int argc, char *argv[]) prec = atoi (argv[3]); mpfr_set_prec (x, prec); mpfr_set_prec (y, prec); - mpfr_set_str (x, argv[2], 10, GMP_RNDN); - mpfr_yn (y, n, x, GMP_RNDN); + mpfr_set_str (x, argv[2], 10, MPFR_RNDN); + mpfr_yn (y, n, x, MPFR_RNDN); printf ("Y(%ld,", n); - mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf (")="); - mpfr_out_str (stdout, 10, 0, y, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN); printf ("\n"); goto end; } /* special values */ mpfr_set_nan (x); - mpfr_yn (y, 17, x, GMP_RNDN); + mpfr_yn (y, 17, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); mpfr_set_inf (x, 1); /* +Inf */ - mpfr_yn (y, 17, x, GMP_RNDN); + mpfr_yn (y, 17, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); mpfr_set_inf (x, -1); /* -Inf */ - mpfr_yn (y, 17, x, GMP_RNDN); + mpfr_yn (y, 17, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); - mpfr_set_ui (x, 0, GMP_RNDN); /* +0 */ - mpfr_yn (y, 0, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */ + mpfr_yn (y, 0, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y0(+0)=-Inf */ - mpfr_yn (y, 17, x, GMP_RNDN); + mpfr_yn (y, 17, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y17(+0)=-Inf */ - mpfr_yn (y, -17, x, GMP_RNDN); + mpfr_yn (y, -17, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_POS (y)); /* y(-17,+0)=+Inf */ - mpfr_yn (y, -42, x, GMP_RNDN); + mpfr_yn (y, -42, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y(-42,+0)=-Inf */ - mpfr_set_ui (x, 0, GMP_RNDN); - mpfr_neg (x, x, GMP_RNDN); /* -0 */ - mpfr_yn (y, 0, x, GMP_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); /* -0 */ + mpfr_yn (y, 0, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y0(-0)=-Inf */ - mpfr_yn (y, 17, x, GMP_RNDN); + mpfr_yn (y, 17, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y17(-0)=-Inf */ - mpfr_yn (y, -17, x, GMP_RNDN); + mpfr_yn (y, -17, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_POS (y)); /* y(-17,-0)=+Inf */ - mpfr_yn (y, -42, x, GMP_RNDN); + mpfr_yn (y, -42, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y(-42,-0)=-Inf */ mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_yn (y, 0, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_yn (y, 0, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.00010110100110000000001000100110111100110101100011011111"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_yn for n=0, x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_yn for n=0, x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_yn (y, 1, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_yn (y, 1, x, MPFR_RNDN); mpfr_set_str_binary (x, "-0.110001111111110110010000001111101011001101011100101"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_yn for n=1, x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_yn for n=1, x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_yn (y, -1, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_yn (y, -1, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.110001111111110110010000001111101011001101011100101"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_yn for n=-1, x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_yn for n=-1, x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_yn (y, 2, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_yn (y, 2, x, MPFR_RNDN); mpfr_set_str_binary (x, "-1.101001101001001100100010101001000101101000010010001"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_yn for n=2, x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_yn for n=2, x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_yn (y, -2, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_yn (y, -2, x, MPFR_RNDN); mpfr_set_str_binary (x, "-1.101001101001001100100010101001000101101000010010001"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_yn for n=-2, x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_yn for n=-2, x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_yn (y, 17, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_yn (y, 17, x, MPFR_RNDN); mpfr_set_str_binary (x, "-0.11000100111000100010101101011000110011001101100001011E60"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_yn for n=17, x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_yn for n=17, x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_yn (y, -17, x, GMP_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_yn (y, -17, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.11000100111000100010101101011000110011001101100001011E60"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_yn for n=-17, x=1, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_yn for n=-17, x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } - mpfr_set_ui (x, 17, GMP_RNDN); - mpfr_yn (y, 1, x, GMP_RNDN); + mpfr_set_ui (x, 17, MPFR_RNDN); + mpfr_yn (y, 1, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.00101010110011011111001100000001101011011001111111"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_yn for n=1, x=17, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_yn for n=1, x=17, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); diff --git a/tests/tzeta.c b/tests/tzeta.c index 44a72e595..335f32aa8 100644 --- a/tests/tzeta.c +++ b/tests/tzeta.c @@ -34,12 +34,12 @@ test1 (void) mpfr_init2 (y, 42); mpfr_set_str_binary (x, "1.1111111101000111011010010010100e-1"); - mpfr_zeta (y, x, GMP_RNDN); /* shouldn't crash */ + mpfr_zeta (y, x, MPFR_RNDN); /* shouldn't crash */ mpfr_set_prec (x, 40); mpfr_set_prec (y, 50); mpfr_set_str_binary (x, "1.001101001101000010011010110100110000101e-1"); - mpfr_zeta (y, x, GMP_RNDU); + mpfr_zeta (y, x, MPFR_RNDU); mpfr_set_prec (x, 50); mpfr_set_str_binary (x, "-0.11111100011100111111101111100011110111001111111111E1"); if (mpfr_cmp (x, y)) @@ -48,7 +48,7 @@ test1 (void) printf ("Expected "); mpfr_print_binary (x); puts (""); printf ("Got "); mpfr_print_binary (y); puts (""); mpfr_set_str_binary (x, "1.001101001101000010011010110100110000101e-1"); - mpfr_zeta (y, x, GMP_RNDU); + mpfr_zeta (y, x, MPFR_RNDU); mpfr_print_binary (x); puts (""); mpfr_print_binary (y); puts (""); exit (1); @@ -57,7 +57,7 @@ test1 (void) mpfr_set_prec (x, 2); mpfr_set_prec (y, 55); mpfr_set_str_binary (x, "0.11e3"); - mpfr_zeta (y, x, GMP_RNDN); + mpfr_zeta (y, x, MPFR_RNDN); mpfr_set_prec (x, 55); mpfr_set_str_binary (x, "0.1000001000111000010011000010011000000100100100100010010E1"); if (mpfr_cmp (x, y)) @@ -71,7 +71,7 @@ test1 (void) mpfr_set_prec (x, 3); mpfr_set_prec (y, 47); mpfr_set_str_binary (x, "0.111e4"); - mpfr_zeta (y, x, GMP_RNDN); + mpfr_zeta (y, x, MPFR_RNDN); mpfr_set_prec (x, 47); mpfr_set_str_binary (x, "1.0000000000000100000000111001001010111100101011"); if (mpfr_cmp (x, y)) @@ -84,26 +84,26 @@ test1 (void) mpfr_set_prec (x, 7); mpfr_set_str_binary (x, "1.000001"); mpfr_set_prec (y, 2); - mpfr_zeta (y, x, GMP_RNDN); + mpfr_zeta (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 64) == 0); /* another coverage test */ mpfr_set_prec (x, 24); - mpfr_set_ui (x, 2, GMP_RNDN); + mpfr_set_ui (x, 2, MPFR_RNDN); mpfr_set_prec (y, 2); - mpfr_zeta (y, x, GMP_RNDN); + mpfr_zeta (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui_2exp (y, 3, -1) == 0); mpfr_set_nan (x); - mpfr_zeta (y, x, GMP_RNDN); + mpfr_zeta (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); mpfr_set_inf (x, 1); - mpfr_zeta (y, x, GMP_RNDN); + mpfr_zeta (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); mpfr_set_inf (x, -1); - mpfr_zeta (y, x, GMP_RNDN); + mpfr_zeta (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); mpfr_clear (x); @@ -167,18 +167,18 @@ test2 (void) for(i = 0 ; i < n ; i+=2) { mpfr_set_str1 (x, val[i]); - mpfr_zeta(y, x, GMP_RNDZ); - if (mpfr_cmp_str (y, val[i+1] , 2, GMP_RNDZ)) + mpfr_zeta(y, x, MPFR_RNDZ); + if (mpfr_cmp_str (y, val[i+1] , 2, MPFR_RNDZ)) { printf("Wrong result for zeta(%s=", val[i]); mpfr_print_binary (x); printf (").\nGot : "); mpfr_print_binary(y); putchar('\n'); printf("Expected: "); - mpfr_set_str (y, val[i+1], 2, GMP_RNDZ); + mpfr_set_str (y, val[i+1], 2, MPFR_RNDZ); mpfr_print_binary(y); putchar('\n'); mpfr_set_prec(y, 65); - mpfr_zeta(y, x, GMP_RNDZ); + mpfr_zeta(y, x, MPFR_RNDZ); printf("+ Prec : "); mpfr_print_binary(y); putchar('\n'); exit(1); @@ -217,11 +217,11 @@ main (int argc, char *argv[]) prec = atoi(argv[2]); mpfr_init2 (s, prec); mpfr_init2 (z, prec); - mpfr_set_str (s, argv[1], 10, GMP_RNDN); + mpfr_set_str (s, argv[1], 10, MPFR_RNDN); rnd_mode = (mp_rnd_t) atoi(argv[3]); mpfr_zeta (z, s, rnd_mode); - mpfr_out_str (stdout, 10, 0, z, GMP_RNDN); + mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN); printf ("\n"); mpfr_clear (s); @@ -241,15 +241,15 @@ main (int argc, char *argv[]) mpfr_set_prec (s, 6); mpfr_set_prec (z, 6); mpfr_set_str_binary (s, "1.10010e4"); - mpfr_zeta (z, s, GMP_RNDZ); + mpfr_zeta (z, s, MPFR_RNDZ); mpfr_set_prec (s, 53); mpfr_set_prec (y, 53); mpfr_set_prec (z, 53); - mpfr_set_ui (s, 1, GMP_RNDN); - mpfr_zeta (z, s, GMP_RNDN); + mpfr_set_ui (s, 1, MPFR_RNDN); + mpfr_zeta (z, s, MPFR_RNDN); if (!mpfr_inf_p (z) || MPFR_SIGN (z) < 0) { printf ("Error in mpfr_zeta for s = 1 (should be +inf)\n"); @@ -258,25 +258,25 @@ main (int argc, char *argv[]) mpfr_set_str_binary (s, "0.1100011101110111111111111010000110010111001011001011"); mpfr_set_str_binary (y, "-0.11111101111011001001001111111000101010000100000100100E2"); - mpfr_zeta (z, s, GMP_RNDN); + mpfr_zeta (z, s, MPFR_RNDN); if (mpfr_cmp (z, y) != 0) { printf ("Error in mpfr_zeta (1,RNDN)\n"); exit (1); } - mpfr_zeta (z, s, GMP_RNDZ); + mpfr_zeta (z, s, MPFR_RNDZ); if (mpfr_cmp (z, y) != 0) { printf ("Error in mpfr_zeta (1,RNDZ)\n"); exit (1); } - mpfr_zeta (z, s, GMP_RNDU); + mpfr_zeta (z, s, MPFR_RNDU); if (mpfr_cmp (z, y) != 0) { printf ("Error in mpfr_zeta (1,RNDU)\n"); exit (1); } - mpfr_zeta (z, s, GMP_RNDD); + mpfr_zeta (z, s, MPFR_RNDD); mpfr_nexttoinf (y); if (mpfr_cmp (z, y) != 0) { @@ -286,25 +286,25 @@ main (int argc, char *argv[]) mpfr_set_str_binary (s, "0.10001011010011100110010001100100001011000010011001011"); mpfr_set_str_binary (y, "-0.11010011010010101101110111011010011101111101111010110E1"); - mpfr_zeta (z, s, GMP_RNDN); + mpfr_zeta (z, s, MPFR_RNDN); if (mpfr_cmp (z, y) != 0) { printf ("Error in mpfr_zeta (2,RNDN)\n"); exit (1); } - mpfr_zeta (z, s, GMP_RNDZ); + mpfr_zeta (z, s, MPFR_RNDZ); if (mpfr_cmp (z, y) != 0) { printf ("Error in mpfr_zeta (2,RNDZ)\n"); exit (1); } - mpfr_zeta (z, s, GMP_RNDU); + mpfr_zeta (z, s, MPFR_RNDU); if (mpfr_cmp (z, y) != 0) { printf ("Error in mpfr_zeta (2,RNDU)\n"); exit (1); } - mpfr_zeta (z, s, GMP_RNDD); + mpfr_zeta (z, s, MPFR_RNDD); mpfr_nexttoinf (y); if (mpfr_cmp (z, y) != 0) { @@ -314,41 +314,41 @@ main (int argc, char *argv[]) mpfr_set_str_binary (s, "0.1100111110100001111110111000110101111001011101000101"); mpfr_set_str_binary (y, "-0.10010111010110000111011111001101100001111011000001010E3"); - mpfr_zeta (z, s, GMP_RNDN); + mpfr_zeta (z, s, MPFR_RNDN); if (mpfr_cmp (z, y) != 0) { printf ("Error in mpfr_zeta (3,RNDN)\n"); exit (1); } - mpfr_zeta (z, s, GMP_RNDD); + mpfr_zeta (z, s, MPFR_RNDD); if (mpfr_cmp (z, y) != 0) { printf ("Error in mpfr_zeta (3,RNDD)\n"); exit (1); } mpfr_nexttozero (y); - mpfr_zeta (z, s, GMP_RNDZ); + mpfr_zeta (z, s, MPFR_RNDZ); if (mpfr_cmp (z, y) != 0) { printf ("Error in mpfr_zeta (3,RNDZ)\n"); exit (1); } - mpfr_zeta (z, s, GMP_RNDU); + mpfr_zeta (z, s, MPFR_RNDU); if (mpfr_cmp (z, y) != 0) { printf ("Error in mpfr_zeta (3,RNDU)\n"); exit (1); } - mpfr_set_str (s, "-400000001", 10, GMP_RNDZ); - mpfr_zeta (z, s, GMP_RNDN); + mpfr_set_str (s, "-400000001", 10, MPFR_RNDZ); + mpfr_zeta (z, s, MPFR_RNDN); if (!(mpfr_inf_p (z) && MPFR_SIGN(z) < 0)) { printf ("Error in mpfr_zeta (-400000001)\n"); exit (1); } - mpfr_set_str (s, "-400000003", 10, GMP_RNDZ); - mpfr_zeta (z, s, GMP_RNDN); + mpfr_set_str (s, "-400000003", 10, MPFR_RNDZ); + mpfr_zeta (z, s, MPFR_RNDN); if (!(mpfr_inf_p (z) && MPFR_SIGN(z) > 0)) { printf ("Error in mpfr_zeta (-400000003)\n"); @@ -358,11 +358,11 @@ main (int argc, char *argv[]) mpfr_set_prec (s, 34); mpfr_set_prec (z, 34); mpfr_set_str_binary (s, "-1.111111100001011110000010001010000e-35"); - mpfr_zeta (z, s, GMP_RNDD); + mpfr_zeta (z, s, MPFR_RNDD); mpfr_set_str_binary (s, "-1.111111111111111111111111111111111e-2"); if (mpfr_cmp (s, z)) { - printf ("Error in mpfr_zeta, prec=34, GMP_RNDD\n"); + printf ("Error in mpfr_zeta, prec=34, MPFR_RNDD\n"); mpfr_dump (z); exit (1); } @@ -371,12 +371,12 @@ main (int argc, char *argv[]) mpfr_set_prec (s, 23); mpfr_set_prec (z, 25); mpfr_set_str_binary (s, "-1.0110110110001000000000e-27"); - mpfr_zeta (z, s, GMP_RNDN); + mpfr_zeta (z, s, MPFR_RNDN); mpfr_set_prec (s, 25); mpfr_set_str_binary (s, "-1.111111111111111111111111e-2"); if (mpfr_cmp (s, z)) { - printf ("Error in mpfr_zeta, prec=25, GMP_RNDN\n"); + printf ("Error in mpfr_zeta, prec=25, MPFR_RNDN\n"); printf ("expected "); mpfr_dump (s); printf ("got "); mpfr_dump (z); exit (1); @@ -386,9 +386,9 @@ main (int argc, char *argv[]) mpfr_set_prec (s, 128); mpfr_set_prec (z, 128); mpfr_set_str_binary (s, "-0.1000000000000000000000000000000000000000000000000000000000000001E64"); - inex = mpfr_zeta (z, s, GMP_RNDN); + inex = mpfr_zeta (z, s, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (z) && MPFR_SIGN (z) < 0 && inex < 0); - inex = mpfr_zeta (z, s, GMP_RNDU); + inex = mpfr_zeta (z, s, MPFR_RNDU); mpfr_set_inf (s, -1); mpfr_nextabove (s); MPFR_ASSERTN (mpfr_equal_p (z, s) && inex > 0); diff --git a/tests/tzeta_ui.c b/tests/tzeta_ui.c index 0dc1cb159..9718dec2c 100644 --- a/tests/tzeta_ui.c +++ b/tests/tzeta_ui.c @@ -48,19 +48,19 @@ main (int argc, char *argv[]) { mpfr_set_prec (x, atoi (argv[2])); 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); + argc > 3 ? (mp_rnd_t) atoi (argv[3]) : MPFR_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf ("\n"); goto clear_and_exit; } mpfr_set_prec (x, 33); mpfr_set_prec (y, 33); - mpfr_zeta_ui (x, 3, GMP_RNDZ); + mpfr_zeta_ui (x, 3, MPFR_RNDZ); mpfr_set_str_binary (y, "0.100110011101110100000000001001111E1"); if (mpfr_cmp (x, y)) { - printf ("Error for zeta(3), prec=33, GMP_RNDZ\n"); + printf ("Error for zeta(3), prec=33, MPFR_RNDZ\n"); printf ("expected "); mpfr_dump (y); printf ("got "); mpfr_dump (x); exit (1); @@ -75,11 +75,11 @@ main (int argc, char *argv[]) mpfr_set_prec (y, yprec); for (n = 0; n < 50; n++) - for (rnd = 0; rnd < GMP_RND_MAX; rnd++) + for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) { - inexact = mpfr_zeta_ui (y, n, GMP_RNDN); - if (mpfr_can_round (y, yprec, GMP_RNDN, GMP_RNDZ, prec - + (rnd == GMP_RNDN))) + inexact = mpfr_zeta_ui (y, n, MPFR_RNDN); + if (mpfr_can_round (y, yprec, MPFR_RNDN, MPFR_RNDZ, prec + + (rnd == MPFR_RNDN))) { mpfr_set (t, y, (mp_rnd_t) rnd); inexact = mpfr_zeta_ui (z, n, (mp_rnd_t) rnd); -- cgit v1.2.1