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/tget_set_d64.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/tget_set_d64.c')
-rw-r--r-- | tests/tget_set_d64.c | 144 |
1 files changed, 72 insertions, 72 deletions
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); |