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/tdiv.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/tdiv.c')
-rw-r--r-- | tests/tdiv.c | 312 |
1 files changed, 156 insertions, 156 deletions
diff --git a/tests/tdiv.c b/tests/tdiv.c index 3f454af4b..043b214d2 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -30,7 +30,7 @@ static int test_div (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) { int res; - int ok = rnd_mode == GMP_RNDN && mpfr_number_p (b) && mpfr_number_p (c); + int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c); if (ok) { mpfr_print_raw (b); @@ -74,12 +74,12 @@ check4 (const char *Ns, const char *Ds, mp_rnd_t rnd_mode, int p, mpfr_set_str1 (n, Ns); mpfr_set_str1 (d, Ds); test_div(q, n, d, rnd_mode); - if (mpfr_cmp_str (q, Qs, ((p==53) ? 10 : 2), GMP_RNDN) ) + if (mpfr_cmp_str (q, Qs, ((p==53) ? 10 : 2), MPFR_RNDN) ) { printf ("mpfr_div failed for n=%s, d=%s, p=%d, rnd_mode=%s\n", Ns, Ds, p, mpfr_print_rnd_mode (rnd_mode)); printf ("got ");mpfr_print_binary(q); - mpfr_set_str (q, Qs, ((p==53) ? 10 : 2), GMP_RNDN); + mpfr_set_str (q, Qs, ((p==53) ? 10 : 2), MPFR_RNDN); printf("\nexpected "); mpfr_print_binary(q); putchar('\n'); exit (1); @@ -102,7 +102,7 @@ check24 (const char *Ns, const char *Ds, mp_rnd_t rnd_mode, const char *Qs) printf ("mpfr_div failed for n=%s, d=%s, prec=24, rnd_mode=%s\n", Ns, Ds, mpfr_print_rnd_mode(rnd_mode)); printf ("expected quotient is %s, got ", Qs); - mpfr_out_str(stdout,10,0,q, GMP_RNDN); putchar('\n'); + mpfr_out_str(stdout,10,0,q, MPFR_RNDN); putchar('\n'); exit (1); } mpfr_clears (q, n, d, (mpfr_ptr) 0); @@ -113,85 +113,85 @@ check24 (const char *Ns, const char *Ds, mp_rnd_t rnd_mode, const char *Qs) static void check_float(void) { - check24("70368760954880.0", "8388609.0", GMP_RNDN, "8.388609e6"); - check24("140737479966720.0", "16777213.0", GMP_RNDN, "8.388609e6"); - check24("70368777732096.0", "8388611.0", GMP_RNDN, "8.388609e6"); - check24("105553133043712.0", "12582911.0", GMP_RNDN, "8.38861e6"); + check24("70368760954880.0", "8388609.0", MPFR_RNDN, "8.388609e6"); + check24("140737479966720.0", "16777213.0", MPFR_RNDN, "8.388609e6"); + check24("70368777732096.0", "8388611.0", MPFR_RNDN, "8.388609e6"); + check24("105553133043712.0", "12582911.0", MPFR_RNDN, "8.38861e6"); /* the exponent for the following example was forgotten in the Arith'14 version of Parks' paper */ - check24 ("12582913.0", "12582910.0", GMP_RNDN, "1.000000238"); - check24 ("105553124655104.0", "12582910.0", GMP_RNDN, "8388610.0"); - check24("140737479966720.0", "8388609.0", GMP_RNDN, "1.6777213e7"); - check24("70368777732096.0", "8388609.0", GMP_RNDN, "8.388611e6"); - check24("105553133043712.0", "8388610.0", GMP_RNDN, "1.2582911e7"); - check24("105553124655104.0", "8388610.0", GMP_RNDN, "1.258291e7"); - - check24("70368760954880.0", "8388609.0", GMP_RNDZ, "8.388608e6"); - check24("140737479966720.0", "16777213.0", GMP_RNDZ, "8.388609e6"); - check24("70368777732096.0", "8388611.0", GMP_RNDZ, "8.388608e6"); - check24("105553133043712.0", "12582911.0", GMP_RNDZ, "8.38861e6"); - check24("12582913.0", "12582910.0", GMP_RNDZ, "1.000000238"); - check24 ("105553124655104.0", "12582910.0", GMP_RNDZ, "8388610.0"); - check24("140737479966720.0", "8388609.0", GMP_RNDZ, "1.6777213e7"); - check24("70368777732096.0", "8388609.0", GMP_RNDZ, "8.38861e6"); - check24("105553133043712.0", "8388610.0", GMP_RNDZ, "1.2582911e7"); - check24("105553124655104.0", "8388610.0", GMP_RNDZ, "1.258291e7"); - - check24("70368760954880.0", "8388609.0", GMP_RNDU, "8.388609e6"); - check24("140737479966720.0", "16777213.0", GMP_RNDU, "8.38861e6"); - check24("70368777732096.0", "8388611.0", GMP_RNDU, "8.388609e6"); - check24("105553133043712.0", "12582911.0", GMP_RNDU, "8.388611e6"); - check24("12582913.0", "12582910.0", GMP_RNDU, "1.000000357"); - check24 ("105553124655104.0", "12582910.0", GMP_RNDU, "8388611.0"); - check24("140737479966720.0", "8388609.0", GMP_RNDU, "1.6777214e7"); - check24("70368777732096.0", "8388609.0", GMP_RNDU, "8.388611e6"); - check24("105553133043712.0", "8388610.0", GMP_RNDU, "1.2582912e7"); - check24("105553124655104.0", "8388610.0", GMP_RNDU, "1.2582911e7"); - - check24("70368760954880.0", "8388609.0", GMP_RNDD, "8.388608e6"); - check24("140737479966720.0", "16777213.0", GMP_RNDD, "8.388609e6"); - check24("70368777732096.0", "8388611.0", GMP_RNDD, "8.388608e6"); - check24("105553133043712.0", "12582911.0", GMP_RNDD, "8.38861e6"); - check24("12582913.0", "12582910.0", GMP_RNDD, "1.000000238"); - check24 ("105553124655104.0", "12582910.0", GMP_RNDD, "8388610.0"); - check24("140737479966720.0", "8388609.0", GMP_RNDD, "1.6777213e7"); - check24("70368777732096.0", "8388609.0", GMP_RNDD, "8.38861e6"); - check24("105553133043712.0", "8388610.0", GMP_RNDD, "1.2582911e7"); - check24("105553124655104.0", "8388610.0", GMP_RNDD, "1.258291e7"); - - check24("70368760954880.0", "8388609.0", GMP_RNDA, "8.388609e6"); + check24 ("12582913.0", "12582910.0", MPFR_RNDN, "1.000000238"); + check24 ("105553124655104.0", "12582910.0", MPFR_RNDN, "8388610.0"); + check24("140737479966720.0", "8388609.0", MPFR_RNDN, "1.6777213e7"); + check24("70368777732096.0", "8388609.0", MPFR_RNDN, "8.388611e6"); + check24("105553133043712.0", "8388610.0", MPFR_RNDN, "1.2582911e7"); + check24("105553124655104.0", "8388610.0", MPFR_RNDN, "1.258291e7"); + + check24("70368760954880.0", "8388609.0", MPFR_RNDZ, "8.388608e6"); + check24("140737479966720.0", "16777213.0", MPFR_RNDZ, "8.388609e6"); + check24("70368777732096.0", "8388611.0", MPFR_RNDZ, "8.388608e6"); + check24("105553133043712.0", "12582911.0", MPFR_RNDZ, "8.38861e6"); + check24("12582913.0", "12582910.0", MPFR_RNDZ, "1.000000238"); + check24 ("105553124655104.0", "12582910.0", MPFR_RNDZ, "8388610.0"); + check24("140737479966720.0", "8388609.0", MPFR_RNDZ, "1.6777213e7"); + check24("70368777732096.0", "8388609.0", MPFR_RNDZ, "8.38861e6"); + check24("105553133043712.0", "8388610.0", MPFR_RNDZ, "1.2582911e7"); + check24("105553124655104.0", "8388610.0", MPFR_RNDZ, "1.258291e7"); + + check24("70368760954880.0", "8388609.0", MPFR_RNDU, "8.388609e6"); + check24("140737479966720.0", "16777213.0", MPFR_RNDU, "8.38861e6"); + check24("70368777732096.0", "8388611.0", MPFR_RNDU, "8.388609e6"); + check24("105553133043712.0", "12582911.0", MPFR_RNDU, "8.388611e6"); + check24("12582913.0", "12582910.0", MPFR_RNDU, "1.000000357"); + check24 ("105553124655104.0", "12582910.0", MPFR_RNDU, "8388611.0"); + check24("140737479966720.0", "8388609.0", MPFR_RNDU, "1.6777214e7"); + check24("70368777732096.0", "8388609.0", MPFR_RNDU, "8.388611e6"); + check24("105553133043712.0", "8388610.0", MPFR_RNDU, "1.2582912e7"); + check24("105553124655104.0", "8388610.0", MPFR_RNDU, "1.2582911e7"); + + check24("70368760954880.0", "8388609.0", MPFR_RNDD, "8.388608e6"); + check24("140737479966720.0", "16777213.0", MPFR_RNDD, "8.388609e6"); + check24("70368777732096.0", "8388611.0", MPFR_RNDD, "8.388608e6"); + check24("105553133043712.0", "12582911.0", MPFR_RNDD, "8.38861e6"); + check24("12582913.0", "12582910.0", MPFR_RNDD, "1.000000238"); + check24 ("105553124655104.0", "12582910.0", MPFR_RNDD, "8388610.0"); + check24("140737479966720.0", "8388609.0", MPFR_RNDD, "1.6777213e7"); + check24("70368777732096.0", "8388609.0", MPFR_RNDD, "8.38861e6"); + check24("105553133043712.0", "8388610.0", MPFR_RNDD, "1.2582911e7"); + check24("105553124655104.0", "8388610.0", MPFR_RNDD, "1.258291e7"); + + check24("70368760954880.0", "8388609.0", MPFR_RNDA, "8.388609e6"); } static void check_double(void) { - check53("0.0", "1.0", GMP_RNDZ, "0.0"); - check53("-7.4988969224688591e63", "4.8816866450288732e306", GMP_RNDD, + check53("0.0", "1.0", MPFR_RNDZ, "0.0"); + check53("-7.4988969224688591e63", "4.8816866450288732e306", MPFR_RNDD, "-1.5361282826510687291e-243"); check53("-1.33225773037748601769e+199", "3.63449540676937123913e+79", - GMP_RNDZ, "-3.6655920045905428978e119"); - check53("9.89438396044940256501e-134", "5.93472984109987421717e-67",GMP_RNDU, + MPFR_RNDZ, "-3.6655920045905428978e119"); + check53("9.89438396044940256501e-134", "5.93472984109987421717e-67",MPFR_RNDU, "1.6672003992376663654e-67"); - check53("9.89438396044940256501e-134", "5.93472984109987421717e-67",GMP_RNDA, + check53("9.89438396044940256501e-134", "5.93472984109987421717e-67",MPFR_RNDA, "1.6672003992376663654e-67"); check53("9.89438396044940256501e-134", "-5.93472984109987421717e-67", - GMP_RNDU, "-1.6672003992376663654e-67"); + MPFR_RNDU, "-1.6672003992376663654e-67"); check53("-4.53063926135729747564e-308", "7.02293374921793516813e-84", - GMP_RNDD, "-6.4512060388748850857e-225"); + MPFR_RNDD, "-6.4512060388748850857e-225"); check53("6.25089225176473806123e-01","-2.35527154824420243364e-230", - GMP_RNDD, "-2.6540006635008291192e229"); + MPFR_RNDD, "-2.6540006635008291192e229"); check53("6.25089225176473806123e-01","-2.35527154824420243364e-230", - GMP_RNDA, "-2.6540006635008291192e229"); - check53("6.52308934689126e15", "-1.62063546601505417497e273", GMP_RNDN, + MPFR_RNDA, "-2.6540006635008291192e229"); + check53("6.52308934689126e15", "-1.62063546601505417497e273", MPFR_RNDN, "-4.0250194961676020848e-258"); check53("1.04636807108079349236e-189", "3.72295730823253012954e-292", - GMP_RNDZ, "2.810583051186143125e102"); + MPFR_RNDZ, "2.810583051186143125e102"); /* problems found by Kevin under HP-PA */ - check53 ("2.861044553323177e-136", "-1.1120354257068143e+45", GMP_RNDZ, + check53 ("2.861044553323177e-136", "-1.1120354257068143e+45", MPFR_RNDZ, "-2.5727998292003016e-181"); - check53 ("-4.0559157245809205e-127", "-1.1237723844524865e+77", GMP_RNDN, + check53 ("-4.0559157245809205e-127", "-1.1237723844524865e+77", MPFR_RNDN, "3.6091968273068081e-204"); - check53 ("-1.8177943561493235e-93", "-8.51233984260364e-104", GMP_RNDU, + check53 ("-1.8177943561493235e-93", "-8.51233984260364e-104", MPFR_RNDU, "2.1354814184595821e+10"); } @@ -204,10 +204,10 @@ check_64(void) mpfr_set_str_binary(x, "1.00100100110110101001010010101111000001011100100101010000000000E54"); mpfr_set_str_binary(y, "1.00000000000000000000000000000000000000000000000000000000000000E584"); - test_div(z, x, y, GMP_RNDU); - if (mpfr_cmp_str (z, "0.1001001001101101010010100101011110000010111001001010100000000000E-529", 2, GMP_RNDN)) + test_div(z, x, y, MPFR_RNDU); + if (mpfr_cmp_str (z, "0.1001001001101101010010100101011110000010111001001010100000000000E-529", 2, MPFR_RNDN)) { - printf("Error for tdiv for GMP_RNDU and p=64\nx="); + printf("Error for tdiv for MPFR_RNDU and p=64\nx="); mpfr_print_binary(x); printf("\ny="); mpfr_print_binary(y); @@ -228,18 +228,18 @@ check_convergence (void) mpfr_init2(x, 130); mpfr_set_str_binary(x, "0.1011111101011010101000001010011111101000011100011101010011111011000011001010000000111100100111110011001010110100100001001000111001E6944"); mpfr_init2(y, 130); - mpfr_set_ui(y, 5, GMP_RNDN); - test_div(x, x, y, GMP_RNDD); /* exact division */ + mpfr_set_ui(y, 5, MPFR_RNDN); + test_div(x, x, y, MPFR_RNDD); /* exact division */ mpfr_set_prec(x, 64); mpfr_set_prec(y, 64); mpfr_set_str_binary(x, "0.10010010011011010100101001010111100000101110010010101E55"); mpfr_set_str_binary(y, "0.1E585"); - test_div(x, x, y, GMP_RNDN); + test_div(x, x, y, MPFR_RNDN); mpfr_set_str_binary(y, "0.10010010011011010100101001010111100000101110010010101E-529"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_div for prec=64, rnd=GMP_RNDN\n"); + printf ("Error in mpfr_div for prec=64, rnd=MPFR_RNDN\n"); printf ("got "); mpfr_print_binary(x); puts (""); printf ("instead of "); mpfr_print_binary(y); puts (""); exit(1); @@ -249,10 +249,10 @@ check_convergence (void) { mpfr_set_prec(x, i); mpfr_set_prec(y, i); - mpfr_set_ui(x, 1, GMP_RNDN); + mpfr_set_ui(x, 1, MPFR_RNDN); RND_LOOP(j) { - mpfr_set_ui (y, 1, GMP_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); test_div (y, x, y, (mp_rnd_t) j); if (mpfr_cmp_ui (y, 1)) { @@ -278,7 +278,7 @@ get_inexact (mpfr_t y, mpfr_t x, mpfr_t u) mpfr_t xx; int inex; mpfr_init2 (xx, mpfr_get_prec (y) + mpfr_get_prec (u)); - mpfr_mul (xx, y, u, GMP_RNDN); /* exact */ + mpfr_mul (xx, y, u, MPFR_RNDN); /* exact */ inex = mpfr_cmp (xx, x); mpfr_clear (xx); return inex; @@ -312,7 +312,7 @@ check_hard (void) while (mpfr_cmp_ui (q2, 0) == 0); } else /* use q2=1 */ - mpfr_set_ui (q2, 1, GMP_RNDN); + mpfr_set_ui (q2, 1, MPFR_RNDN); for (precv = precq; precv <= 10 * precq; precv += precq) { mpfr_set_prec (v, precv); @@ -324,7 +324,7 @@ check_hard (void) for (precu = precq; precu <= 10 * precq; precu += precq) { mpfr_set_prec (u, precu); - mpfr_mul (u, v, q2, GMP_RNDN); + mpfr_mul (u, v, q2, MPFR_RNDN); mpfr_nextbelow (u); for (i = 0; i <= 2; i++) { @@ -340,7 +340,7 @@ check_hard (void) printf ("v= "); mpfr_dump (v); printf ("q= "); mpfr_dump (q); mpfr_set_prec (q2, precq + precv); - mpfr_mul (q2, q, v, GMP_RNDN); + mpfr_mul (q2, q, v, MPFR_RNDN); printf ("q*v="); mpfr_dump (q2); exit (1); } @@ -384,12 +384,12 @@ check_lowr (void) mpfr_urandomb (tmp, RANDS); } while (mpfr_cmp_ui (tmp, 0) == 0); - mpfr_mul (x, z, tmp, GMP_RNDN); /* exact */ - c = test_div (z2, x, tmp, GMP_RNDN); + mpfr_mul (x, z, tmp, MPFR_RNDN); /* exact */ + c = test_div (z2, x, tmp, MPFR_RNDN); if (c || mpfr_cmp (z2, z)) { - printf ("Error in mpfr_div rnd=GMP_RNDN\n"); + printf ("Error in mpfr_div rnd=MPFR_RNDN\n"); printf ("got "); mpfr_print_binary(z2); puts (""); printf ("instead of "); mpfr_print_binary(z); puts (""); printf ("inex flag = %d, expected 0\n", c); @@ -407,15 +407,15 @@ check_lowr (void) mpfr_urandomb (tmp, RANDS); } while (mpfr_cmp_ui (tmp, 0) == 0); - mpfr_mul (x, z, tmp, GMP_RNDN); /* exact */ - c = test_div (z2, x, tmp, GMP_RNDN); + mpfr_mul (x, z, tmp, MPFR_RNDN); /* exact */ + c = test_div (z2, x, tmp, MPFR_RNDN); /* since z2 has one less bit that z, either the division is exact if z is representable on 9 bits, or we have an even round case */ c2 = get_inexact (z2, x, tmp); if ((mpfr_cmp (z2, z) == 0 && c) || inex_cmp (c, c2)) { - printf ("Error in mpfr_div rnd=GMP_RNDN\n"); + printf ("Error in mpfr_div rnd=MPFR_RNDN\n"); printf ("got "); mpfr_print_binary(z2); puts (""); printf ("instead of "); mpfr_print_binary(z); puts (""); printf ("inex flag = %d, expected %d\n", c, c2); @@ -426,7 +426,7 @@ check_lowr (void) mpfr_nexttoinf (z); if (mpfr_cmp(z2, z)) { - printf ("Error in mpfr_div [even rnd?] rnd=GMP_RNDN\n"); + printf ("Error in mpfr_div [even rnd?] rnd=MPFR_RNDN\n"); printf ("Dividing "); printf ("got "); mpfr_print_binary(z2); puts (""); printf ("instead of "); mpfr_print_binary(z); puts (""); @@ -439,7 +439,7 @@ check_lowr (void) mpfr_nexttozero (z); if (mpfr_cmp(z2, z)) { - printf ("Error in mpfr_div [even rnd?] rnd=GMP_RNDN\n"); + printf ("Error in mpfr_div [even rnd?] rnd=MPFR_RNDN\n"); printf ("Dividing "); printf ("got "); mpfr_print_binary(z2); puts (""); printf ("instead of "); mpfr_print_binary(z); puts (""); @@ -468,30 +468,30 @@ check_lowr (void) mpfr_urandomb (tmp, RANDS); } while (mpfr_cmp_ui (tmp, 0) == 0); - mpfr_mul(x, z, tmp, GMP_RNDN); - mpfr_set(y, tmp, GMP_RNDD); + mpfr_mul(x, z, tmp, MPFR_RNDN); + mpfr_set(y, tmp, MPFR_RNDD); mpfr_nexttoinf (x); - c = test_div(z2, x, y, GMP_RNDD); - test_div(z3, x, y, GMP_RNDD); - mpfr_set(z, z3, GMP_RNDD); + c = test_div(z2, x, y, MPFR_RNDD); + test_div(z3, x, y, MPFR_RNDD); + mpfr_set(z, z3, MPFR_RNDD); if (c != -1 || mpfr_cmp(z2, z)) { - printf ("Error in mpfr_div rnd=GMP_RNDD\n"); + printf ("Error in mpfr_div rnd=MPFR_RNDD\n"); printf ("got "); mpfr_print_binary(z2); puts (""); printf ("instead of "); mpfr_print_binary(z); puts (""); printf ("inex flag = %d\n", c); exit (1); } - mpfr_set (y, tmp, GMP_RNDU); - test_div (z3, x, y, GMP_RNDU); - mpfr_set (z, z3, GMP_RNDU); - c = test_div (z2, x, y, GMP_RNDU); + mpfr_set (y, tmp, MPFR_RNDU); + test_div (z3, x, y, MPFR_RNDU); + mpfr_set (z, z3, MPFR_RNDU); + c = test_div (z2, x, y, MPFR_RNDU); if (c != 1 || mpfr_cmp (z2, z)) { - printf ("Error in mpfr_div rnd=GMP_RNDU\n"); + printf ("Error in mpfr_div rnd=MPFR_RNDU\n"); printf ("u="); mpfr_dump (x); printf ("v="); mpfr_dump (y); printf ("got "); mpfr_print_binary (z2); puts (""); @@ -528,8 +528,8 @@ check_inexact (void) mpfr_set_prec (y, 28); mpfr_set_prec (z, 1023); mpfr_set_str_binary (x, "0.1000001001101101111100010011E0"); - mpfr_set_str (z, "48284762641021308813686974720835219181653367326353400027913400579340343320519877153813133510034402932651132854764198688352364361009429039801248971901380781746767119334993621199563870113045276395603170432175354501451429471578325545278975153148347684600400321033502982713296919861760382863826626093689036010394", 10, GMP_RNDN); - mpfr_div (x, x, z, GMP_RNDN); + mpfr_set_str (z, "48284762641021308813686974720835219181653367326353400027913400579340343320519877153813133510034402932651132854764198688352364361009429039801248971901380781746767119334993621199563870113045276395603170432175354501451429471578325545278975153148347684600400321033502982713296919861760382863826626093689036010394", 10, MPFR_RNDN); + mpfr_div (x, x, z, MPFR_RNDN); mpfr_set_str_binary (y, "0.1111001011001101001001111100E-1023"); if (mpfr_cmp (x, y)) { @@ -544,13 +544,13 @@ check_inexact (void) mpfr_set_prec (u, 127); mpfr_set_str_binary (u, "0.1000001100110110110101110110101101111000110000001111111110000000011111001010110100110010111111111101000001011011101011101101000E-2"); mpfr_set_prec (y, 95); - inexact = test_div (y, x, u, GMP_RNDN); + inexact = test_div (y, x, u, MPFR_RNDN); if (inexact != (cmp = get_inexact (y, x, u))) { printf ("Wrong inexact flag (0): expected %d, got %d\n", cmp, inexact); - printf ("x="); mpfr_out_str (stdout, 10, 99, x, GMP_RNDN); printf ("\n"); - printf ("u="); mpfr_out_str (stdout, 10, 99, u, GMP_RNDN); printf ("\n"); - printf ("y="); mpfr_out_str (stdout, 10, 99, y, GMP_RNDN); printf ("\n"); + printf ("x="); mpfr_out_str (stdout, 10, 99, x, MPFR_RNDN); printf ("\n"); + printf ("u="); mpfr_out_str (stdout, 10, 99, u, MPFR_RNDN); printf ("\n"); + printf ("y="); mpfr_out_str (stdout, 10, 99, y, MPFR_RNDN); printf ("\n"); exit (1); } @@ -559,7 +559,7 @@ check_inexact (void) mpfr_set_prec (u, 2); mpfr_set_str_binary (u, "0.1E0"); mpfr_set_prec (y, 28); - if ((inexact = test_div (y, x, u, GMP_RNDN) >= 0)) + if ((inexact = test_div (y, x, u, MPFR_RNDN) >= 0)) { printf ("Wrong inexact flag (1): expected -1, got %d\n", inexact); @@ -571,9 +571,9 @@ check_inexact (void) mpfr_set_prec (u, 15); mpfr_set_str_binary (u, "0.101101000001100E-1"); mpfr_set_prec (y, 92); - if ((inexact = test_div (y, x, u, GMP_RNDN)) <= 0) + if ((inexact = test_div (y, x, u, MPFR_RNDN)) <= 0) { - printf ("Wrong inexact flag for rnd=GMP_RNDN(1): expected 1, got %d\n", + printf ("Wrong inexact flag for rnd=MPFR_RNDN(1): expected 1, got %d\n", inexact); mpfr_dump (x); mpfr_dump (u); @@ -638,39 +638,39 @@ check_nan (void) mpfr_init2 (q, 100L); /* 1/nan == nan */ - mpfr_set_ui (a, 1L, GMP_RNDN); + mpfr_set_ui (a, 1L, MPFR_RNDN); MPFR_SET_NAN (d); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_nan_p (q)); /* nan/1 == nan */ MPFR_SET_NAN (a); - mpfr_set_ui (d, 1L, GMP_RNDN); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_ui (d, 1L, MPFR_RNDN); + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_nan_p (q)); /* +inf/1 == +inf */ MPFR_CLEAR_FLAGS (a); MPFR_SET_INF (a); MPFR_SET_POS (a); - mpfr_set_ui (d, 1L, GMP_RNDN); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_ui (d, 1L, MPFR_RNDN); + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_inf_p (q)); MPFR_ASSERTN (mpfr_sgn (q) > 0); /* 1/+inf == 0 */ - mpfr_set_ui (a, 1L, GMP_RNDN); + mpfr_set_ui (a, 1L, MPFR_RNDN); MPFR_CLEAR_FLAGS (d); MPFR_SET_INF (d); MPFR_SET_POS (d); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_number_p (q)); MPFR_ASSERTN (mpfr_sgn (q) == 0); /* 0/0 == nan */ - mpfr_set_ui (a, 0L, GMP_RNDN); - mpfr_set_ui (d, 0L, GMP_RNDN); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_ui (a, 0L, MPFR_RNDN); + mpfr_set_ui (d, 0L, MPFR_RNDN); + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_nan_p (q)); /* +inf/+inf == nan */ @@ -680,50 +680,50 @@ check_nan (void) MPFR_CLEAR_FLAGS (d); MPFR_SET_INF (d); MPFR_SET_POS (d); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_nan_p (q)); /* 1/+0 = +Inf */ - mpfr_set_ui (a, 1, GMP_RNDZ); - mpfr_set_ui (d, 0, GMP_RNDZ); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_ui (a, 1, MPFR_RNDZ); + mpfr_set_ui (d, 0, MPFR_RNDZ); + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0); /* 1/-0 = -Inf */ - mpfr_set_ui (a, 1, GMP_RNDZ); - mpfr_set_ui (d, 0, GMP_RNDZ); - mpfr_neg (d, d, GMP_RNDZ); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_ui (a, 1, MPFR_RNDZ); + mpfr_set_ui (d, 0, MPFR_RNDZ); + mpfr_neg (d, d, MPFR_RNDZ); + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) < 0); /* -1/+0 = -Inf */ - mpfr_set_si (a, -1, GMP_RNDZ); - mpfr_set_ui (d, 0, GMP_RNDZ); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_si (a, -1, MPFR_RNDZ); + mpfr_set_ui (d, 0, MPFR_RNDZ); + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) < 0); /* -1/-0 = +Inf */ - mpfr_set_si (a, -1, GMP_RNDZ); - mpfr_set_ui (d, 0, GMP_RNDZ); - mpfr_neg (d, d, GMP_RNDZ); - MPFR_ASSERTN (test_div (q, a, d, GMP_RNDZ) == 0); /* exact */ + mpfr_set_si (a, -1, MPFR_RNDZ); + mpfr_set_ui (d, 0, MPFR_RNDZ); + mpfr_neg (d, d, MPFR_RNDZ); + MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0); /* check overflow */ emax = mpfr_get_emax (); set_emax (1); - mpfr_set_ui (a, 1, GMP_RNDZ); - mpfr_set_ui (d, 1, GMP_RNDZ); - mpfr_div_2exp (d, d, 1, GMP_RNDZ); - test_div (q, a, d, GMP_RNDU); /* 1 / 0.5 = 2 -> overflow */ + mpfr_set_ui (a, 1, MPFR_RNDZ); + mpfr_set_ui (d, 1, MPFR_RNDZ); + mpfr_div_2exp (d, d, 1, MPFR_RNDZ); + test_div (q, a, d, MPFR_RNDU); /* 1 / 0.5 = 2 -> overflow */ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0); set_emax (emax); /* check underflow */ emin = mpfr_get_emin (); set_emin (-1); - mpfr_set_ui (a, 1, GMP_RNDZ); - mpfr_div_2exp (a, a, 2, GMP_RNDZ); + mpfr_set_ui (a, 1, MPFR_RNDZ); + mpfr_div_2exp (a, a, 2, MPFR_RNDZ); mpfr_set_prec (d, mpfr_get_prec (q) + 8); for (i = -1; i <= 1; i++) { @@ -731,8 +731,8 @@ check_nan (void) /* Test 2^(-2) / (+/- (2 + eps)), with eps < 0, eps = 0, eps > 0. -> underflow. - With div.c r5513, this test fails for eps > 0 in GMP_RNDN. */ - mpfr_set_ui (d, 2, GMP_RNDZ); + With div.c r5513, this test fails for eps > 0 in MPFR_RNDN. */ + mpfr_set_ui (d, 2, MPFR_RNDZ); if (i < 0) mpfr_nextbelow (d); if (i > 0) @@ -740,18 +740,18 @@ check_nan (void) for (sign = 0; sign <= 1; sign++) { mpfr_clear_flags (); - test_div (q, a, d, GMP_RNDZ); /* result = 0 */ + test_div (q, a, d, MPFR_RNDZ); /* result = 0 */ MPFR_ASSERTN (mpfr_underflow_p ()); MPFR_ASSERTN (sign ? MPFR_IS_NEG (q) : MPFR_IS_POS (q)); MPFR_ASSERTN (MPFR_IS_ZERO (q)); mpfr_clear_flags (); - test_div (q, a, d, GMP_RNDN); /* result = 0 iff eps >= 0 */ + test_div (q, a, d, MPFR_RNDN); /* result = 0 iff eps >= 0 */ MPFR_ASSERTN (mpfr_underflow_p ()); MPFR_ASSERTN (sign ? MPFR_IS_NEG (q) : MPFR_IS_POS (q)); if (i < 0) mpfr_nexttozero (q); MPFR_ASSERTN (MPFR_IS_ZERO (q)); - mpfr_neg (d, d, GMP_RNDN); + mpfr_neg (d, d, MPFR_RNDN); } } set_emin (emin); @@ -790,8 +790,8 @@ consistency (void) inex1 = mpfr_div (z1, x, y, rnd); MPFR_ASSERTN (!MPFR_IS_NAN (z1)); p = MAX (MAX (px, py), pz); - if (mpfr_prec_round (x, p, GMP_RNDN) != 0 || - mpfr_prec_round (y, p, GMP_RNDN) != 0) + if (mpfr_prec_round (x, p, MPFR_RNDN) != 0 || + mpfr_prec_round (y, p, MPFR_RNDN) != 0) { printf ("mpfr_prec_round error for i = %d\n", i); exit (1); @@ -819,11 +819,11 @@ test_20070603 (void) mpfr_init2 (q, 31); mpfr_init2 (c, 31); - mpfr_set_str (n, "10384593717069655257060992206846485", 10, GMP_RNDN); - mpfr_set_str (d, "10384593717069655257060992206847132", 10, GMP_RNDN); - mpfr_div (q, n, d, GMP_RNDU); + mpfr_set_str (n, "10384593717069655257060992206846485", 10, MPFR_RNDN); + mpfr_set_str (d, "10384593717069655257060992206847132", 10, MPFR_RNDN); + mpfr_div (q, n, d, MPFR_RNDU); - mpfr_set_ui (c, 1, GMP_RNDN); + mpfr_set_ui (c, 1, MPFR_RNDN); if (mpfr_cmp (q, c) != 0) { printf ("Error in test_20070603\nGot "); @@ -837,9 +837,9 @@ test_20070603 (void) mpfr_set_prec (n, 256); mpfr_set_prec (d, 256); mpfr_set_prec (q, 63); - mpfr_set_str (n, "822752278660603021077484591278675252491367930877209729029898240", 10, GMP_RNDN); - mpfr_set_str (d, "822752278660603021077484591278675252491367930877212507873738752", 10, GMP_RNDN); - mpfr_div (q, n, d, GMP_RNDU); + mpfr_set_str (n, "822752278660603021077484591278675252491367930877209729029898240", 10, MPFR_RNDN); + mpfr_set_str (d, "822752278660603021077484591278675252491367930877212507873738752", 10, MPFR_RNDN); + mpfr_div (q, n, d, MPFR_RNDU); if (mpfr_cmp (q, c) != 0) { printf ("Error in test_20070603\nGot "); @@ -872,10 +872,10 @@ test_20070628 (void) } mpfr_inits2 (53, x, y, (mpfr_ptr) 0); - mpfr_set_si (x, -1, GMP_RNDN); - mpfr_set_si_2exp (y, 1, -256, GMP_RNDN); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_set_si_2exp (y, 1, -256, MPFR_RNDN); mpfr_clear_flags (); - inex = mpfr_div (x, x, y, GMP_RNDD); + inex = mpfr_div (x, x, y, MPFR_RNDD); if (MPFR_SIGN (x) >= 0 || ! mpfr_inf_p (x)) { printf ("Error in test_20070628: expected -Inf, got\n"); @@ -915,11 +915,11 @@ main (int argc, char *argv[]) check_convergence (); check_64 (); - check4("4.0","4.503599627370496e15", GMP_RNDZ, 62, + check4("4.0","4.503599627370496e15", MPFR_RNDZ, 62, "0.10000000000000000000000000000000000000000000000000000000000000E-49"); - check4("1.0","2.10263340267725788209e+187", GMP_RNDU, 65, + check4("1.0","2.10263340267725788209e+187", MPFR_RNDU, 65, "0.11010011111001101011111001100111110100000001101001111100111000000E-622"); - check4("2.44394909079968374564e-150", "2.10263340267725788209e+187",GMP_RNDU, + check4("2.44394909079968374564e-150", "2.10263340267725788209e+187",MPFR_RNDU, 65, "0.11010011111001101011111001100111110100000001101001111100111000000E-1119"); |