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/thypot.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/thypot.c')
-rw-r--r-- | tests/thypot.c | 84 |
1 files changed, 42 insertions, 42 deletions
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)); |