diff options
Diffstat (limited to 'tests/tui_sub.c')
-rw-r--r-- | tests/tui_sub.c | 62 |
1 files changed, 31 insertions, 31 deletions
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 (); |