diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-09-14 15:28:21 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-09-14 15:28:21 +0000 |
commit | 637828131d10c07859b8715e6acd7ec5aa939e56 (patch) | |
tree | 467151881401bdbde18b2254040f489a8d7b86ad /tests | |
parent | 57572d9ed5f15ea3355e721b6b60535ad19ddb8a (diff) | |
download | mpfr-637828131d10c07859b8715e6acd7ec5aa939e56.tar.gz |
[tests] Got rid of the use of mpfr_print_binary, in general with
mpfr_dump. Replaced some "mpfr_out_str (stdout, 2, ...)" by mpfr_dump
for consistency or as improvements. Some other corrections in the
related error messages.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11750 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tabs.c | 7 | ||||
-rw-r--r-- | tests/tcmp2.c | 6 | ||||
-rw-r--r-- | tests/tconst_euler.c | 3 | ||||
-rw-r--r-- | tests/tcos.c | 12 | ||||
-rw-r--r-- | tests/tcoth.c | 10 | ||||
-rw-r--r-- | tests/tdiv.c | 23 | ||||
-rw-r--r-- | tests/texp.c | 21 | ||||
-rw-r--r-- | tests/texp10.c | 14 | ||||
-rw-r--r-- | tests/texp2.c | 14 | ||||
-rw-r--r-- | tests/tfactorial.c | 27 | ||||
-rw-r--r-- | tests/tfma.c | 40 | ||||
-rw-r--r-- | tests/tfms.c | 42 | ||||
-rw-r--r-- | tests/tgeneric_ui.c | 11 | ||||
-rw-r--r-- | tests/tgmpop.c | 9 | ||||
-rw-r--r-- | tests/toutimpl.c | 2 | ||||
-rw-r--r-- | tests/tpow3.c | 22 | ||||
-rw-r--r-- | tests/trint.c | 7 | ||||
-rw-r--r-- | tests/tsec.c | 14 | ||||
-rw-r--r-- | tests/tsech.c | 14 | ||||
-rw-r--r-- | tests/tset_d.c | 9 | ||||
-rw-r--r-- | tests/tset_q.c | 20 | ||||
-rw-r--r-- | tests/tset_si.c | 6 | ||||
-rw-r--r-- | tests/tsin_cos.c | 19 | ||||
-rw-r--r-- | tests/tsqrt.c | 13 | ||||
-rw-r--r-- | tests/tsub.c | 4 | ||||
-rw-r--r-- | tests/tsub_ui.c | 4 | ||||
-rw-r--r-- | tests/ttan.c | 5 | ||||
-rw-r--r-- | tests/tui_pow.c | 11 | ||||
-rw-r--r-- | tests/tzeta.c | 2 |
29 files changed, 185 insertions, 206 deletions
diff --git a/tests/tabs.c b/tests/tabs.c index b07d9e19e..41f156457 100644 --- a/tests/tabs.c +++ b/tests/tabs.c @@ -145,10 +145,9 @@ check_cmp (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Mismatch for sign=%d and x=", sign); - mpfr_print_binary (x); - printf ("\nResults="); - mpfr_print_binary (y); - putchar ('\n'); + mpfr_dump (x); + printf ("Results="); + mpfr_dump (y); exit (1); } } diff --git a/tests/tcmp2.c b/tests/tcmp2.c index 1361e1393..f860a38ee 100644 --- a/tests/tcmp2.c +++ b/tests/tcmp2.c @@ -196,11 +196,9 @@ special (void) { printf ("Error in mpfr_cmp2:\n"); printf ("x="); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); printf ("y="); - mpfr_print_binary (y); - puts (""); + mpfr_dump (y); printf ("got %lu, expected 1\n", (unsigned long) j); exit (1); } diff --git a/tests/tconst_euler.c b/tests/tconst_euler.c index c2425eb8b..89267dac5 100644 --- a/tests/tconst_euler.c +++ b/tests/tconst_euler.c @@ -97,8 +97,7 @@ main (int argc, char *argv[]) mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); puts (""); printf (" approximation was "); - mpfr_print_binary (y); - puts (""); + mpfr_dump (y); exit (1); } } diff --git a/tests/tcos.c b/tests/tcos.c index 80cd41f48..3ba534689 100644 --- a/tests/tcos.c +++ b/tests/tcos.c @@ -202,10 +202,10 @@ overflowed_cos0 (void) if (! mpfr_equal_p (x, y)) { printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n" - " Got ", i, + " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of 0.11111111E%d.\n", emax); + mpfr_dump (x); + printf (" instead of 0.11111111E%d.\n", emax); err = 1; } } @@ -221,10 +221,10 @@ overflowed_cos0 (void) if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n" - " Got ", i, + " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of +Inf.\n"); + mpfr_dump (x); + printf (" instead of +Inf.\n"); err = 1; } } diff --git a/tests/tcoth.c b/tests/tcoth.c index dc10e662b..793903ff2 100644 --- a/tests/tcoth.c +++ b/tests/tcoth.c @@ -164,11 +164,11 @@ underflowed_cothinf (void) MPFR_MULT_SIGN (MPFR_SIGN (x), MPFR_SIGN (y)) > 0)) { printf ("Error in underflowed_cothinf (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of "); - mpfr_print_binary (y); - printf (".\n"); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of "); + mpfr_dump (y); err = 1; } if ((rnd == MPFR_RNDD || diff --git a/tests/tdiv.c b/tests/tdiv.c index 9b4988aac..fba3b9a82 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -163,10 +163,11 @@ check4 (const char *Ns, const char *Ds, mpfr_rnd_t rnd_mode, int p, { 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); + printf ("got "); + mpfr_dump (q); mpfr_set_str (q, Qs, ((p==53) ? 10 : 2), MPFR_RNDN); - printf("\nexpected "); mpfr_print_binary(q); - putchar('\n'); + printf ("expected "); + mpfr_dump (q); exit (1); } mpfr_clears (q, n, d, (mpfr_ptr) 0); @@ -292,14 +293,14 @@ check_64(void) test_div(z, x, y, MPFR_RNDU); if (mpfr_cmp_str (z, "0.1001001001101101010010100101011110000010111001001010100000000000E-529", 2, MPFR_RNDN)) { - printf("Error for tdiv for MPFR_RNDU and p=64\nx="); - mpfr_print_binary(x); - printf("\ny="); - mpfr_print_binary(y); - printf("\ngot "); - mpfr_print_binary(z); - printf("\nexpected 0.1001001001101101010010100101011110000010111001001010100000000000E-529\n"); - exit(1); + printf ("Error for tdiv for MPFR_RNDU and p=64\nx="); + mpfr_dump (x); + printf ("y="); + mpfr_dump (y); + printf ("got "); + mpfr_dump (z); + printf ("expected 0.1001001001101101010010100101011110000010111001001010100000000000E-529\n"); + exit (1); } mpfr_clears (x, y, z, (mpfr_ptr) 0); diff --git a/tests/texp.c b/tests/texp.c index 5bfc49d07..29db9794a 100644 --- a/tests/texp.c +++ b/tests/texp.c @@ -192,14 +192,11 @@ compare_exp2_exp3 (mpfr_prec_t p0, mpfr_prec_t p1) { printf ("mpfr_exp_2 and mpfr_exp_3 disagree for rnd=%s and\nx=", mpfr_print_rnd_mode (rnd)); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); printf ("mpfr_exp_2 gives "); - mpfr_print_binary (y); - puts (""); + mpfr_dump (y); printf ("mpfr_exp_3 gives "); - mpfr_print_binary (z); - puts (""); + mpfr_dump (z); exit (1); } } @@ -570,10 +567,10 @@ overflowed_exp0 (void) if (! mpfr_equal_p (x, y)) { printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n" - " Got ", i, + " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of 0.11111111E%d.\n", emax); + mpfr_dump (x); + printf (" instead of 0.11111111E%d.\n", emax); err = 1; } } @@ -589,10 +586,10 @@ overflowed_exp0 (void) if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n" - " Got ", i, + " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of +Inf.\n"); + mpfr_dump (x); + printf (" instead of +Inf.\n"); err = 1; } } diff --git a/tests/texp10.c b/tests/texp10.c index bb7ea121e..5b73c23c1 100644 --- a/tests/texp10.c +++ b/tests/texp10.c @@ -154,9 +154,10 @@ overfl_exp10_0 (void) if (! mpfr_equal_p (x, y)) { printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of 0.11111111E%d.\n", emax); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of 0.11111111E%d.\n", emax); err = 1; } } @@ -172,9 +173,10 @@ overfl_exp10_0 (void) if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of +Inf.\n"); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of +Inf.\n"); err = 1; } } diff --git a/tests/texp2.c b/tests/texp2.c index 3b24a9edf..2e81da246 100644 --- a/tests/texp2.c +++ b/tests/texp2.c @@ -179,9 +179,10 @@ overflowed_exp2_0 (void) if (! mpfr_equal_p (x, y)) { printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of 0.11111111E%d.\n", emax); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of 0.11111111E%d.\n", emax); err = 1; } } @@ -197,9 +198,10 @@ overflowed_exp2_0 (void) if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of +Inf.\n"); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of +Inf.\n"); err = 1; } } diff --git a/tests/tfactorial.c b/tests/tfactorial.c index 544ab2d73..694441139 100644 --- a/tests/tfactorial.c +++ b/tests/tfactorial.c @@ -155,9 +155,10 @@ overflowed_fac0 (void) if (! mpfr_equal_p (x, y)) { printf ("Error in overflowed_fac0 (rnd = %s):\n" - " Got ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of 0.11111111E0.\n"); + " Got ", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of 0.11111111E0.\n"); err = 1; } } @@ -173,9 +174,10 @@ overflowed_fac0 (void) if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_fac0 (rnd = %s):\n" - " Got ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of +Inf.\n"); + " Got ", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of +Inf.\n"); err = 1; } } @@ -268,15 +270,12 @@ main (int argc, char *argv[]) mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN); printf (" prec=%lu rnd_mode=%s\n", prec, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - printf (" got "); - mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); - puts (""); - printf (" expected "); - mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); - puts (""); + printf (" got "); + mpfr_dump (z); + printf (" expected "); + mpfr_dump (t); printf (" approximation was "); - mpfr_print_binary (y); - puts (""); + mpfr_dump (y); exit (1); } } diff --git a/tests/tfma.c b/tests/tfma.c index 68a4d718b..77f2c1b44 100644 --- a/tests/tfma.c +++ b/tests/tfma.c @@ -242,12 +242,11 @@ test_underflow1 (void) } if (! mpfr_equal_p (r, z)) { - printf (STRTU1 "got ", signy, signz, + printf (STRTU1 "got ", signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (r); - printf (" instead of "); - mpfr_print_binary (z); - printf ("\n"); + mpfr_dump (r); + printf (" instead of "); + mpfr_dump (z); err = 1; } if (inex >= 0 && (rnd == MPFR_RNDD || @@ -738,34 +737,31 @@ main (int argc, char *argv[]) inexact = mpfr_fma (s, x, y, z, rnd); if (! mpfr_equal_p (s, t)) { - printf ("results differ for x="); - mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN); + printf ("results differ for\n"); + printf (" x="); + mpfr_dump (x); printf (" y="); - mpfr_out_str (stdout, 2, prec, y, MPFR_RNDN); + mpfr_dump (y); printf (" z="); - mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); - printf (" prec=%u rnd_mode=%s\n", (unsigned int) prec, + mpfr_dump (z); + printf (" with prec=%u rnd_mode=%s\n", (unsigned int) prec, mpfr_print_rnd_mode (rnd)); printf ("got "); - mpfr_out_str (stdout, 2, prec, s, MPFR_RNDN); - puts (""); + mpfr_dump (s); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); - puts (""); - printf ("approx "); - mpfr_print_binary (slong); - puts (""); + mpfr_dump (t); + printf ("approx "); + mpfr_dump (slong); exit (1); } if (! SAME_SIGN (inexact, compare)) { printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n", mpfr_print_rnd_mode (rnd), compare, inexact); - printf (" x="); mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); - printf (" y="); mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); - printf (" z="); mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); - printf (" s="); mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN); - printf ("\n"); + printf (" x="); mpfr_dump (x); + printf (" y="); mpfr_dump (y); + printf (" z="); mpfr_dump (z); + printf (" s="); mpfr_dump (s); exit (1); } } diff --git a/tests/tfms.c b/tests/tfms.c index 66a8554b3..9cb06735b 100644 --- a/tests/tfms.c +++ b/tests/tfms.c @@ -245,12 +245,11 @@ test_underflow1 (void) } if (! mpfr_equal_p (r, z)) { - printf (STRTU1 "got ", signy, signz, + printf (STRTU1 "got ", signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (r); - printf (" instead of "); - mpfr_print_binary (z); - printf ("\n"); + mpfr_dump (r); + printf (" instead of "); + mpfr_dump (z); err = 1; } if (inex >= 0 && (rnd == MPFR_RNDD || @@ -589,23 +588,21 @@ main (int argc, char *argv[]) inexact = mpfr_fms (s, x, y, z, rnd); if (mpfr_cmp (s, t)) { - printf ("results differ for x="); - mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN); + printf ("results differ for\n"); + printf (" x="); + mpfr_dump (x); printf (" y="); - mpfr_out_str (stdout, 2, prec, y, MPFR_RNDN); + mpfr_dump (y); printf (" z="); - mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); - printf (" prec=%u rnd_mode=%s\n", (unsigned int) prec, - mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (z); + printf (" with prec=%u rnd_mode=%s\n", (unsigned int) prec, + mpfr_print_rnd_mode (rnd)); printf ("got "); - mpfr_out_str (stdout, 2, prec, s, MPFR_RNDN); - puts (""); + mpfr_dump (s); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); - puts (""); - printf ("approx "); - mpfr_print_binary (slong); - puts (""); + mpfr_dump (t); + printf ("approx "); + mpfr_dump (slong); exit (1); } if (((inexact == 0) && (compare != 0)) || @@ -615,11 +612,10 @@ main (int argc, char *argv[]) printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), compare, inexact); - printf (" x="); mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); - printf (" y="); mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); - printf (" z="); mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); - printf (" s="); mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN); - printf ("\n"); + printf (" x="); mpfr_dump (x); + printf (" y="); mpfr_dump (y); + printf (" z="); mpfr_dump (z); + printf (" s="); mpfr_dump (s); exit (1); } } diff --git a/tests/tgeneric_ui.c b/tests/tgeneric_ui.c index a57909fdd..ca3e19871 100644 --- a/tests/tgeneric_ui.c +++ b/tests/tgeneric_ui.c @@ -92,14 +92,11 @@ test_generic_ui (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N) printf ("Function: %s\n", TEST_FUNCTION_NAME); #endif printf ("got "); - mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); - puts (""); + mpfr_dump (z); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); - puts (""); - printf ("approx "); - mpfr_print_binary (y); - puts (""); + mpfr_dump (t); + printf ("approx "); + mpfr_dump (y); exit (1); } compare2 = mpfr_cmp (t, y); diff --git a/tests/tgmpop.c b/tests/tgmpop.c index 86c59bd9a..d7100201d 100644 --- a/tests/tgmpop.c +++ b/tests/tgmpop.c @@ -1199,11 +1199,12 @@ coverage_mpfr_mul_q_20110218 (void) mpfr_set_inf (cmp, -1); if ((status != 0) || (mpfr_cmp(res, cmp) != 0)) { - printf ("mpfr_mul_q 1 * (-1/0) returned a wrong value :\n waiting for "); - mpfr_print_binary (cmp); - printf (" got "); + printf ("mpfr_mul_q 1 * (-1/0) returned a wrong value:\n"); + printf (" expected "); + mpfr_dump (cmp); + printf (" got "); mpfr_dump (res); - printf ("ternary value is %d\n", status); + printf (" ternary value is %d\n", status); exit (1); } diff --git a/tests/toutimpl.c b/tests/toutimpl.c index d9888be72..ece4596df 100644 --- a/tests/toutimpl.c +++ b/tests/toutimpl.c @@ -1,5 +1,5 @@ /* Test file for internal debugging-out functions: - mpfr_dump, mpfr_print_binary, mpfr_print_rnd_mode. + mpfr_dump, mpfr_print_rnd_mode. Copyright 2004-2017 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. diff --git a/tests/tpow3.c b/tests/tpow3.c index 188136749..50f43897b 100644 --- a/tests/tpow3.c +++ b/tests/tpow3.c @@ -71,21 +71,19 @@ main (int argc, char *argv[]) inexact = mpfr_pow (z, x, s, rnd); if (mpfr_cmp (t, z)) { - printf ("results differ for x^y with x="); - mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN); - printf (" y="); - mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN); - printf (" prec=%u rnd_mode=%s\n", (unsigned int) prec, + printf ("results differ for x^y with\n"); + printf (" x="); + mpfr_dump (x); + printf (" y="); + mpfr_dump (s); + printf (" with prec=%u rnd_mode=%s\n", (unsigned int) prec, mpfr_print_rnd_mode (rnd)); printf ("got "); - mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); - puts (""); + mpfr_dump (z); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); - puts (""); - printf ("approx "); - mpfr_print_binary (y); - puts (""); + mpfr_dump (t); + printf ("approx "); + mpfr_dump (y); exit (1); } compare2 = mpfr_cmp (t, y); diff --git a/tests/trint.c b/tests/trint.c index af325c17c..d69892ab3 100644 --- a/tests/trint.c +++ b/tests/trint.c @@ -373,10 +373,9 @@ err (const char *str, mp_size_t s, mpfr_t x, mpfr_t y, mpfr_prec_t p, printf ("Error: %s\ns = %u, p = %u, r = %s, trint = %d, inexact = %d\nx = ", str, (unsigned int) s, (unsigned int) p, mpfr_print_rnd_mode (r), trint, inexact); - mpfr_print_binary (x); - printf ("\ny = "); - mpfr_print_binary (y); - printf ("\n"); + mpfr_dump (x); + printf ("y = "); + mpfr_dump (y); exit (1); } diff --git a/tests/tsec.c b/tests/tsec.c index e03468603..1f5012bb3 100644 --- a/tests/tsec.c +++ b/tests/tsec.c @@ -120,9 +120,10 @@ overflowed_sec0 (void) if (! mpfr_equal_p (x, y)) { printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of 0.11111111E%d.\n", emax); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of 0.11111111E%d.\n", emax); err = 1; } } @@ -138,9 +139,10 @@ overflowed_sec0 (void) if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of +Inf.\n"); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of +Inf.\n"); err = 1; } } diff --git a/tests/tsech.c b/tests/tsech.c index 0917a70ea..ec971da85 100644 --- a/tests/tsech.c +++ b/tests/tsech.c @@ -139,9 +139,10 @@ overflowed_sech0 (void) if (! mpfr_equal_p (x, y)) { printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of 0.11111111E%d.\n", emax); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of 0.11111111E%d.\n", emax); err = 1; } } @@ -157,9 +158,10 @@ overflowed_sech0 (void) if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of +Inf.\n"); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of +Inf.\n"); err = 1; } } diff --git a/tests/tset_d.c b/tests/tset_d.c index 3da550788..7e9f6199d 100644 --- a/tests/tset_d.c +++ b/tests/tset_d.c @@ -133,8 +133,7 @@ main (int argc, char *argv[]) printf ("got "); mpfr_out_str (stdout, 10, 10, x, MPFR_RNDN); printf ("\n"); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); exit (1); } } @@ -188,8 +187,7 @@ main (int argc, char *argv[]) mpfr_set_d (x, d, (mpfr_rnd_t) 0); if (d != mpfr_get_d1 (x)) { - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); printf ("Error: get_d o set_d <> identity for d = %1.20e %1.20e\n", d, mpfr_get_d1 (x)); exit (1); @@ -212,8 +210,7 @@ main (int argc, char *argv[]) if (d != dd && !(Isnan(d) && Isnan(dd))) { printf ("Mismatch on : %1.18g != %1.18g\n", d, mpfr_get_d1 (x)); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); exit (1); } } diff --git a/tests/tset_q.c b/tests/tset_q.c index cb2d67320..04de0b0da 100644 --- a/tests/tset_q.c +++ b/tests/tset_q.c @@ -130,11 +130,11 @@ check_nan_inf_mpq (void) mpfr_init2 (mpfr_cmp, MPFR_PREC_MIN); mpfr_set_nan (mpfr_cmp); printf ("mpfr_set_q with a NAN mpq value returned a wrong value :\n" - " waiting for "); - mpfr_print_binary (mpfr_cmp); - printf (" got "); - mpfr_print_binary (mpfr_value); - printf ("\n ternary value is %d\n", status); + " expected "); + mpfr_dump (mpfr_cmp); + printf (" got "); + mpfr_dump (mpfr_value); + printf (" ternary value is %d\n", status); exit (1); } @@ -149,11 +149,11 @@ check_nan_inf_mpq (void) mpfr_init2 (mpfr_cmp, MPFR_PREC_MIN); mpfr_set_inf (mpfr_cmp, -1); printf ("mpfr_set_q with a -INF mpq value returned a wrong value :\n" - " waiting for "); - mpfr_print_binary (mpfr_cmp); - printf (" got "); - mpfr_print_binary (mpfr_value); - printf ("\n ternary value is %d\n", status); + " expected "); + mpfr_dump (mpfr_cmp); + printf (" got "); + mpfr_dump (mpfr_value); + printf (" ternary value is %d\n", status); exit (1); } diff --git a/tests/tset_si.c b/tests/tset_si.c index 7bd66a70e..829b4d952 100644 --- a/tests/tset_si.c +++ b/tests/tset_si.c @@ -360,16 +360,14 @@ main (int argc, char *argv[]) if (MPFR_MANT(x)[0] != MPFR_LIMB_HIGHBIT || inex >= 0) { printf ("Error in mpfr_set_si(x:3, 77617, MPFR_RNDD)\n"); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); exit (1); } inex = mpfr_set_ui (x, 77617, MPFR_RNDD); /* should be 65536 */ if (MPFR_MANT(x)[0] != MPFR_LIMB_HIGHBIT || inex >= 0) { printf ("Error in mpfr_set_ui(x:3, 77617, MPFR_RNDD)\n"); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); exit (1); } diff --git a/tests/tsin_cos.c b/tests/tsin_cos.c index 3822934af..88886894f 100644 --- a/tests/tsin_cos.c +++ b/tests/tsin_cos.c @@ -197,9 +197,10 @@ overflowed_sin_cos0 (void) if (! (mpfr_zero_p (x) && MPFR_IS_NEG (x))) { printf ("Error in overflowed_sin_cos0 (rnd = %s):\n" - " Got sin = ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of -0.\n"); + " Got sin = ", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of -0.\n"); err = 1; } if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) @@ -214,10 +215,10 @@ overflowed_sin_cos0 (void) if (! mpfr_equal_p (y, z)) { printf ("Error in overflowed_sin_cos0 (rnd = %s):\n" - " Got cos = ", + " Got cos = ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (y); - printf (" instead of 0.11111111E%d.\n", emax); + mpfr_dump (y); + printf (" instead of 0.11111111E%d.\n", emax); err = 1; } } @@ -233,10 +234,10 @@ overflowed_sin_cos0 (void) if (! (mpfr_inf_p (y) && MPFR_IS_POS (y))) { printf ("Error in overflowed_sin_cos0 (rnd = %s):\n" - " Got cos = ", + " Got cos = ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (y); - printf (" instead of +Inf.\n"); + mpfr_dump (y); + printf (" instead of +Inf.\n"); err = 1; } } diff --git a/tests/tsqrt.c b/tests/tsqrt.c index 87c178208..c875ce4ba 100644 --- a/tests/tsqrt.c +++ b/tests/tsqrt.c @@ -276,8 +276,7 @@ special (void) if (mpfr_cmp_ui (z, 0) < 0) { printf ("Error: square root of 1 gives "); - mpfr_print_binary(z); - putchar('\n'); + mpfr_dump (z); exit (1); } @@ -441,12 +440,12 @@ check_inexact (mpfr_prec_t p) ((inexact > 0) && (sign <= 0)) || ((inexact < 0) && (sign >= 0))) { - printf ("Error: wrong inexact flag, expected %d, got %d\n", - sign, inexact); + printf ("Error with rnd=%s: wrong ternary value, expected %d, got %d\n", + mpfr_print_rnd_mode (rnd), sign, inexact); printf ("x="); - mpfr_print_binary (x); - printf (" rnd=%s\n", mpfr_print_rnd_mode (rnd)); - printf ("y="); mpfr_dump (y); + mpfr_dump (x); + printf ("y="); + mpfr_dump (y); exit (1); } mpfr_clear (x); diff --git a/tests/tsub.c b/tests/tsub.c index 34779d6ba..d42ca1a74 100644 --- a/tests/tsub.c +++ b/tests/tsub.c @@ -535,8 +535,8 @@ bug20101017 (void) { printf ("Error in mpfr_sub for b-c for b=2^64+1+2^(-64), c=1\n"); printf ("Expected result 2^64 with inex < 0\n"); - printf ("Got "); mpfr_print_binary (a); - printf (" with inex=%d\n", inex); + printf ("Got "); mpfr_dump (a); + printf ("with inex=%d\n", inex); exit (1); } diff --git a/tests/tsub_ui.c b/tests/tsub_ui.c index a32606d21..9330da4b5 100644 --- a/tests/tsub_ui.c +++ b/tests/tsub_ui.c @@ -36,8 +36,8 @@ check3 (const char *xs, unsigned long y, mpfr_rnd_t rnd_mode, const char *zs) if (mpfr_cmp_str1(zz, zs)) { printf ("expected sum is %s, got ", zs); - mpfr_print_binary(zz); - printf ("\nmpfr_sub_ui failed for x=%s y=%lu with rnd_mode=%s\n", + mpfr_dump (zz); + printf ("mpfr_sub_ui failed for x=%s y=%lu with rnd_mode=%s\n", xs, y, mpfr_print_rnd_mode (rnd_mode)); exit (1); } diff --git a/tests/ttan.c b/tests/ttan.c index 73a1b532a..557168231 100644 --- a/tests/ttan.c +++ b/tests/ttan.c @@ -112,9 +112,8 @@ main (int argc, char *argv[]) if (mpfr_cmp_ui_2exp(x, 1, -1)) { printf ("mpfr_tan(0.5, MPFR_RNDD) failed\n" - "expected 0.5, got"); - mpfr_print_binary(x); - putchar('\n'); + "expected 0.5, got "); + mpfr_dump (x); exit (1); } diff --git a/tests/tui_pow.c b/tests/tui_pow.c index 8cc965c85..33c209e69 100644 --- a/tests/tui_pow.c +++ b/tests/tui_pow.c @@ -110,14 +110,11 @@ check1 (mpfr_ptr x, mpfr_prec_t prec, unsigned long nt, mpfr_rnd_t rnd) printf (" prec=%u rnd_mode=%s\n", (unsigned) prec, mpfr_print_rnd_mode (rnd)); printf ("got "); - mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); - puts (""); + mpfr_dump (z); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); - puts (""); - printf ("approx "); - mpfr_print_binary (y); - puts (""); + mpfr_dump (t); + printf ("approx "); + mpfr_dump (y); exit (1); } compare2 = mpfr_cmp (t, y); diff --git a/tests/tzeta.c b/tests/tzeta.c index d670c0a3b..d17a07b7f 100644 --- a/tests/tzeta.c +++ b/tests/tzeta.c @@ -168,7 +168,7 @@ test2 (void) if (mpfr_cmp_str (y, val[i+1] , 2, MPFR_RNDZ)) { printf("Wrong result for zeta(%s=", val[i]); - mpfr_print_binary (x); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf (").\nGot : "); mpfr_dump (y); printf("Expected: "); |