summaryrefslogtreecommitdiff
path: root/tests/tget_str.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2009-03-03 16:51:07 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2009-03-03 16:51:07 +0000
commitf5f7883fc7cf47d38ed493a882fd7109bdd589bb (patch)
tree1058cf0d07593fa2cec9f32b4988ac40611b4bff /tests/tget_str.c
parentcbd40e1cb659b579e608afbe7a05da5b15a860be (diff)
downloadmpfr-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_str.c')
-rw-r--r--tests/tget_str.c300
1 files changed, 150 insertions, 150 deletions
diff --git a/tests/tget_str.c b/tests/tget_str.c
index 245ab42c1..6ef6e6075 100644
--- a/tests/tget_str.c
+++ b/tests/tget_str.c
@@ -57,9 +57,9 @@ check_small (void)
mpfr_init (x);
mpfr_set_prec (x, 20);
- mpfr_set_ui (x, 2, GMP_RNDN);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
mpfr_nexttozero (x);
- s = mpfr_get_str (NULL, &e, 4, 2, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 4, 2, x, MPFR_RNDU);
if (strcmp (s, "20") || (e != 1))
{
printf ("Error in mpfr_get_str: 2- rounded up with 2 digits"
@@ -70,18 +70,18 @@ check_small (void)
/* check n_digits=0 */
mpfr_set_prec (x, 5);
- mpfr_set_ui (x, 17, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 3, 0, x, GMP_RNDN);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 3, 0, x, MPFR_RNDN);
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 36, 0, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 36, 0, x, MPFR_RNDN);
mpfr_free_str (s);
mpfr_set_prec (x, 64);
- mpfr_set_si (x, -1, GMP_RNDN);
- mpfr_div_2exp (x, x, 63, GMP_RNDN); /* x = -2^(-63) */
- mpfr_add_ui (x, x, 1, GMP_RNDN); /* x = 1 - 2^(-63) */
- mpfr_mul_2exp (x, x, 32, GMP_RNDN); /* x = 2^32 - 2^(-31) */
- s = mpfr_get_str (NULL, &e, 3, 21, x, GMP_RNDU);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 63, MPFR_RNDN); /* x = -2^(-63) */
+ mpfr_add_ui (x, x, 1, MPFR_RNDN); /* x = 1 - 2^(-63) */
+ mpfr_mul_2exp (x, x, 32, MPFR_RNDN); /* x = 2^32 - 2^(-31) */
+ s = mpfr_get_str (NULL, &e, 3, 21, x, MPFR_RNDU);
if (strcmp (s, "102002022201221111211") || (e != 21))
{
printf ("Error in mpfr_get_str: 2^32-2^(-31) rounded up with"
@@ -89,7 +89,7 @@ check_small (void)
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 3, 20, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 3, 20, x, MPFR_RNDU);
if (strcmp (s, "10200202220122111122") || (e != 21))
{
printf ("Error in mpfr_get_str: 2^32-2^(-31) rounded up with"
@@ -101,7 +101,7 @@ check_small (void)
/* check corner case ret!=0, j0!=0 in mpfr_get_str_aux */
mpfr_set_prec (x, 100);
mpfr_set_str_binary (x, "0.1001011111010001101110010101010101111001010111111101101101100110100011110110000101110110001011110000E-9");
- s = mpfr_get_str (NULL, &e, 3, 2, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 3, 2, x, MPFR_RNDU);
if (strcmp (s, "22") || (e != -6))
{
printf ("Error in mpfr_get_str: 100-bit number rounded up with"
@@ -113,7 +113,7 @@ check_small (void)
/* check corner case exact=0 in mpfr_get_str_aux */
mpfr_set_prec (x, 100);
mpfr_set_str_binary (x, "0.1001001111101101111000101000110111111010101100000110010001111111011001101011101100001100110000000000E8");
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDZ);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDZ);
if (strcmp (s, "14") || (e != 3))
{
printf ("Error in mpfr_get_str: 100-bit number rounded to zero with"
@@ -125,9 +125,9 @@ check_small (void)
for (p=4; p<=200; p++)
{
mpfr_set_prec (x, p);
- mpfr_set_str (x, "6.5", 10, GMP_RNDN);
+ mpfr_set_str (x, "6.5", 10, MPFR_RNDN);
- s = mpfr_get_str (NULL, &e, 6, 2, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 6, 2, x, MPFR_RNDN);
if (strcmp (s, "10") || (e != 2))
{
printf ("Error in mpfr_get_str: 6.5 rounded to nearest with"
@@ -137,7 +137,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_nexttoinf (x);
- s = mpfr_get_str (NULL, &e, 6, 2, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 6, 2, x, MPFR_RNDN);
if (strcmp (s, "11") || (e != 2))
{
printf ("Error in mpfr_get_str: 6.5+ rounded to nearest with"
@@ -147,9 +147,9 @@ check_small (void)
}
mpfr_free_str (s);
- mpfr_set_str (x, "6.5", 10, GMP_RNDN);
+ mpfr_set_str (x, "6.5", 10, MPFR_RNDN);
mpfr_nexttozero (x);
- s = mpfr_get_str (NULL, &e, 6, 2, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 6, 2, x, MPFR_RNDN);
if (strcmp (s, "10") || (e != 2))
{
printf ("Error in mpfr_get_str: 6.5- rounded to nearest with"
@@ -160,8 +160,8 @@ check_small (void)
}
mpfr_set_prec (x, 3);
- mpfr_set_ui (x, 7, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 2, 2, x, GMP_RNDU);
+ mpfr_set_ui (x, 7, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 2, 2, x, MPFR_RNDU);
if (strcmp (s, "10") || (e != 4))
{
printf ("Error in mpfr_get_str: 7 rounded up with 2 bits should"
@@ -172,19 +172,19 @@ check_small (void)
/* problem found by Fabrice Rouillier */
mpfr_set_prec (x, 63);
- mpfr_set_str (x, "5e14", 10, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDU);
+ mpfr_set_str (x, "5e14", 10, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDU);
mpfr_free_str (s);
/* bug found by Johan Vervloet */
mpfr_set_prec (x, 6);
- mpfr_set_str (x, "688.0", 10, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 2, 4, x, GMP_RNDU);
+ mpfr_set_str (x, "688.0", 10, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 2, 4, x, MPFR_RNDU);
if (strcmp (s, "1011") || (e != 10))
{
printf ("Error in mpfr_get_str: 688 printed up to 4 bits should"
" give 1.011e9\ninstead of ");
- mpfr_out_str (stdout, 2, 4, x, GMP_RNDU);
+ mpfr_out_str (stdout, 2, 4, x, MPFR_RNDU);
puts ("");
exit (1);
}
@@ -192,7 +192,7 @@ check_small (void)
mpfr_set_prec (x, 38);
mpfr_set_str_binary (x, "1.0001110111110100011010100010010100110e-6");
- s = mpfr_get_str (NULL, &e, 8, 10, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 8, 10, x, MPFR_RNDU);
if (strcmp (s, "1073721522") || (e != -1))
{
printf ("Error in mpfr_get_str (3): s=%s e=%d\n", s, (int) e);
@@ -202,7 +202,7 @@ check_small (void)
mpfr_set_prec (x, 53);
mpfr_set_str_binary (x, "0.11010111011101100010000100010101110001000000010111001E454");
- s = mpfr_get_str (NULL, &e, 19, 12, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 19, 12, x, MPFR_RNDU);
if (strcmp (s, "b1cgfa4gha0h") || (e != 107))
{
printf ("Error in mpfr_get_str (4): s=%s e=%d\n", s, (int) e);
@@ -212,7 +212,7 @@ check_small (void)
mpfr_set_prec (x, 145);
mpfr_set_str_binary (x, "-0.1000110011000001011000010101101010110110101100101110100011111100011110011001001001010000100001000011000011000000010111011001000111101001110100110e6");
- s = mpfr_get_str (NULL, &e, 4, 53, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 4, 53, x, MPFR_RNDU);
if (strcmp (s, "-20303001120111222312230232203330132121021100201003003") || (e != 3))
{
printf ("Error in mpfr_get_str (5): s=%s e=%d\n", s, (int) e);
@@ -222,7 +222,7 @@ check_small (void)
mpfr_set_prec (x, 45);
mpfr_set_str_binary (x, "-0.00100111010110010001011001110111010001010010010");
- s = mpfr_get_str (NULL, &e, 32, 9, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 32, 9, x, MPFR_RNDN);
if (strcmp (s, "-4tchctq54") || (e != 0))
{
printf ("Error in mpfr_get_str (6): s=%s e=%d\n", s, (int) e);
@@ -233,7 +233,7 @@ check_small (void)
/* worst case found by Vincent Lefe`vre */
mpfr_set_prec (x, 53);
mpfr_set_str_binary (x, "10011110111100000000001011011110101100010000011011111E164");
- s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
if (strcmp (s, "13076622631878654") || (e != 66))
{
printf ("Error in mpfr_get_str (7): s=%s e=%d\n", s, (int) e);
@@ -241,7 +241,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10000001001001001100011101010011011011111000011000100E93");
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU);
if (strcmp (s, "46") || e != 44)
{
printf ("Error in mpfr_get_str (8): s=%s e=%d\n", s, (int) e);
@@ -249,7 +249,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10010001111100000111001111010101001010000010111010101E55");
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN);
if (strcmp (s, "19") || e != 33)
{
printf ("Error in mpfr_get_str (9): s=%s e=%d\n", s, (int) e);
@@ -257,7 +257,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "11011001010010111110010101101100111110111000010110110E44");
- s = mpfr_get_str (NULL, &e, 10, 3, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 3, x, MPFR_RNDN);
if (strcmp (s, "135") || e != 30)
{
printf ("Error in mpfr_get_str (10): s=%s e=%d\n", s, (int) e);
@@ -265,7 +265,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "11101111101000001011100001111000011111101111011001100E72");
- s = mpfr_get_str (NULL, &e, 10, 4, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 4, x, MPFR_RNDN);
if (strcmp (s, "3981") || e != 38)
{
printf ("Error in mpfr_get_str (11): s=%s e=%d\n", s, (int) e);
@@ -273,7 +273,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10011001001100100010111100001101110101001001111110000E46");
- s = mpfr_get_str (NULL, &e, 10, 5, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 5, x, MPFR_RNDN);
if (strcmp (s, "37930") || e != 30)
{
printf ("Error in mpfr_get_str (12): s=%s e=%d\n", s, (int) e);
@@ -281,7 +281,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10001100110111001011011110011011011101100011010001011E-72");
- s = mpfr_get_str (NULL, &e, 10, 6, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 6, x, MPFR_RNDN);
if (strcmp (s, "104950") || e != -5)
{
printf ("Error in mpfr_get_str (13): s=%s e=%d\n", s, (int) e);
@@ -290,7 +290,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "10100100001011001000011001101101000110100110000010111E89");
- s = mpfr_get_str (NULL, &e, 10, 7, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDN);
if (strcmp (s, "3575392") || e != 43)
{
printf ("Error in mpfr_get_str (14): s=%s e=%d\n", s, (int) e);
@@ -299,7 +299,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "11000011011110110010100110001010000001010011001011001E-73");
- s = mpfr_get_str (NULL, &e, 10, 8, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDN);
if (strcmp (s, "72822386") || e != -6)
{
printf ("Error in mpfr_get_str (15): s=%s e=%d\n", s, (int) e);
@@ -308,7 +308,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "10101010001101000111001100001000100011100010010001010E78");
- s = mpfr_get_str (NULL, &e, 10, 9, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDN);
if (strcmp (s, "180992873") || e != 40)
{
printf ("Error in mpfr_get_str (16): s=%s e=%d\n", s, (int) e);
@@ -317,7 +317,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "10110111001000100000001101111001100101101110011011101E91");
- s = mpfr_get_str (NULL, &e, 10, 10, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 10, x, MPFR_RNDN);
if (strcmp (s, "1595312255") || e != 44)
{
printf ("Error in mpfr_get_str (17): s=%s e=%d\n", s, (int) e);
@@ -325,7 +325,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10011101010111101111000100111011101011110100110110101E93");
- s = mpfr_get_str (NULL, &e, 10, 11, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 11, x, MPFR_RNDN);
if (strcmp (s, "54835744350") || e != 44)
{
printf ("Error in mpfr_get_str (18): s=%s e=%d\n", s, (int) e);
@@ -333,7 +333,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10011101010111101111000100111011101011110100110110101E92");
- s = mpfr_get_str (NULL, &e, 10, 12, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 12, x, MPFR_RNDN);
if (strcmp (s, "274178721752") || e != 44)
{
printf ("Error in mpfr_get_str (19): s=%s e=%d\n", s, (int) e);
@@ -341,7 +341,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10011101010111101111000100111011101011110100110110101E91");
- s = mpfr_get_str (NULL, &e, 10, 13, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 13, x, MPFR_RNDN);
if (strcmp (s, "1370893608762") || e != 44)
{
printf ("Error in mpfr_get_str (20): s=%s e=%d\n", s, (int) e);
@@ -350,7 +350,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "10010011010110011100010010100101100011101000011111111E92");
- s = mpfr_get_str (NULL, &e, 10, 14, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDN);
if (strcmp (s, "25672105101864") || e != 44)
{
printf ("Error in mpfr_get_str (21): s=%s e=%d\n", s, (int) e);
@@ -359,7 +359,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "100110111110110001000101110100100101101000011111001E87");
- s = mpfr_get_str (NULL, &e, 10, 15, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDN);
if (strcmp (s, "212231308858721") || e != 42)
{
printf ("Error in mpfr_get_str (22): s=%s e=%d\n", s, (int) e);
@@ -367,7 +367,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10111010110000111000101100101111001011011100101001111E-128");
- s = mpfr_get_str (NULL, &e, 10, 15, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDN);
if (strcmp (s, "193109287087290") || e != -22)
{
printf ("Error in mpfr_get_str (22b): s=%s e=%d\n", s, (int) e);
@@ -376,7 +376,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "10001101101011010001111110000111010111010000110101010E80");
- s = mpfr_get_str (NULL, &e, 10, 16, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDN);
if (strcmp (s, "6026241735727920") || e != 40)
{
printf ("Error in mpfr_get_str (23): s=%s e=%d\n", s, (int) e);
@@ -385,7 +385,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "100010001011101001110101000110011001001000110001001E-81");
- s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
if (strcmp (s, "49741483709103481") || e != -9)
{
printf ("Error in mpfr_get_str (24): s=%s e=%d\n", s, (int) e);
@@ -393,7 +393,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "11000100001001001110111010011001111001001010110101111E-101");
- s = mpfr_get_str (NULL, &e, 10, 7, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDN);
if (strcmp (s, "2722049") || e != -14)
{
printf ("Error in mpfr_get_str (25): s=%s e=%d\n", s, (int) e);
@@ -401,7 +401,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "11111001010011100101000001111111110001001001110110001E-135");
- s = mpfr_get_str (NULL, &e, 10, 8, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDN);
if (strcmp (s, "20138772") || e != -24)
{
printf ("Error in mpfr_get_str (26): s=%s e=%d\n", s, (int) e);
@@ -410,7 +410,7 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "11111001010011100101000001111111110001001001110110001E-136");
- s = mpfr_get_str (NULL, &e, 10, 9, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDN);
if (strcmp (s, "100693858") || e != -24)
{
printf ("Error in mpfr_get_str (27): s=%s e=%d\n", s, (int) e);
@@ -418,7 +418,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10001000001110010110001011111011111011011010000110001E-110");
- s = mpfr_get_str (NULL, &e, 10, 14, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDN);
if (strcmp (s, "36923634350619") || e != -17)
{
printf ("Error in mpfr_get_str (28): s=%s e=%d\n", s, (int) e);
@@ -426,7 +426,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "11001100010111000111100010000110011101110001000101111E-87");
- s = mpfr_get_str (NULL, &e, 10, 16, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDN);
if (strcmp (s, "4646636036100804") || e != -10)
{
printf ("Error in mpfr_get_str (29): s=%s e=%d\n", s, (int) e);
@@ -434,7 +434,7 @@ check_small (void)
}
mpfr_free_str (s);
mpfr_set_str_binary (x, "10011111001111110100001001010111111011010101111111000E-99");
- s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
if (strcmp (s, "88399901882446712") || e != -14)
{
printf ("Error in mpfr_get_str (30): s=%s e=%d\n", s, (int) e);
@@ -444,14 +444,14 @@ check_small (void)
/* 8116315218207718*2^(-293) ~ 0.5100000000000000000015*10^(-72) */
mpfr_set_str_binary (x, "11100110101011011111011100101011101110110001111100110E-293");
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU);
if (strcmp (s, "52") || e != -72)
{
printf ("Error in mpfr_get_str (31u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDD);
if (strcmp (s, "51") || e != -72)
{
printf ("Error in mpfr_get_str (31d): s=%s e=%d\n", s, (int) e);
@@ -461,14 +461,14 @@ check_small (void)
/* 6712731423444934*2^536 ~ .151000000000000000000067*10^178 */
mpfr_set_str_binary (x, "10111110110010011000110010011111101111000111111000110E536");
- s = mpfr_get_str (NULL, &e, 10, 3, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 3, x, MPFR_RNDU);
if (strcmp (s, "152") || e != 178)
{
printf ("Error in mpfr_get_str (32u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 3, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 3, x, MPFR_RNDD);
if (strcmp (s, "151") || e != 178)
{
printf ("Error in mpfr_get_str (32d): s=%s e=%d\n", s, (int) e);
@@ -478,14 +478,14 @@ check_small (void)
/* 3356365711722467*2^540 ~ .120800000000000000000054*10^179 */
mpfr_set_str_binary (x, "1011111011001001100011001001111110111100011111100011E540");
- s = mpfr_get_str (NULL, &e, 10, 4, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 4, x, MPFR_RNDU);
if (strcmp (s, "1209") || e != 179)
{
printf ("Error in mpfr_get_str (33u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 4, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 4, x, MPFR_RNDD);
if (strcmp (s, "1208") || e != 179)
{
printf ("Error in mpfr_get_str (33d): s=%s e=%d\n", s, (int) e);
@@ -495,14 +495,14 @@ check_small (void)
/* 6475049196144587*2^100 ~ .8208099999999999999999988*10^46 */
mpfr_set_str_binary (x, "10111000000010000010111011111001111010100011111001011E100");
- s = mpfr_get_str (NULL, &e, 10, 5, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 5, x, MPFR_RNDU);
if (strcmp (s, "82081") || e != 46)
{
printf ("Error in mpfr_get_str (34u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 5, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 5, x, MPFR_RNDD);
if (strcmp (s, "82080") || e != 46)
{
printf ("Error in mpfr_get_str (34d): s=%s e=%d\n", s, (int) e);
@@ -512,14 +512,14 @@ check_small (void)
/* 6722280709661868*2^364 ~ .25260100000000000000000012*10^126 */
mpfr_set_str_binary (x, "10111111000011110000011110001110001111010010010101100E364");
- s = mpfr_get_str (NULL, &e, 10, 6, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 6, x, MPFR_RNDU);
if (strcmp (s, "252602") || e != 126)
{
printf ("Error in mpfr_get_str (35u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 6, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 6, x, MPFR_RNDD);
if (strcmp (s, "252601") || e != 126)
{
printf ("Error in mpfr_get_str (35d): s=%s e=%d\n", s, (int) e);
@@ -529,14 +529,14 @@ check_small (void)
/* 5381065484265332*2^(-455) ~ .578389299999999999999999982*10^(-121) */
mpfr_set_str_binary (x, "10011000111100000110011110000101100111110011101110100E-455");
- s = mpfr_get_str (NULL, &e, 10, 7, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDU);
if (strcmp (s, "5783893") || e != -121)
{
printf ("Error in mpfr_get_str (36u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 7, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDD);
if (strcmp (s, "5783892") || e != -121)
{
printf ("Error in mpfr_get_str (36d): s=%s e=%d\n", s, (int) e);
@@ -546,14 +546,14 @@ check_small (void)
/* 8369123604277281*2^(-852) ~ .27869147000000000000000000056*10^(-240) */
mpfr_set_str_binary (x, "11101101110111010110001101111100000111010100000100001E-852");
- s = mpfr_get_str (NULL, &e, 10, 8, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDU);
if (strcmp (s, "27869148") || e != -240)
{
printf ("Error in mpfr_get_str (37u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 8, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDD);
if (strcmp (s, "27869147") || e != -240)
{
printf ("Error in mpfr_get_str (37d): s=%s e=%d\n", s, (int) e);
@@ -563,14 +563,14 @@ check_small (void)
/* 7976538478610756*2^377 ~ .245540326999999999999999999982*10^130 */
mpfr_set_str_binary (x, "11100010101101001111010010110100011100000100101000100E377");
- s = mpfr_get_str (NULL, &e, 10, 9, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDU);
if (strcmp (s, "245540327") || e != 130)
{
printf ("Error in mpfr_get_str (38u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 9, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDD);
if (strcmp (s, "245540326") || e != 130)
{
printf ("Error in mpfr_get_str (38d): s=%s e=%d\n", s, (int) e);
@@ -580,14 +580,14 @@ check_small (void)
/* 8942832835564782*2^(-382) ~ .9078555839000000000000000000038*10^(-99) */
mpfr_set_str_binary (x, "11111110001010111010110000110011100110001010011101110E-382");
- s = mpfr_get_str (NULL, &e, 10, 10, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 10, x, MPFR_RNDU);
if (strcmp (s, "9078555840") || e != -99)
{
printf ("Error in mpfr_get_str (39u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 10, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 10, x, MPFR_RNDD);
if (strcmp (s, "9078555839") || e != -99)
{
printf ("Error in mpfr_get_str (39d): s=%s e=%d\n", s, (int) e);
@@ -597,14 +597,14 @@ check_small (void)
/* 4471416417782391*2^(-380) ~ .18157111678000000000000000000077*10^(-98) */
mpfr_set_str_binary (x, "1111111000101011101011000011001110011000101001110111E-380");
- s = mpfr_get_str (NULL, &e, 10, 11, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 11, x, MPFR_RNDU);
if (strcmp (s, "18157111679") || e != -98)
{
printf ("Error in mpfr_get_str (40u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 11, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 11, x, MPFR_RNDD);
if (strcmp (s, "18157111678") || e != -98)
{
printf ("Error in mpfr_get_str (40d): s=%s e=%d\n", s, (int) e);
@@ -614,14 +614,14 @@ check_small (void)
/* 7225450889282194*2^711 ~ .778380362292999999999999999999971*10^230 */
mpfr_set_str_binary (x, "11001101010111000001001100001100110010000001010010010E711");
- s = mpfr_get_str (NULL, &e, 10, 12, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 12, x, MPFR_RNDU);
if (strcmp (s, "778380362293") || e != 230)
{
printf ("Error in mpfr_get_str (41u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 12, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 12, x, MPFR_RNDD);
if (strcmp (s, "778380362292") || e != 230)
{
printf ("Error in mpfr_get_str (41d): s=%s e=%d\n", s, (int) e);
@@ -631,14 +631,14 @@ check_small (void)
/* 3612725444641097*2^713 ~ .1556760724585999999999999999999942*10^231 */
mpfr_set_str_binary (x, "1100110101011100000100110000110011001000000101001001E713");
- s = mpfr_get_str (NULL, &e, 10, 13, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 13, x, MPFR_RNDU);
if (strcmp (s, "1556760724586") || e != 231)
{
printf ("Error in mpfr_get_str (42u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 13, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 13, x, MPFR_RNDD);
if (strcmp (s, "1556760724585") || e != 231)
{
printf ("Error in mpfr_get_str (42d): s=%s e=%d\n", s, (int) e);
@@ -648,14 +648,14 @@ check_small (void)
/* 6965949469487146*2^(-248) ~ .15400733123779000000000000000000016*10^(-58) */
mpfr_set_str_binary (x, "11000101111110111111001111111101001101111000000101010E-248");
- s = mpfr_get_str (NULL, &e, 10, 14, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDU);
if (strcmp (s, "15400733123780") || e != -58)
{
printf ("Error in mpfr_get_str (43u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 14, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDD);
if (strcmp (s, "15400733123779") || e != -58)
{
printf ("Error in mpfr_get_str (43d): s=%s e=%d\n", s, (int) e);
@@ -665,14 +665,14 @@ check_small (void)
/* 3482974734743573*2^(-244) ~ .12320586499023200000000000000000013*10^(-57) */
mpfr_set_str_binary (x, "1100010111111011111100111111110100110111100000010101E-244");
- s = mpfr_get_str (NULL, &e, 10, 15, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDU);
if (strcmp (s, "123205864990233") || e != -57)
{
printf ("Error in mpfr_get_str (44u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 15, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDD);
if (strcmp (s, "123205864990232") || e != -57)
{
printf ("Error in mpfr_get_str (44d): s=%s e=%d\n", s, (int) e);
@@ -682,14 +682,14 @@ check_small (void)
/* 7542952370752766*2^(-919) ~ .170206189963739699999999999999999974*10^(-260) */
mpfr_set_str_binary (x, "11010110011000100011001110100100111011100110011111110E-919");
- s = mpfr_get_str (NULL, &e, 10, 16, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDU);
if (strcmp (s, "1702061899637397") || e != -260)
{
printf ("Error in mpfr_get_str (45u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 16, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDD);
if (strcmp (s, "1702061899637396") || e != -260)
{
printf ("Error in mpfr_get_str (45d): s=%s e=%d\n", s, (int) e);
@@ -699,14 +699,14 @@ check_small (void)
/* 5592117679628511*2^165 ~ .26153245263757307000000000000000000074*10^66 */
mpfr_set_str_binary (x, "10011110111100000000001011011110101100010000011011111E165");
- s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDU);
if (strcmp (s, "26153245263757308") || e != 66)
{
printf ("Error in mpfr_get_str (46u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDD);
if (strcmp (s, "26153245263757307") || e != 66)
{
printf ("Error in mpfr_get_str (46d): s=%s e=%d\n", s, (int) e);
@@ -715,21 +715,21 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "11010010110111100001011010000110010000100001011011101E1223");
- s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
if (strcmp (s, "10716284017294180") || e != 385)
{
printf ("Error in mpfr_get_str (47n): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDU);
if (strcmp (s, "107162840172941805") || e != 385)
{
printf ("Error in mpfr_get_str (47u): s=%s e=%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDD);
if (strcmp (s, "107162840172941804") || e != 385)
{
printf ("Error in mpfr_get_str (47d): s=%s e=%d\n", s, (int) e);
@@ -738,21 +738,21 @@ check_small (void)
mpfr_free_str (s);
mpfr_set_str_binary (x, "11111101111011000001010100001101101000010010001111E122620");
- s = mpfr_get_str (NULL, &e, 10, 17, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
if (strcmp (s, "22183435284042374") || e != 36928)
{
printf ("Error in mpfr_get_str (48n): s=%s e=%ld\n", s, (long) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDU);
if (strcmp (s, "221834352840423736") || e != 36928)
{
printf ("Error in mpfr_get_str (48u): s=%s e=%ld\n", s, (long) e);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 18, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDD);
if (strcmp (s, "221834352840423735") || e != 36928)
{
printf ("Error in mpfr_get_str (48d): s=%s e=%ld\n", s, (long) e);
@@ -762,30 +762,30 @@ check_small (void)
mpfr_set_prec (x, 45);
mpfr_set_str_binary (x, "1E45");
- s = mpfr_get_str (NULL, &e, 32, 9, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 32, 9, x, MPFR_RNDN);
mpfr_free_str (s);
mpfr_set_prec (x, 7);
mpfr_set_str_binary (x, "0.1010101E10");
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU);
mpfr_free_str (s);
/* checks rounding of negative numbers */
mpfr_set_prec (x, 7);
- mpfr_set_str (x, "-11.5", 10, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDD);
+ mpfr_set_str (x, "-11.5", 10, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDD);
if (strcmp (s, "-12"))
{
- printf ("Error in mpfr_get_str for x=-11.5 and rnd=GMP_RNDD\n"
+ printf ("Error in mpfr_get_str for x=-11.5 and rnd=MPFR_RNDD\n"
"got %s instead of -12\n", s);
exit (1);
}
mpfr_free_str (s);
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU);
if (strcmp (s, "-11"))
{
- printf ("Error in mpfr_get_str for x=-11.5 and rnd=GMP_RNDU\n");
+ printf ("Error in mpfr_get_str for x=-11.5 and rnd=MPFR_RNDU\n");
exit (1);
}
mpfr_free_str (s);
@@ -793,12 +793,12 @@ check_small (void)
/* bug found by Jean-Pierre Merlet, produced error in mpfr_get_str */
mpfr_set_prec (x, 128);
mpfr_set_str_binary (x, "0.10111001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011010E3");
- s = mpfr_get_str (NULL, &e, 10, 0, x, GMP_RNDU);
+ s = mpfr_get_str (NULL, &e, 10, 0, x, MPFR_RNDU);
mpfr_free_str (s);
mpfr_set_prec (x, 381);
mpfr_set_str_binary (x, "0.111111111111111111111111111111111111111111111111111111111111111111101110110000100110011101101101001010111000101111000100100011110101010110101110100000010100001000110100000100011111001000010010000010001010111001011110000001110010111101100001111000101101100000010110000101100100000101010110010110001010100111001111100011100101100000100100111001100010010011110011011010110000001000010");
- s = mpfr_get_str (NULL, &e, 10, 0, x, GMP_RNDD);
+ s = mpfr_get_str (NULL, &e, 10, 0, x, MPFR_RNDD);
if (e != 0)
{
printf ("Error in mpfr_get_str for x=0.999999..., exponent is %d"
@@ -920,9 +920,9 @@ check_large (void)
mp_exp_t e;
mpfr_init2 (x, 3322);
- mpfr_set_str (x, xm, 10, GMP_RNDN);
- mpfr_div_2exp (x, x, 4343, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 10, 1000, x, GMP_RNDN);
+ mpfr_set_str (x, xm, 10, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 4343, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN);
if (s[999] != '1') /* s must be 5.04383...689071e-309 */
{
printf ("Error in check_large: expected '689071', got '%s'\n",
@@ -931,8 +931,8 @@ check_large (void)
}
mpfr_free_str (s);
- mpfr_mul_2exp (x, x, 4343, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDN);
+ mpfr_mul_2exp (x, x, 4343, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN);
if (strcmp (s, "12") || (e != 1000))
{
printf ("Error in check_large: expected 0.12e1000\n");
@@ -942,7 +942,7 @@ check_large (void)
mpfr_free_str (s);
mpfr_set_nan (x);
- s = mpfr_get_str (NULL, &e, 10, 1000, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN);
if (strcmp (s, "@NaN@"))
{
printf ("Error for NaN\n");
@@ -950,10 +950,10 @@ check_large (void)
}
mpfr_free_str (s);
- mpfr_get_str (s1, &e, 10, 1000, x, GMP_RNDN);
+ mpfr_get_str (s1, &e, 10, 1000, x, MPFR_RNDN);
mpfr_set_inf (x, 1);
- s = mpfr_get_str (NULL, &e, 10, 1000, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN);
if (strcmp (s, "@Inf@"))
{
printf ("Error for Inf\n");
@@ -961,10 +961,10 @@ check_large (void)
}
mpfr_free_str (s);
- mpfr_get_str (s1, &e, 10, 1000, x, GMP_RNDN);
+ mpfr_get_str (s1, &e, 10, 1000, x, MPFR_RNDN);
mpfr_set_inf (x, -1);
- s = mpfr_get_str (NULL, &e, 10, 1000, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN);
if (strcmp (s, "-@Inf@"))
{
printf ("Error for -Inf\n");
@@ -972,27 +972,27 @@ check_large (void)
}
mpfr_free_str (s);
- mpfr_get_str (s1, &e, 10, 1000, x, GMP_RNDN);
+ mpfr_get_str (s1, &e, 10, 1000, x, MPFR_RNDN);
- mpfr_set_ui (x, 0, GMP_RNDN);
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN);
if (e != 0 || strcmp (s, "00"))
{
printf ("Error for 0.0\n");
exit (1);
}
mpfr_free_str (s);
- mpfr_get_str (s1, &e, 10, 2, x, GMP_RNDN);
+ mpfr_get_str (s1, &e, 10, 2, x, MPFR_RNDN);
- mpfr_neg (x, x, GMP_RNDN); /* -0.0 */
- s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0.0 */
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN);
if (e != 0 || strcmp (s, "-00"))
{
printf ("Error for -0.0\ngot %se%d\n", s, (int) e);
exit (1);
}
mpfr_free_str (s);
- mpfr_get_str (s1, &e, 10, 2, x, GMP_RNDN);
+ mpfr_get_str (s1, &e, 10, 2, x, MPFR_RNDN);
mpfr_clear (x);
}
@@ -1010,19 +1010,19 @@ check_special (int b, mp_prec_t p)
size_t m;
/* check for invalid base */
- MPFR_ASSERTN(mpfr_get_str (s, &e, 1, 10, x, GMP_RNDN) == NULL);
- MPFR_ASSERTN(mpfr_get_str (s, &e, 37, 10, x, GMP_RNDN) == NULL);
+ MPFR_ASSERTN(mpfr_get_str (s, &e, 1, 10, x, MPFR_RNDN) == NULL);
+ MPFR_ASSERTN(mpfr_get_str (s, &e, 37, 10, x, MPFR_RNDN) == NULL);
s2[0] = '1';
for (i=1; i<MAX_DIGITS+2; i++)
s2[i] = '0';
mpfr_init2 (x, p);
- mpfr_set_ui (x, 1, GMP_RNDN);
- for (i=1; i<MAX_DIGITS && mpfr_mul_ui (x, x, b, GMP_RNDN) == 0; i++)
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ for (i=1; i<MAX_DIGITS && mpfr_mul_ui (x, x, b, MPFR_RNDN) == 0; i++)
{
/* x = b^i (exact) */
- for (r = 0; r < GMP_RND_MAX; r++)
+ for (r = 0; r < MPFR_RND_MAX; r++)
for (m= (i<3)? 2 : i-1 ; (int) m <= i+1 ; m++)
{
mpfr_get_str (s, &e, b, m, x, (mp_rnd_t) r);
@@ -1033,10 +1033,10 @@ check_special (int b, mp_prec_t p)
exit (1);
}
}
- if (mpfr_sub_ui (x, x, 1, GMP_RNDN) != 0)
+ if (mpfr_sub_ui (x, x, 1, MPFR_RNDN) != 0)
break;
/* now x = b^i-1 (exact) */
- for (r = 0; r < GMP_RND_MAX; r++)
+ for (r = 0; r < MPFR_RND_MAX; r++)
if (i >= 2)
{
mpfr_get_str (s, &e, b, i, x, (mp_rnd_t) r);
@@ -1052,7 +1052,7 @@ check_special (int b, mp_prec_t p)
}
if (i >= 3)
{
- mpfr_get_str (s, &e, b, i - 1, x, GMP_RNDU);
+ mpfr_get_str (s, &e, b, i - 1, x, MPFR_RNDU);
/* should be b^i */
if ((e != i+1) || strncmp (s, s2, i - 1) != 0)
{
@@ -1062,7 +1062,7 @@ check_special (int b, mp_prec_t p)
}
}
- mpfr_add_ui (x, x, 1, GMP_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
}
mpfr_clear (x);
}
@@ -1082,10 +1082,10 @@ check_bug_base2k (void)
mpfr_init2 (yy, 79);
mpfr_init2 (zz, 99);
- mpfr_set_str (xx, "-1.90e8c3e525d7c0000000000000@-18", 16, GMP_RNDN);
- mpfr_set_str (yy, "-2.63b22b55697e8000000@130", 16, GMP_RNDN);
- mpfr_add (zz, xx, yy, GMP_RNDD);
- s = mpfr_get_str (NULL, &e, 16, 0, zz, GMP_RNDN);
+ mpfr_set_str (xx, "-1.90e8c3e525d7c0000000000000@-18", 16, MPFR_RNDN);
+ mpfr_set_str (yy, "-2.63b22b55697e8000000@130", 16, MPFR_RNDN);
+ mpfr_add (zz, xx, yy, MPFR_RNDD);
+ s = mpfr_get_str (NULL, &e, 16, 0, zz, MPFR_RNDN);
if (strcmp (s, "-263b22b55697e8000000000008"))
{
printf ("Error for get_str base 16\n"
@@ -1105,9 +1105,9 @@ check_reduced_exprange (void)
emax = mpfr_get_emax ();
mpfr_init2 (x, 8);
- mpfr_set_str (x, "0.11111111E0", 2, GMP_RNDN);
+ mpfr_set_str (x, "0.11111111E0", 2, MPFR_RNDN);
set_emax (0);
- s = mpfr_get_str (NULL, &e, 16, 0, x, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 16, 0, x, MPFR_RNDN);
set_emax (emax);
if (strcmp (s, "ff0"))
{
@@ -1160,23 +1160,23 @@ main (int argc, char *argv[])
mpfr_clear (x);
check_large ();
- check3 ("4.059650008e-83", GMP_RNDN, "40597");
- check3 ("-6.606499965302424244461355e233", GMP_RNDN, "-66065");
- check3 ("-7.4", GMP_RNDN, "-74000");
- check3 ("0.997", GMP_RNDN, "99700");
- check3 ("-4.53063926135729747564e-308", GMP_RNDN, "-45306");
- check3 ("2.14478198760196000000e+16", GMP_RNDN, "21448");
- check3 ("7.02293374921793516813e-84", GMP_RNDN, "70229");
-
- check3 ("-6.7274500420134077e-87", GMP_RNDN, "-67275");
- check3 ("-6.7274500420134077e-87", GMP_RNDZ, "-67274");
- check3 ("-6.7274500420134077e-87", GMP_RNDU, "-67274");
- check3 ("-6.7274500420134077e-87", GMP_RNDD, "-67275");
-
- check3 ("6.7274500420134077e-87", GMP_RNDN, "67275");
- check3 ("6.7274500420134077e-87", GMP_RNDZ, "67274");
- check3 ("6.7274500420134077e-87", GMP_RNDU, "67275");
- check3 ("6.7274500420134077e-87", GMP_RNDD, "67274");
+ check3 ("4.059650008e-83", MPFR_RNDN, "40597");
+ check3 ("-6.606499965302424244461355e233", MPFR_RNDN, "-66065");
+ check3 ("-7.4", MPFR_RNDN, "-74000");
+ check3 ("0.997", MPFR_RNDN, "99700");
+ check3 ("-4.53063926135729747564e-308", MPFR_RNDN, "-45306");
+ check3 ("2.14478198760196000000e+16", MPFR_RNDN, "21448");
+ check3 ("7.02293374921793516813e-84", MPFR_RNDN, "70229");
+
+ check3 ("-6.7274500420134077e-87", MPFR_RNDN, "-67275");
+ check3 ("-6.7274500420134077e-87", MPFR_RNDZ, "-67274");
+ check3 ("-6.7274500420134077e-87", MPFR_RNDU, "-67274");
+ check3 ("-6.7274500420134077e-87", MPFR_RNDD, "-67275");
+
+ check3 ("6.7274500420134077e-87", MPFR_RNDN, "67275");
+ check3 ("6.7274500420134077e-87", MPFR_RNDZ, "67274");
+ check3 ("6.7274500420134077e-87", MPFR_RNDU, "67275");
+ check3 ("6.7274500420134077e-87", MPFR_RNDD, "67274");
check_bug_base2k ();
check_reduced_exprange ();