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/tsin.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/tsin.c')
-rw-r--r-- | tests/tsin.c | 106 |
1 files changed, 53 insertions, 53 deletions
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); |