diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-03-03 16:51:07 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-03-03 16:51:07 +0000 |
commit | f5f7883fc7cf47d38ed493a882fd7109bdd589bb (patch) | |
tree | 1058cf0d07593fa2cec9f32b4988ac40611b4bff /tests/tremquo.c | |
parent | cbd40e1cb659b579e608afbe7a05da5b15a860be (diff) | |
download | mpfr-f5f7883fc7cf47d38ed493a882fd7109bdd589bb.tar.gz |
GMP_RNDX -> MPFR_RNDX
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6053 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tremquo.c')
-rw-r--r-- | tests/tremquo.c | 176 |
1 files changed, 88 insertions, 88 deletions
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); |