diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2016-04-07 13:59:37 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2016-04-07 13:59:37 +0000 |
commit | 01468b489e2ad35217f4a4eab6b9f160c5d8049c (patch) | |
tree | b90258a76462738d19df6f54665ec79192e5ad76 | |
parent | aab6696198475b5b6575a01aab71eec62c00cf4c (diff) | |
download | mpfr-01468b489e2ad35217f4a4eab6b9f160c5d8049c.tar.gz |
Replaced various instances of mpfr_print_binary + newline (sometimes
missing) by mpfr_dump.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10252 280ebfd0-de03-0410-8827-d642c229c3f4
39 files changed, 321 insertions, 385 deletions
diff --git a/src/sub1.c b/src/sub1.c index 7c7624fad..3d1570ef7 100644 --- a/src/sub1.c +++ b/src/sub1.c @@ -280,7 +280,7 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) MPN_ZERO (ap, an); #ifdef DEBUG - printf("after copying high(b), a="); mpfr_print_binary(a); putchar('\n'); + printf("after copying high(b), a="); mpfr_dump (a); #endif /* subtract high(c) */ @@ -659,7 +659,7 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) } MPFR_TMP_FREE(marker); #ifdef DEBUG - printf ("result is a="); mpfr_print_binary(a); putchar('\n'); + printf ("result is a="); mpfr_dump (a); #endif /* check that result is msb-normalized */ MPFR_ASSERTD(ap[an-1] > ~ap[an-1]); diff --git a/tests/reuse.c b/tests/reuse.c index 6b34c4ec5..bfb75056c 100644 --- a/tests/reuse.c +++ b/tests/reuse.c @@ -120,8 +120,8 @@ test3 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t), { printf ("Error for %s(a, a, c) for ", foo); DISP("a=",ref2); DISP2(", c=",ref3); - printf ("expected "); mpfr_print_binary (ref1); puts (""); - printf ("got "); mpfr_print_binary (res1); puts (""); + printf ("expected "); mpfr_dump (ref1); + printf ("got "); mpfr_dump (res1); exit (1); } @@ -320,8 +320,8 @@ test2ui (int (*testfunc)(mpfr_ptr, mpfr_srcptr, unsigned long int, mpfr_rnd_t), { printf ("Error for %s(a, a, c) for c=%u\n", foo, ref3); DISP2("a=",ref2); - printf ("expected "); mpfr_print_binary (ref1); puts (""); - printf ("got "); mpfr_print_binary (res1); puts (""); + printf ("expected "); mpfr_dump (ref1); + printf ("got "); mpfr_dump (res1); exit (1); } } @@ -556,8 +556,8 @@ pow_int (mpfr_rnd_t rnd) { printf ("Error for pow_int(a, a, c) for "); DISP("a=",ref2); DISP2(", c=",ref3); - printf ("expected "); mpfr_print_binary (ref1); puts (""); - printf ("got "); mpfr_print_binary (res1); puts (""); + printf ("expected "); mpfr_dump (ref1); + printf ("got "); mpfr_dump (res1); exit (1); } } diff --git a/tests/tabs.c b/tests/tabs.c index 56f9329fa..9f5f5744c 100644 --- a/tests/tabs.c +++ b/tests/tabs.c @@ -61,9 +61,9 @@ check_inexact (void) { printf ("Wrong inexact flag: expected %d, got %d\n", cmp, inexact); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("absx="); mpfr_print_binary (absx); puts (""); - printf ("y="); mpfr_print_binary (y); puts (""); + printf ("x="); mpfr_dump (x); + printf ("absx="); mpfr_dump (absx); + printf ("y="); mpfr_dump (y); exit (1); } } diff --git a/tests/tacos.c b/tests/tacos.c index 0a8b9353d..6591eaed7 100644 --- a/tests/tacos.c +++ b/tests/tacos.c @@ -49,7 +49,7 @@ special (void) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_acos (2)\n"); - mpfr_print_binary (y); printf ("\n"); + mpfr_dump (y); exit (1); } diff --git a/tests/tadd.c b/tests/tadd.c index f27e1fac3..422b21cd9 100644 --- a/tests/tadd.c +++ b/tests/tadd.c @@ -107,9 +107,9 @@ check2b (const char *xs, int px, { printf ("(2) x=%s,%d y=%s,%d pz=%d,rnd=%s\n", xs, px, ys, py, pz, mpfr_print_rnd_mode (rnd_mode)); - printf ("got "); mpfr_print_binary(zz); puts (""); + printf ("got "); mpfr_dump (zz); mpfr_set_str(zz, rs, 2, MPFR_RNDN); - printf ("instead of "); mpfr_print_binary(zz); puts (""); + printf ("instead of "); mpfr_dump (zz); exit (1); } mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz); @@ -150,7 +150,7 @@ check64 (void) if (MPFR_MANT(u)[0] << 2) { printf ("result not normalized for prec=2\n"); - mpfr_print_binary (u); puts (""); + mpfr_dump (u); exit (1); } mpfr_set_str_binary (t, "-1.0e-1"); @@ -205,7 +205,7 @@ check64 (void) mpfr_set_str_binary(t, "0.1011000101110010000101111111011100111111101010011011110110101011101000000100"); if (mpfr_cmp(u,t)) { - printf ("expect "); mpfr_print_binary(t); puts (""); + printf ("expect "); mpfr_dump (t); printf ("mpfr_add failed for precisions 53-76\n"); exit (1); } @@ -216,7 +216,7 @@ check64 (void) mpfr_set_str_binary(t, "0.101100010111001000010111111101110011111110101001101111011010101110100000001011000010101110011000000000111111"); if (mpfr_cmp(u,t)) { - printf ("expect "); mpfr_print_binary(t); puts (""); + printf ("expect "); mpfr_dump (t); printf ("mpfr_add failed for precisions 53-108\n"); exit (1); } @@ -270,9 +270,9 @@ check64 (void) if ((MPFR_MANT(u)[0] & 1) != 1) { printf ("error in mpfr_add with rnd_mode=MPFR_RNDU\n"); - printf ("b= "); mpfr_print_binary(x); puts (""); - printf ("c= "); mpfr_print_binary(t); puts (""); - printf ("b+c="); mpfr_print_binary(u); puts (""); + printf ("b= "); mpfr_dump (x); + printf ("c= "); mpfr_dump (t); + printf ("b+c="); mpfr_dump (u); exit (1); } @@ -390,9 +390,9 @@ check_case_1b (void) { printf ("case (1b) failed for prec_a=%u, prec_b=%u," " prec_c=%u\n", prec_a, prec_b, prec_c); - printf ("b="); mpfr_print_binary(b); puts (""); - printf ("c="); mpfr_print_binary(c); puts (""); - printf ("a="); mpfr_print_binary(a); puts (""); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); exit (1); } } @@ -521,9 +521,9 @@ check_inexact (void) if (test_add (z, x, u, rnd)) { printf ("z <- x + u should be exact\n"); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("u="); mpfr_print_binary (u); puts (""); - printf ("z="); mpfr_print_binary (z); puts (""); + printf ("x="); mpfr_dump (x); + printf ("u="); mpfr_dump (u); + printf ("z="); mpfr_dump (z); exit (1); } { @@ -537,10 +537,10 @@ check_inexact (void) printf ("Wrong inexact flag for rnd=%s\n", mpfr_print_rnd_mode(rnd)); printf ("expected %d, got %d\n", cmp, inexact); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("u="); mpfr_print_binary (u); puts (""); - printf ("y= "); mpfr_print_binary (y); puts (""); - printf ("x+u="); mpfr_print_binary (z); puts (""); + printf ("x="); mpfr_dump (x); + printf ("u="); mpfr_dump (u); + printf ("y= "); mpfr_dump (y); + printf ("x+u="); mpfr_dump (z); exit (1); } } @@ -727,8 +727,8 @@ check_1111 (void) (int) tb, (int) tc, (int) diff, mpfr_print_rnd_mode (rnd_mode)); printf ("sb = %d, sc = %d\n", sb, sc); - printf ("a = "); mpfr_print_binary (a); puts (""); - printf ("s = "); mpfr_print_binary (s); puts (""); + printf ("a = "); mpfr_dump (a); + printf ("s = "); mpfr_dump (s); printf ("inex_a = %d, inex_s = %d\n", inex_a, inex_s); exit (1); } diff --git a/tests/tadd1sp.c b/tests/tadd1sp.c index 93e8a7664..479e2b179 100644 --- a/tests/tadd1sp.c +++ b/tests/tadd1sp.c @@ -75,11 +75,10 @@ main (void) { \ printf("ERROR: for %s and p=%lu and i=%d:\nB=", \ mpfr_print_rnd_mode ((mpfr_rnd_t) r), (unsigned long) p, i); \ - mpfr_print_binary(b); \ - printf("\nC="); mpfr_print_binary(c); \ - printf("\nadd1 : "); mpfr_print_binary(a1); \ - printf("\nadd1sp: "); mpfr_print_binary(a2); \ - putchar('\n'); \ + mpfr_dump (b); \ + printf ("C="); mpfr_dump (c); \ + printf ("add1 : "); mpfr_dump (a1); \ + printf ("add1sp: "); mpfr_dump (a2); \ exit(1); \ } \ while (0) @@ -89,11 +88,10 @@ main (void) { \ printf("ERROR: Wrong inexact flag for %s and p=%lu and i=%d:\nB=", \ mpfr_print_rnd_mode ((mpfr_rnd_t) r), (unsigned long) p, i); \ - mpfr_print_binary(b); \ - printf("\nC="); mpfr_print_binary(c); \ - printf("\nA="); mpfr_print_binary(a1); \ - printf("\nAdd1: %d. Add1sp: %d\n", \ - inexact1, inexact2); \ + mpfr_dump (b); \ + printf ("C="); mpfr_dump (c); \ + printf ("A="); mpfr_dump (a1); \ + printf ("Add1: %d. Add1sp: %d\n", inexact1, inexact2); \ exit(1); \ } \ while (0) diff --git a/tests/tasin.c b/tests/tasin.c index 5214002a5..4ff44a5ca 100644 --- a/tests/tasin.c +++ b/tests/tasin.c @@ -141,8 +141,8 @@ special (void) if (mpfr_cmp (x, y)) { printf ("Error: mpfr_asin (2)\n"); - mpfr_print_binary (x); printf ("\n"); - mpfr_print_binary (y); printf ("\n"); + mpfr_dump (x); + mpfr_dump (y); exit (1); } diff --git a/tests/tatan.c b/tests/tatan.c index 839916689..dad14e1ca 100644 --- a/tests/tatan.c +++ b/tests/tatan.c @@ -139,8 +139,8 @@ special (void) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_atan (2)\n"); - mpfr_print_binary (x); printf ("\n"); - mpfr_print_binary (y); printf ("\n"); + mpfr_dump (x); + mpfr_dump (y); exit (1); } @@ -153,8 +153,8 @@ special (void) if (mpfr_cmp (z, y)) { printf ("Error in mpfr_atan (3)\n"); - printf ("Expected "); mpfr_print_binary (y); printf ("\n"); - printf ("Got "); mpfr_print_binary (z); printf ("\n"); + printf ("Expected "); mpfr_dump (y); + printf ("Got "); mpfr_dump (z); exit (1); } @@ -557,8 +557,8 @@ atan2_pow_of_2 (void) if (mpfr_equal_p (r, g) == 0) { printf ("Error in mpfr_atan2 (5)\n"); - printf ("Expected "); mpfr_print_binary (g); printf ("\n"); - printf ("Got "); mpfr_print_binary (r); printf ("\n"); + printf ("Expected "); mpfr_dump (g); + printf ("Got "); mpfr_dump (r); exit (1); } } diff --git a/tests/tatanh.c b/tests/tatanh.c index 15da7a061..ee8fe2bc4 100644 --- a/tests/tatanh.c +++ b/tests/tatanh.c @@ -101,7 +101,7 @@ special (void) if (!mpfr_nan_p (y)) { printf ("Error: mpfr_atanh(+Inf) <> NaN\n"); - mpfr_print_binary (y); printf ("\n"); + mpfr_dump (y); exit (1); } @@ -159,7 +159,7 @@ special (void) if (mpfr_cmp (y, z)) { printf ("Error: mpfr_atanh (3)\n"); - mpfr_print_binary (y); printf ("\n"); + mpfr_dump (y); exit (1); } diff --git a/tests/taway.c b/tests/taway.c index e5d14e48c..ce1fd135f 100644 --- a/tests/taway.c +++ b/tests/taway.c @@ -119,8 +119,8 @@ test3 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t), printf ("Error with RNDA for %s with ", foo); DISP("x=",ref2); DISP2(", y=",ref3); printf ("inexa=%d inexd=%d\n", inexa, inexd); - printf ("expected "); mpfr_print_binary (ref1); puts (""); - printf ("got "); mpfr_print_binary (res1); puts (""); + printf ("expected "); mpfr_dump (ref1); + printf ("got "); mpfr_dump (res1); exit (1); } } @@ -222,8 +222,8 @@ test2ui (int (*testfunc)(mpfr_ptr, mpfr_srcptr, unsigned long int, mpfr_rnd_t), printf ("Error with RNDA for %s for c=%u\n", foo, ref3); DISP2("a=",ref2); printf ("inexa=%d inexd=%d\n", inexa, inexd); - printf ("expected "); mpfr_print_binary (ref1); puts (""); - printf ("got "); mpfr_print_binary (res1); puts (""); + printf ("expected "); mpfr_dump (ref1); + printf ("got "); mpfr_dump (res1); exit (1); } } diff --git a/tests/tcmp2.c b/tests/tcmp2.c index 45236bf5e..d1930f7bb 100644 --- a/tests/tcmp2.c +++ b/tests/tcmp2.c @@ -212,8 +212,8 @@ special (void) if (mpfr_cmp2(x, y, &j) <= 0 || j != 32) { printf ("Error in mpfr_cmp2:\n"); - printf ("x="); mpfr_print_binary(x); puts (""); - printf ("y="); mpfr_print_binary(y); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); printf ("got %lu, expected 32\n", (unsigned long) j); exit (1); } @@ -225,8 +225,8 @@ special (void) if (mpfr_cmp2(x, y, &j) <= 0 || j != 164) { printf ("Error in mpfr_cmp2:\n"); - printf ("x="); mpfr_print_binary(x); puts (""); - printf ("y="); mpfr_print_binary(y); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); printf ("got %lu, expected 164\n", (unsigned long) j); exit (1); } @@ -239,8 +239,8 @@ special (void) if (mpfr_cmp2(x, y, &j) <= 0 || j != 127) { printf ("Error in mpfr_cmp2:\n"); - printf ("x="); mpfr_print_binary(x); puts (""); - printf ("y="); mpfr_print_binary(y); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); printf ("got %lu, expected 127\n", (unsigned long) j); exit (1); } @@ -253,8 +253,8 @@ special (void) if (mpfr_cmp2(x, y, &j) <= 0 || j != 63) { printf ("Error in mpfr_cmp2:\n"); - printf ("x="); mpfr_print_binary(x); puts (""); - printf ("y="); mpfr_print_binary(y); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); printf ("got %lu, expected 63\n", (unsigned long) j); exit (1); } @@ -267,8 +267,8 @@ special (void) if (mpfr_cmp2(x, y, &j) <= 0 || j != 63) { printf ("Error in mpfr_cmp2:\n"); - printf ("x="); mpfr_print_binary(x); puts (""); - printf ("y="); mpfr_print_binary(y); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); printf ("got %lu, expected 63\n", (unsigned long) j); exit (1); } diff --git a/tests/tcos.c b/tests/tcos.c index c40dd5783..8fd5d127a 100644 --- a/tests/tcos.c +++ b/tests/tcos.c @@ -276,8 +276,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (y, x)) { printf ("Error for prec=30, rnd=MPFR_RNDU\n"); - printf ("expected "); mpfr_print_binary (x); puts (""); - printf (" got "); mpfr_print_binary (y); puts (""); + printf ("expected "); mpfr_dump (x); + printf (" got "); mpfr_dump (y); exit (1); } @@ -289,8 +289,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (y, x)) { printf ("Error for prec=59, rnd=MPFR_RNDU\n"); - printf ("expected "); mpfr_print_binary (x); puts (""); - printf (" got "); mpfr_print_binary (y); puts (""); + printf ("expected "); mpfr_dump (x); + printf (" got "); mpfr_dump (y); exit (1); } @@ -302,7 +302,7 @@ main (int argc, char *argv[]) if (mpfr_cmp (y, x)) { printf ("Error for x=1.1100e-2, rnd=MPFR_RNDD\n"); - printf ("expected 1.1100e-1, got "); mpfr_print_binary (y); puts (""); + printf ("expected 1.1100e-1, got "); mpfr_dump (y); exit (1); } diff --git a/tests/tdiv.c b/tests/tdiv.c index c55e501f2..772ce745a 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -322,8 +322,8 @@ check_convergence (void) if (mpfr_cmp (x, y)) { 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 (""); + printf ("got "); mpfr_dump (x); + printf ("instead of "); mpfr_dump (y); exit(1); } @@ -340,7 +340,7 @@ check_convergence (void) { printf ("mpfr_div failed for x=1.0, y=1.0, prec=%d rnd=%s\n", i, mpfr_print_rnd_mode ((mpfr_rnd_t) j)); - printf ("got "); mpfr_print_binary(y); puts (""); + printf ("got "); mpfr_dump (y); exit (1); } } @@ -472,8 +472,8 @@ check_lowr (void) if (c || mpfr_cmp (z2, z)) { 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 ("got "); mpfr_dump (z2); + printf ("instead of "); mpfr_dump (z); printf ("inex flag = %d, expected 0\n", c); exit (1); } @@ -498,8 +498,8 @@ check_lowr (void) if ((mpfr_cmp (z2, z) == 0 && c) || inex_cmp (c, c2)) { 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 ("got "); mpfr_dump (z2); + printf ("instead of "); mpfr_dump (z); printf ("inex flag = %d, expected %d\n", c, c2); exit (1); } @@ -510,8 +510,8 @@ check_lowr (void) { 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 (""); + printf ("got "); mpfr_dump (z2); + printf ("instead of "); mpfr_dump (z); printf ("inex flag = %d\n", 1); exit (1); } @@ -523,8 +523,8 @@ check_lowr (void) { 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 (""); + printf ("got "); mpfr_dump (z2); + printf ("instead of "); mpfr_dump (z); printf ("inex flag = %d\n", 1); exit (1); } @@ -561,8 +561,8 @@ check_lowr (void) if (c != -1 || mpfr_cmp(z2, z)) { 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 ("got "); mpfr_dump (z2); + printf ("instead of "); mpfr_dump (z); printf ("inex flag = %d\n", c); exit (1); } @@ -576,8 +576,8 @@ check_lowr (void) 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 (""); - printf ("instead of "); mpfr_print_binary (z); puts (""); + printf ("got "); mpfr_dump (z2); + printf ("instead of "); mpfr_dump (z); printf ("inex flag = %d\n", c); exit (1); } @@ -691,10 +691,10 @@ check_inexact (void) printf ("Wrong inexact flag for rnd=%s\n", mpfr_print_rnd_mode(rnd)); printf ("expected %d, got %d\n", cmp, inexact); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("u="); mpfr_print_binary (u); puts (""); - printf ("y="); mpfr_print_binary (y); puts (""); - printf ("y*u="); mpfr_print_binary (z); puts (""); + printf ("x="); mpfr_dump (x); + printf ("u="); mpfr_dump (u); + printf ("y="); mpfr_dump (y); + printf ("y*u="); mpfr_dump (z); exit (1); } } diff --git a/tests/tdiv_ui.c b/tests/tdiv_ui.c index e270149bb..faefe7d04 100644 --- a/tests/tdiv_ui.c +++ b/tests/tdiv_ui.c @@ -127,8 +127,8 @@ special (void) if (mpfr_cmp(x,y)) { printf ("division by 1.0 fails for xprec=%u, yprec=%u\n", xprec, yprec); - printf ("expected "); mpfr_print_binary (x); puts (""); - printf ("got "); mpfr_print_binary (y); puts (""); + printf ("expected "); mpfr_dump (x); + printf ("got "); mpfr_dump (y); exit (1); } } @@ -178,8 +178,8 @@ check_inexact (void) if (mpfr_mul_ui (z, y, u, (mpfr_rnd_t) rnd)) { printf ("z <- y * u should be exact for u=%lu\n", u); - printf ("y="); mpfr_print_binary (y); puts (""); - printf ("z="); mpfr_print_binary (z); puts (""); + printf ("y="); mpfr_dump (y); + printf ("z="); mpfr_dump (z); exit (1); } cmp = mpfr_cmp (z, x); @@ -189,8 +189,8 @@ check_inexact (void) { printf ("Wrong inexact flag for u=%lu, rnd=%s\n", u, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("y="); mpfr_print_binary (y); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); exit (1); } } diff --git a/tests/teq.c b/tests/teq.c index 18a9d4add..a1441cbc9 100644 --- a/tests/teq.c +++ b/tests/teq.c @@ -42,8 +42,8 @@ teq (mpfr_t x) if (mpfr_eq(y, x, k) || !mpfr_eq(y, x, k - 1)) { printf ("Error in eq.\n"); - printf ("x = "); mpfr_print_binary (x); printf ("\n"); - printf ("y = "); mpfr_print_binary (y); printf ("\n"); + printf ("x = "); mpfr_dump (x); + printf ("y = "); mpfr_dump (y); printf ("k = %lu\n", k); printf ("mpfr_eq(y, x, k) = %d\nmpfr_eq(y, x, k - 1) = %d\n", mpfr_eq (y, x, k), mpfr_eq (y, x, k - 1)); diff --git a/tests/terf.c b/tests/terf.c index c71e06a6b..88d63c640 100644 --- a/tests/terf.c +++ b/tests/terf.c @@ -233,7 +233,7 @@ special_erf (void) if (mpfr_cmp (x, y)) { printf ("Error: erf for prec=32 (2)\n"); - mpfr_print_binary (x); printf ("\n"); + mpfr_dump (x); exit (1); } diff --git a/tests/texceptions.c b/tests/texceptions.c index dba93f796..dbd877885 100644 --- a/tests/texceptions.c +++ b/tests/texceptions.c @@ -464,7 +464,7 @@ main (int argc, char *argv[]) { printf ("Error: x+x rounded to nearest for x=2^1023 should give +Inf\n"); printf ("emax = %ld\n", (long) mpfr_get_emax ()); - printf ("got "); mpfr_print_binary (x); puts (""); + printf ("got "); mpfr_dump (x); exit (1); } @@ -486,7 +486,7 @@ main (int argc, char *argv[]) { printf ("Error: y-x rounded to zero should give 0" " for y=3/2*2^(-1022), x=2^(-1022)\n"); - printf ("y="); mpfr_print_binary (y); puts (""); + printf ("y="); mpfr_dump (y); exit (1); } diff --git a/tests/texp.c b/tests/texp.c index de0d4f55c..0e85589b4 100644 --- a/tests/texp.c +++ b/tests/texp.c @@ -366,7 +366,7 @@ check_special (void) { printf ("Error for exp(-9) for emin=-10\n"); printf ("Expected +0\n"); - printf ("Got "); mpfr_print_binary (y); puts (""); + printf ("Got "); mpfr_dump (y); exit (1); } set_emin (emin); diff --git a/tests/texp10.c b/tests/texp10.c index d2373d8b3..a1d255419 100644 --- a/tests/texp10.c +++ b/tests/texp10.c @@ -235,7 +235,7 @@ main (int argc, char *argv[]) { printf ("Error for emin = -11, x = -4, RNDN\n"); printf ("Expected +0\n"); - printf ("Got "); mpfr_print_binary (y); puts (""); + printf ("Got "); mpfr_dump (y); exit (1); } /* restore emin */ @@ -250,7 +250,7 @@ main (int argc, char *argv[]) { printf ("Error for emax = 13, x = 4, RNDN\n"); printf ("Expected +inf\n"); - printf ("Got "); mpfr_print_binary (y); puts (""); + printf ("Got "); mpfr_dump (y); exit (1); } /* restore emax */ diff --git a/tests/texp2.c b/tests/texp2.c index 4ac67659a..cf9b8e8e8 100644 --- a/tests/texp2.c +++ b/tests/texp2.c @@ -290,7 +290,7 @@ main (int argc, char *argv[]) { printf ("Error for x=emin-2, RNDN\n"); printf ("Expected +0\n"); - printf ("Got "); mpfr_print_binary (y); puts (""); + printf ("Got "); mpfr_dump (y); exit (1); } /* restore emin */ diff --git a/tests/tfactorial.c b/tests/tfactorial.c index 4886fa71f..285f37e14 100644 --- a/tests/tfactorial.c +++ b/tests/tfactorial.c @@ -247,7 +247,7 @@ main (int argc, char *argv[]) { printf ("Wrong inexact flag: expected inexact\n"); printf ("n=%u prec=%u\n", n, prec); - mpfr_print_binary(z); puts (""); + mpfr_dump (z); exit (1); } } diff --git a/tests/tgamma.c b/tests/tgamma.c index be9cccd14..2b4555964 100644 --- a/tests/tgamma.c +++ b/tests/tgamma.c @@ -108,9 +108,9 @@ special (void) { printf ("mpfr_lngamma("CHECK_X1") is wrong:\n" "expected "); - mpfr_print_binary (x); putchar ('\n'); + mpfr_dump (x); printf ("got "); - mpfr_print_binary (y); putchar ('\n'); + mpfr_dump (y); exit (1); } @@ -123,9 +123,9 @@ special (void) { printf ("mpfr_lngamma("CHECK_X2") is wrong:\n" "expected "); - mpfr_print_binary (x); putchar ('\n'); + mpfr_dump (x); printf ("got "); - mpfr_print_binary (y); putchar ('\n'); + mpfr_dump (y); exit (1); } @@ -150,8 +150,8 @@ special (void) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_gamma (120)\n"); - printf ("Expected "); mpfr_print_binary (y); puts (""); - printf ("Got "); mpfr_print_binary (x); puts (""); + printf ("Expected "); mpfr_dump (y); + printf ("Got "); mpfr_dump (x); exit (1); } @@ -546,9 +546,9 @@ test20120426 (void) { printf ("Error in test20120426, i=%d\n", i); printf ("expected "); - mpfr_print_binary (xb); putchar ('\n'); + mpfr_dump (xb); printf ("got "); - mpfr_print_binary (xa); putchar ('\n'); + mpfr_dump (xa); exit (1); } mpfr_set_emin (emin); diff --git a/tests/tgmpop.c b/tests/tgmpop.c index 6284a1a0a..688d2bf85 100644 --- a/tests/tgmpop.c +++ b/tests/tgmpop.c @@ -444,10 +444,10 @@ test_specialz (int (*mpfr_func)(mpfr_ptr, mpfr_srcptr, mpz_srcptr, mpfr_rnd_t), if (mpfr_cmp(x1, x2)) { printf("Specialz %s: results differ.\nx1=", op); - mpfr_print_binary(x1); - printf("\nx2="); - mpfr_print_binary(x2); - printf ("\nZ2="); + mpfr_dump (x1); + printf ("x2="); + mpfr_dump (x2); + printf ("Z2="); mpz_out_str (stdout, 2, z1); putchar('\n'); exit(1); @@ -462,10 +462,9 @@ test_specialz (int (*mpfr_func)(mpfr_ptr, mpfr_srcptr, mpz_srcptr, mpfr_rnd_t), if (mpfr_cmp(x1, x2)) { printf("Specialz %s: results differ(2).\nx1=", op); - mpfr_print_binary(x1); - printf("\nx2="); - mpfr_print_binary(x2); - putchar('\n'); + mpfr_dump (x1); + printf ("x2="); + mpfr_dump (x2); exit(1); } @@ -519,10 +518,10 @@ test_special2z (int (*mpfr_func)(mpfr_ptr, mpz_srcptr, mpfr_srcptr, mpfr_rnd_t), if (mpfr_cmp(x1, x2)) { printf("Special2z %s: results differ.\nx1=", op); - mpfr_print_binary(x1); - printf("\nx2="); - mpfr_print_binary(x2); - printf ("\nZ2="); + mpfr_dump (x1); + printf ("x2="); + mpfr_dump (x2); + printf ("Z2="); mpz_out_str (stdout, 2, z1); putchar('\n'); exit(1); @@ -537,10 +536,9 @@ test_special2z (int (*mpfr_func)(mpfr_ptr, mpz_srcptr, mpfr_srcptr, mpfr_rnd_t), if (mpfr_cmp(x1, x2)) { printf("Special2z %s: results differ(2).\nx1=", op); - mpfr_print_binary(x1); - printf("\nx2="); - mpfr_print_binary(x2); - putchar('\n'); + mpfr_dump (x1); + printf ("x2="); + mpfr_dump (x2); exit(1); } @@ -585,8 +583,8 @@ test_genericz (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N, printf ("Results differ for prec=%u rnd_mode=%s and %s_z:\n" "arg1=", (unsigned) prec, mpfr_print_rnd_mode (rnd), op); - mpfr_print_binary (arg1); - printf("\narg2="); + mpfr_dump (arg1); + printf ("arg2="); mpz_out_str (stdout, 10, arg2); printf ("\ngot "); mpfr_dump (dst_small); @@ -610,11 +608,11 @@ test_genericz (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N, printf ("Wrong inexact flag for rnd=%s and %s_z:\n" "expected %d, got %d\n", mpfr_print_rnd_mode (rnd), op, compare, inexact); - printf ("\narg1="); mpfr_print_binary (arg1); - printf ("\narg2="); mpz_out_str(stdout, 2, arg2); - printf ("\ndstl="); mpfr_print_binary (dst_big); - printf ("\ndsts="); mpfr_print_binary (dst_small); - printf ("\ntmp ="); mpfr_dump (tmp); + printf ("arg1="); mpfr_dump (arg1); + printf ("arg2="); mpz_out_str(stdout, 2, arg2); + printf ("\ndstl="); mpfr_dump (dst_big); + printf ("dsts="); mpfr_dump (dst_small); + printf ("tmp ="); mpfr_dump (tmp); exit (1); } } @@ -662,8 +660,8 @@ test_generic2z (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N, printf ("Results differ for prec=%u rnd_mode=%s and %s_z:\n" "arg1=", (unsigned) prec, mpfr_print_rnd_mode (rnd), op); - mpfr_print_binary (arg1); - printf("\narg2="); + mpfr_dump (arg1); + printf ("arg2="); mpz_out_str (stdout, 10, arg2); printf ("\ngot "); mpfr_dump (dst_small); @@ -687,11 +685,11 @@ test_generic2z (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N, printf ("Wrong inexact flag for rnd=%s and %s_z:\n" "expected %d, got %d\n", mpfr_print_rnd_mode (rnd), op, compare, inexact); - printf ("\narg1="); mpfr_print_binary (arg1); - printf ("\narg2="); mpz_out_str(stdout, 2, arg2); - printf ("\ndstl="); mpfr_print_binary (dst_big); - printf ("\ndsts="); mpfr_print_binary (dst_small); - printf ("\ntmp ="); mpfr_dump (tmp); + printf ("arg1="); mpfr_dump (arg1); + printf ("arg2="); mpz_out_str(stdout, 2, arg2); + printf ("\ndstl="); mpfr_dump (dst_big); + printf ("dsts="); mpfr_dump (dst_small); + printf ("tmp ="); mpfr_dump (tmp); exit (1); } } @@ -740,16 +738,15 @@ test_genericq (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N, printf ("Results differ for prec=%u rnd_mode=%s and %s_q:\n" "arg1=", (unsigned) prec, mpfr_print_rnd_mode (rnd), op); - mpfr_print_binary (arg1); - printf("\narg2="); + mpfr_dump (arg1); + printf ("arg2="); mpq_out_str(stdout, 2, arg2); printf ("\ngot "); - mpfr_print_binary (dst_small); - printf ("\nexpected "); - mpfr_print_binary (tmp); - printf ("\napprox "); - mpfr_print_binary (dst_big); - putchar('\n'); + mpfr_dump (dst_small); + printf ("expected "); + mpfr_dump (tmp); + printf ("approx "); + mpfr_dump (dst_big); exit (1); } compare2 = mpfr_cmp (tmp, dst_big); @@ -766,12 +763,11 @@ test_genericq (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N, printf ("Wrong inexact flag for rnd=%s and %s_q:\n" "expected %d, got %d", mpfr_print_rnd_mode (rnd), op, compare, inexact); - printf ("\narg1="); mpfr_print_binary (arg1); - printf ("\narg2="); mpq_out_str(stdout, 2, arg2); - printf ("\ndstl="); mpfr_print_binary (dst_big); - printf ("\ndsts="); mpfr_print_binary (dst_small); - printf ("\ntmp ="); mpfr_print_binary (tmp); - putchar('\n'); + printf ("arg1="); mpfr_dump (arg1); + printf ("arg2="); mpq_out_str(stdout, 2, arg2); + printf ("\ndstl="); mpfr_dump (dst_big); + printf ("dsts="); mpfr_dump (dst_small); + printf ("tmp ="); mpfr_dump (tmp); exit (1); } } @@ -817,10 +813,9 @@ test_specialq (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N, (unsigned long) prec, op); printf ("\nq1="); mpq_out_str(stdout, 2, q1); printf ("\nq2="); mpq_out_str(stdout, 2, q2); - printf ("\nfr_dn="); mpfr_print_binary (fra); - printf ("\nfr_q ="); mpfr_print_binary (frq); - printf ("\nfr_up="); mpfr_print_binary (frb); - putchar('\n'); + printf ("\nfr_dn="); mpfr_dump (fra); + printf ("fr_q ="); mpfr_dump (frq); + printf ("fr_up="); mpfr_dump (frb); exit (1); } } @@ -1190,10 +1185,9 @@ coverage_mpfr_mul_q_20110218 (void) if ((status != 0) || (mpfr_cmp (cmp, res) != 0)) { printf ("Results differ %d.\nres=", status); - mpfr_print_binary (res); - printf ("\ncmp="); - mpfr_print_binary (cmp); - putchar ('\n'); + mpfr_dump (res); + printf ("cmp="); + mpfr_dump (cmp); exit (1); } @@ -1208,8 +1202,8 @@ coverage_mpfr_mul_q_20110218 (void) printf ("mpfr_mul_q 1 * (-1/0) returned a wrong value :\n waiting for "); mpfr_print_binary (cmp); printf (" got "); - mpfr_print_binary (res); - printf ("\n ternary value is %d\n", status); + mpfr_dump (res); + printf ("ternary value is %d\n", status); exit (1); } diff --git a/tests/tlgamma.c b/tests/tlgamma.c index 85afda98a..9d3689e95 100644 --- a/tests/tlgamma.c +++ b/tests/tlgamma.c @@ -144,9 +144,9 @@ special (void) { printf ("mpfr_lgamma("CHECK_X1") is wrong:\n" "expected "); - mpfr_print_binary (x); putchar ('\n'); + mpfr_dump (x); printf ("got "); - mpfr_print_binary (y); putchar ('\n'); + mpfr_dump (y); exit (1); } @@ -160,9 +160,9 @@ special (void) { printf ("mpfr_lgamma("CHECK_X2") is wrong:\n" "expected "); - mpfr_print_binary (x); putchar ('\n'); + mpfr_dump (x); printf ("got "); - mpfr_print_binary (y); putchar ('\n'); + mpfr_dump (y); exit (1); } @@ -189,8 +189,8 @@ special (void) if (mpfr_equal_p (x, y) == 0 || sign != 1) { printf ("Error in mpfr_lgamma (120)\n"); - printf ("Expected "); mpfr_print_binary (y); puts (""); - printf ("Got "); mpfr_print_binary (x); puts (""); + printf ("Expected "); mpfr_dump (y); + printf ("Got "); mpfr_dump (x); exit (1); } diff --git a/tests/tlngamma.c b/tests/tlngamma.c index e0b0d0891..db58e5ecf 100644 --- a/tests/tlngamma.c +++ b/tests/tlngamma.c @@ -143,9 +143,9 @@ special (void) { printf ("mpfr_lngamma("CHECK_X1") is wrong:\n" "expected "); - mpfr_print_binary (x); putchar ('\n'); + mpfr_dump (x); printf ("got "); - mpfr_print_binary (y); putchar ('\n'); + mpfr_dump (y); exit (1); } @@ -158,9 +158,9 @@ special (void) { printf ("mpfr_lngamma("CHECK_X2") is wrong:\n" "expected "); - mpfr_print_binary (x); putchar ('\n'); + mpfr_dump (x); printf ("got "); - mpfr_print_binary (y); putchar ('\n'); + mpfr_dump (y); exit (1); } @@ -185,8 +185,8 @@ special (void) if (mpfr_cmp0 (x, y)) { printf ("Error in mpfr_lngamma (120)\n"); - printf ("Expected "); mpfr_print_binary (y); puts (""); - printf ("Got "); mpfr_print_binary (x); puts (""); + printf ("Expected "); mpfr_dump (y); + printf ("Got "); mpfr_dump (x); exit (1); } diff --git a/tests/tmul_ui.c b/tests/tmul_ui.c index ac33e7af2..79f14e960 100644 --- a/tests/tmul_ui.c +++ b/tests/tmul_ui.c @@ -105,8 +105,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_mul_ui: 1*y != y\n"); - printf ("y= "); mpfr_print_binary (y); puts (""); - printf ("1*y="); mpfr_print_binary (x); puts (""); + printf ("y= "); mpfr_dump (y); + printf ("1*y="); mpfr_dump (x); exit (1); } @@ -172,7 +172,7 @@ main (int argc, char *argv[]) if (mpfr_cmp_ui(x, 0) <= 0) { printf("Error in mpfr_mul_ui: 4*3.0 does not give a positive result:\n"); - mpfr_print_binary(x); puts (""); + mpfr_dump (x); printf("mpfr_cmp_ui(x, 0) = %d\n", mpfr_cmp_ui(x, 0)); exit(1); } @@ -185,7 +185,7 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mul_ui for 1335*(0.100001111E9)\n"); - printf ("got "); mpfr_print_binary (x); puts (""); + printf ("got "); mpfr_dump (x); exit(1); } @@ -199,7 +199,7 @@ main (int argc, char *argv[]) if (mpfr_cmp(x, y)) { printf("Error for 121*y: expected result is:\n"); - mpfr_print_binary(y); puts (""); + mpfr_dump (y); } mpfr_set_prec (x, 32); @@ -226,8 +226,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error for 23 * 2143861251406875.0\n"); - printf ("expected "); mpfr_print_binary (x); puts (""); - printf ("got "); mpfr_print_binary (y); puts (""); + printf ("expected "); mpfr_dump (x); + printf ("got "); mpfr_dump (y); exit (1); } @@ -244,8 +244,8 @@ main (int argc, char *argv[]) { printf ("multiplication by 1.0 fails for xprec=%u, yprec=%u\n", xprec, yprec); - printf ("expected "); mpfr_print_binary (x); puts (""); - printf ("got "); mpfr_print_binary (y); puts (""); + printf ("expected "); mpfr_dump (x); + printf ("got "); mpfr_dump (y); exit (1); } } diff --git a/tests/tpow.c b/tests/tpow.c index 1fa7079d1..3bcf7a9a7 100644 --- a/tests/tpow.c +++ b/tests/tpow.c @@ -452,10 +452,10 @@ check_inexact (mpfr_prec_t p) { printf ("results differ for u=%lu rnd=%s\n", u, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("y="); mpfr_print_binary (y); puts (""); - printf ("t="); mpfr_print_binary (t); puts (""); - printf ("z="); mpfr_print_binary (z); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); + printf ("t="); mpfr_dump (t); + printf ("z="); mpfr_dump (z); exit (1); } if (((inexact == 0) && (cmp != 0)) || @@ -465,8 +465,8 @@ check_inexact (mpfr_prec_t p) (unsigned int) p, (unsigned int) q, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); printf ("expected %d, got %d\n", cmp, inexact); - printf ("u=%lu x=", u); mpfr_print_binary (x); puts (""); - printf ("y="); mpfr_print_binary (y); puts (""); + printf ("u=%lu x=", u); mpfr_dump (x); + printf ("y="); mpfr_dump (y); exit (1); } } diff --git a/tests/tpow3.c b/tests/tpow3.c index ec74c8319..2b981bf54 100644 --- a/tests/tpow3.c +++ b/tests/tpow3.c @@ -101,9 +101,9 @@ main (int argc, char *argv[]) { printf ("Wrong inexact flag for rnd=%s: expected %d, got %d" "\n", mpfr_print_rnd_mode (rnd), compare, inexact); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("y="); mpfr_print_binary (y); puts (""); - printf ("t="); mpfr_print_binary (t); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); + printf ("t="); mpfr_dump (t); exit (1); } } diff --git a/tests/trandom.c b/tests/trandom.c index ecb819be1..337cad8b5 100644 --- a/tests/trandom.c +++ b/tests/trandom.c @@ -50,7 +50,7 @@ test_urandomb (long nbtests, mpfr_prec_t prec, int verbose) if (MPFR_NOTZERO(x) && (MPFR_MANT(x)[0] & MPFR_LIMB_MASK(sh))) { printf ("Error: mpfr_urandomb() returns invalid numbers:\n"); - mpfr_print_binary (x); puts (""); + mpfr_dump (x); exit (1); } d = mpfr_get_d1 (x); av += d; var += d*d; diff --git a/tests/tset_d.c b/tests/tset_d.c index 0aacd6726..04e3e02d9 100644 --- a/tests/tset_d.c +++ b/tests/tset_d.c @@ -145,14 +145,14 @@ main (int argc, char *argv[]) if (mpfr_cmp_ui (x, 4)) { printf ("Error in tset_d: expected 4.0, got "); - mpfr_print_binary (x); putchar('\n'); + mpfr_dump (x); exit (1); } mpfr_set_d (x, -5.0, MPFR_RNDN); if (mpfr_cmp_si (x, -4)) { printf ("Error in tset_d: expected -4.0, got "); - mpfr_print_binary (x); putchar('\n'); + mpfr_dump (x); exit (1); } @@ -160,7 +160,7 @@ main (int argc, char *argv[]) if (mpfr_cmp_ui (x, 1)) { printf ("Error in tset_d: expected 1.0, got "); - mpfr_print_binary (x); putchar('\n'); + mpfr_dump (x); exit (1); } @@ -168,7 +168,7 @@ main (int argc, char *argv[]) mpfr_set_d (z, 1.0, (mpfr_rnd_t) 0); if (mpfr_cmp_ui (z, 1)) { - mpfr_print_binary (z); puts (""); + mpfr_dump (z); printf ("Error: 1.0 != 1.0\n"); exit (1); } @@ -177,7 +177,7 @@ main (int argc, char *argv[]) mpfr_set_d (x, d=-1.08007920352320089721e+150, (mpfr_rnd_t) 0); if (mpfr_get_d1 (x) != d) { - 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); diff --git a/tests/tset_str.c b/tests/tset_str.c index aa0a87cc2..4fa1eac19 100644 --- a/tests/tset_str.c +++ b/tests/tset_str.c @@ -30,10 +30,9 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., if (mpfr_cmp (x, y)) \ { \ printf ("Error in mpfr_set_str (%d):\nexpected ", n); \ - mpfr_print_binary (x); \ - printf ("\ngot "); \ - mpfr_print_binary (y); \ - puts (""); \ + mpfr_dump (x); \ + printf ("got "); \ + mpfr_dump (y); \ mpfr_clear (x); \ mpfr_clear (y); \ exit (1); \ @@ -178,10 +177,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (1a):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -192,10 +189,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (1b):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -260,12 +255,10 @@ main (int argc, char *argv[]) printf ("mpfr_set_str o mpfr_get_str <> id for rnd_mode=%s\n", mpfr_print_rnd_mode (rnd)); printf ("x="); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); printf ("s=%s, exp=%d, base=%d\n", str, (int) e, base); printf ("y="); - mpfr_print_binary (y); - puts (""); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -356,10 +349,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (2):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -377,10 +368,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (3):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -401,10 +390,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (4):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -420,10 +407,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (5):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -437,10 +422,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (6):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -454,10 +437,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (7):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -472,10 +453,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (8):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -486,10 +465,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (9):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -500,10 +477,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (10):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -514,10 +489,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (11):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -528,10 +501,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (12):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -542,10 +513,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (13):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -556,10 +525,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (14):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -570,10 +537,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (15):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -584,10 +549,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (16):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -598,10 +561,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (17):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -612,10 +573,8 @@ main (int argc, char *argv[]) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (18):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -816,11 +775,9 @@ main (int argc, char *argv[]) "rnd=%s:\n", (unsigned int) nb_digit, base[cbase], mpfr_print_rnd_mode (rnd[crnd])); printf ("instead of: "); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); printf ("return : "); - mpfr_print_binary (y); - puts (""); + mpfr_dump (y); exit (1); } } diff --git a/tests/tsqrt.c b/tests/tsqrt.c index fb8c46299..140641d7a 100644 --- a/tests/tsqrt.c +++ b/tests/tsqrt.c @@ -252,7 +252,7 @@ special (void) { printf ("Error: sqrt(1+ulp(1), up) should give 1.5 (prec=%u)\n", (unsigned int) p); - printf ("got "); mpfr_print_binary (x); puts (""); + printf ("got "); mpfr_dump (x); exit (1); } } @@ -446,7 +446,7 @@ check_inexact (mpfr_prec_t p) printf ("x="); mpfr_print_binary (x); printf (" rnd=%s\n", mpfr_print_rnd_mode (rnd)); - printf ("y="); mpfr_print_binary (y); puts (""); + printf ("y="); mpfr_dump (y); exit (1); } mpfr_clear (x); diff --git a/tests/tsub.c b/tests/tsub.c index d15a59a9b..a37399d81 100644 --- a/tests/tsub.c +++ b/tests/tsub.c @@ -105,8 +105,8 @@ check_diverse (void) if (mpfr_cmp (z, y)) { printf ("Error in mpfr_sub (5)\n"); - printf ("expected "); mpfr_print_binary (y); puts (""); - printf ("got "); mpfr_print_binary (z); puts (""); + printf ("expected "); mpfr_dump (y); + printf ("got "); mpfr_dump (z); exit (1); } @@ -118,8 +118,8 @@ check_diverse (void) if (mpfr_cmp (z, y)) { printf ("Error in mpfr_sub (7)\n"); - printf ("expected "); mpfr_print_binary (y); puts (""); - printf ("got "); mpfr_print_binary (z); puts (""); + printf ("expected "); mpfr_dump (y); + printf ("got "); mpfr_dump (z); exit (1); } @@ -131,8 +131,8 @@ check_diverse (void) if (mpfr_cmp (z, y)) { printf ("Error in mpfr_sub (6)\n"); - printf ("expected "); mpfr_print_binary (y); puts (""); - printf ("got "); mpfr_print_binary (z); puts (""); + printf ("expected "); mpfr_dump (y); + printf ("got "); mpfr_dump (z); exit (1); } @@ -165,8 +165,8 @@ check_diverse (void) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_sub (1 - 1E-33) with prec=33\n"); - printf ("Expected "); mpfr_print_binary (y); puts (""); - printf ("got "); mpfr_print_binary (x); puts (""); + printf ("Expected "); mpfr_dump (y); + printf ("got "); mpfr_dump (x); exit (1); } @@ -178,7 +178,7 @@ check_diverse (void) if (mpfr_cmp_ui (x, 1)) { printf ("Error in mpfr_sub (1 - 1E-33) with prec=32\n"); - printf ("Expected 1.0, got "); mpfr_print_binary (x); puts (""); + printf ("Expected 1.0, got "); mpfr_dump (x); exit (1); } @@ -198,8 +198,8 @@ check_diverse (void) if (mpfr_cmp (z, x)) { printf ("Error in mpfr_sub (2)\n"); - printf ("Expected "); mpfr_print_binary (x); puts (""); - printf ("Got "); mpfr_print_binary (z); puts (""); + printf ("Expected "); mpfr_dump (x); + printf ("Got "); mpfr_dump (z); exit (1); } mpfr_set_str_binary (x, "1.1110111011110001110111011111111111101000011001011100101100101101"); @@ -257,8 +257,8 @@ check_diverse (void) test_sub (z, x, y, MPFR_RNDN); if (mpfr_cmp (z, x)) { printf ("mpfr_sub(z, x, y) failed for prec(x)=112, prec(y)=98\n"); - printf ("expected "); mpfr_print_binary (x); puts (""); - printf ("got "); mpfr_print_binary (z); puts (""); + printf ("expected "); mpfr_dump (x); + printf ("got "); mpfr_dump (z); exit (1); } @@ -335,8 +335,8 @@ bug_ddefour(void) if (mpfr_cmp(ex2, ex3)) { printf ("Error in ddefour test.\n"); - printf ("ex2="); mpfr_print_binary (ex2); puts (""); - printf ("ex3="); mpfr_print_binary (ex3); puts (""); + printf ("ex2="); mpfr_dump (ex2); + printf ("ex3="); mpfr_dump (ex3); exit (1); } @@ -376,11 +376,11 @@ check_two_sum (mpfr_prec_t p) { printf ("Wrong inexact flag for prec=%u, rnd=%s\n", (unsigned)p, mpfr_print_rnd_mode (rnd)); - printf ("x="); mpfr_print_binary(x); puts (""); - printf ("y="); mpfr_print_binary(y); puts (""); - printf ("u="); mpfr_print_binary(u); puts (""); - printf ("v="); mpfr_print_binary(v); puts (""); - printf ("w="); mpfr_print_binary(w); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); + printf ("u="); mpfr_dump (u); + printf ("v="); mpfr_dump (v); + printf ("w="); mpfr_dump (w); printf ("inexact = %d\n", inexact); exit (1); } @@ -460,10 +460,10 @@ check_inexact (void) printf ("Wrong inexact flag for rnd=%s\n", mpfr_print_rnd_mode(rnd)); printf ("expected %d, got %d\n", cmp, inexact); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("u="); mpfr_print_binary (u); puts (""); - printf ("y= "); mpfr_print_binary (y); puts (""); - printf ("x-u="); mpfr_print_binary (z); puts (""); + printf ("x="); mpfr_dump (x); + printf ("u="); mpfr_dump (u); + printf ("y= "); mpfr_dump (y); + printf ("x-u="); mpfr_dump (z); exit (1); } } @@ -581,19 +581,19 @@ check_rounding (void) { printf ("Wrong result in check_rounding\n"); printf ("p=%lu k=%ld l=%ld\n", (unsigned long) p, k, l); - printf ("b="); mpfr_print_binary (b); puts (""); - printf ("c="); mpfr_print_binary (c); puts (""); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); printf ("Expected 2^%lu\n", (unsigned long) p); - printf ("Got "); mpfr_print_binary (a); puts (""); + printf ("Got "); mpfr_dump (a); exit (1); } if (i >= 0) { printf ("Wrong ternary value in check_rounding\n"); printf ("p=%lu k=%ld l=%ld\n", (unsigned long) p, k, l); - printf ("b="); mpfr_print_binary (b); puts (""); - printf ("c="); mpfr_print_binary (c); puts (""); - printf ("a="); mpfr_print_binary (a); puts (""); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); printf ("Expected < 0, got %d\n", i); exit (1); } @@ -605,17 +605,17 @@ check_rounding (void) if (mpfr_cmp (a, res) != 0) { printf ("Wrong result in check_rounding\n"); - printf ("b="); mpfr_print_binary (b); puts (""); - printf ("c="); mpfr_print_binary (c); puts (""); - printf ("Expected "); mpfr_print_binary (res); puts (""); - printf ("Got "); mpfr_print_binary (a); puts (""); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("Expected "); mpfr_dump (res); + printf ("Got "); mpfr_dump (a); exit (1); } if (i <= 0) { printf ("Wrong ternary value in check_rounding\n"); - printf ("b="); mpfr_print_binary (b); puts (""); - printf ("c="); mpfr_print_binary (c); puts (""); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); printf ("Expected > 0, got %d\n", i); exit (1); } diff --git a/tests/tsub1sp.c b/tests/tsub1sp.c index cd904ea26..460a5dd6f 100644 --- a/tests/tsub1sp.c +++ b/tests/tsub1sp.c @@ -45,11 +45,10 @@ main (void) { \ printf("ERROR: for %s and p=%lu and i=%d:\nY=", \ mpfr_print_rnd_mode ((mpfr_rnd_t) r), (unsigned long) p, i); \ - mpfr_print_binary(y); \ - printf("\nZ="); mpfr_print_binary(z); \ - printf("\nReal: "); mpfr_print_binary(x2); \ - printf("\nGot : "); mpfr_print_binary(x); \ - putchar('\n'); \ + mpfr_dump (y); \ + printf ("Z="); mpfr_dump (z); \ + printf ("Real: "); mpfr_dump (x2); \ + printf ("Got : "); mpfr_dump (x); \ exit(1); \ } \ while (0) @@ -59,11 +58,11 @@ main (void) { \ printf("ERROR: for %s and p=%lu and i=%d:\nY=", \ mpfr_print_rnd_mode ((mpfr_rnd_t) r), (unsigned long) p, i); \ - mpfr_print_binary(y); \ - printf("\nZ="); mpfr_print_binary(z); \ - printf("\nR="); mpfr_print_binary(x); \ - printf("\nWrong inexact flag. Real: %d. Got: %d\n", \ - inexact1, inexact2); \ + mpfr_dump (y); \ + printf ("Z="); mpfr_dump (z); \ + printf ("R="); mpfr_dump (x); \ + printf ("Wrong inexact flag. Real: %d. Got: %d\n", \ + inexact1, inexact2); \ exit(1); \ } \ while (0) @@ -123,7 +122,7 @@ check_special (void) { printf("Error for x-x with p=%lu. Expected 0. Got:", (unsigned long) p); - mpfr_print_binary(x); + mpfr_dump (x); exit(1); } @@ -133,7 +132,7 @@ check_special (void) { printf("Error for x-y with y=x and p=%lu. Expected 0. Got:", (unsigned long) p); - mpfr_print_binary(x); + mpfr_dump (x); exit(1); } /* diff = 0 */ diff --git a/tests/tsub_ui.c b/tests/tsub_ui.c index 652a94916..eb8bda9c9 100644 --- a/tests/tsub_ui.c +++ b/tests/tsub_ui.c @@ -74,10 +74,10 @@ check_two_sum (mpfr_prec_t p) printf ("Wrong inexact flag for prec=%u, rnd=%s\n", (unsigned int) p, mpfr_print_rnd_mode (rnd)); printf ("x=%u\n", x); - printf ("y="); mpfr_print_binary(y); puts (""); - printf ("u="); mpfr_print_binary(u); puts (""); - printf ("v="); mpfr_print_binary(v); puts (""); - printf ("w="); mpfr_print_binary(w); puts (""); + printf ("y="); mpfr_dump (y); + printf ("u="); mpfr_dump (u); + printf ("v="); mpfr_dump (v); + printf ("w="); mpfr_dump (w); printf ("inexact = %d\n", inexact); exit (1); } diff --git a/tests/ttrunc.c b/tests/ttrunc.c index 7d222c4d1..be0edd816 100644 --- a/tests/ttrunc.c +++ b/tests/ttrunc.c @@ -39,8 +39,7 @@ main (void) if (mpfr_cmp_ui (y, 1)) { printf ("Error in mpfr_ceil for x=0.5: expected 1.0, got "); - mpfr_print_binary(y); - putchar('\n'); + mpfr_dump (y); exit (1); } @@ -49,8 +48,7 @@ main (void) if (mpfr_cmp_ui(y,0)) { printf ("Error in mpfr_ceil for x=0.0: expected 0.0, got "); - mpfr_print_binary(y); - putchar('\n'); + mpfr_dump (y); exit (1); } @@ -59,8 +57,7 @@ main (void) if (mpfr_cmp_ui(y,1)) { printf ("Error in mpfr_ceil for x=1.0: expected 1.0, got "); - mpfr_print_binary(y); - putchar('\n'); + mpfr_dump (y); exit (1); } @@ -89,34 +86,25 @@ main (void) if (!mpfr_eq(y, y2, k)) { - printf("Error in floor, x = "); mpfr_print_binary(x); - printf("\n"); - printf("floor(x) = "); mpfr_print_binary(y); - printf("\n"); - printf("round(x, RNDD) = "); mpfr_print_binary(y2); - printf("\n"); + printf ("Error in floor, x = "); mpfr_dump (x); + printf ("floor(x) = "); mpfr_dump (y); + printf ("round(x, RNDD) = "); mpfr_dump (y2); exit(1); } if (!mpfr_eq(z, z2, k)) { - printf("Error in trunc, x = "); mpfr_print_binary(x); - printf("\n"); - printf("trunc(x) = "); mpfr_print_binary(z); - printf("\n"); - printf("round(x, RNDZ) = "); mpfr_print_binary(z2); - printf("\n"); + printf ("Error in trunc, x = "); mpfr_dump (x); + printf ("trunc(x) = "); mpfr_dump (z); + printf ("round(x, RNDZ) = "); mpfr_dump (z2); exit(1); } if (!mpfr_eq(y, y2, k)) { - printf("Error in ceil, x = "); mpfr_print_binary(x); - printf("\n"); - printf("ceil(x) = "); mpfr_print_binary(t); - printf("\n"); - printf("round(x, RNDU) = "); mpfr_print_binary(t2); - printf("\n"); + printf ("Error in ceil, x = "); mpfr_dump (x); + printf ("ceil(x) = "); mpfr_dump (t); + printf ("round(x, RNDU) = "); mpfr_dump (t2); exit(1); } MPFR_EXP(x)++; diff --git a/tests/tui_pow.c b/tests/tui_pow.c index 25b14d3ac..feb844b5b 100644 --- a/tests/tui_pow.c +++ b/tests/tui_pow.c @@ -133,9 +133,9 @@ check1 (mpfr_ptr x, mpfr_prec_t prec, unsigned long nt, mpfr_rnd_t rnd) { printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n", mpfr_print_rnd_mode (rnd), compare, inexact); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("y="); mpfr_print_binary (y); puts (""); - printf ("t="); mpfr_print_binary (t); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); + printf ("t="); mpfr_dump (t); exit (1); } } diff --git a/tests/turandom.c b/tests/turandom.c index bcffb3760..d0ba12a92 100644 --- a/tests/turandom.c +++ b/tests/turandom.c @@ -63,14 +63,14 @@ test_urandom (long nbtests, mpfr_prec_t prec, mpfr_rnd_t rnd, long bit_index, if (MPFR_MANT(x)[0] & MPFR_LIMB_MASK(sh) && !MPFR_IS_ZERO (x)) { printf ("Error: mpfr_urandom() returns invalid numbers:\n"); - mpfr_print_binary (x); puts (""); + mpfr_dump (x); exit (1); } /* check that the value is in [0,1] */ if (mpfr_cmp_ui (x, 0) < 0 || mpfr_cmp_ui (x, 1) > 0) { printf ("Error: mpfr_urandom() returns number outside [0, 1]:\n"); - mpfr_print_binary (x); puts (""); + mpfr_dump (x); exit (1); } @@ -107,7 +107,7 @@ test_urandom (long nbtests, mpfr_prec_t prec, mpfr_rnd_t rnd, long bit_index, printf ("Error: mpfr_urandom() do not handle correctly a restricted" " exponent range.\nrounding mode: %s\nternary value: %d\n" "random value: ", mpfr_print_rnd_mode (rnd), inex); - mpfr_print_binary (x); puts (""); + mpfr_dump (x); exit (1); } } diff --git a/tests/tzeta.c b/tests/tzeta.c index 7316223e0..4362127e1 100644 --- a/tests/tzeta.c +++ b/tests/tzeta.c @@ -42,12 +42,12 @@ test1 (void) if (mpfr_cmp (x, y)) { printf ("Error for input on 40 bits, output on 50 bits\n"); - printf ("Expected "); mpfr_print_binary (x); puts (""); - printf ("Got "); mpfr_print_binary (y); puts (""); + printf ("Expected "); mpfr_dump (x); + printf ("Got "); mpfr_dump (y); mpfr_set_str_binary (x, "1.001101001101000010011010110100110000101e-1"); mpfr_zeta (y, x, MPFR_RNDU); - mpfr_print_binary (x); puts (""); - mpfr_print_binary (y); puts (""); + mpfr_dump (x); + mpfr_dump (y); exit (1); } @@ -60,8 +60,8 @@ test1 (void) if (mpfr_cmp (x, y)) { printf ("Error in mpfr_zeta (1)\n"); - printf ("Expected "); mpfr_print_binary (x); puts (""); - printf ("Got "); mpfr_print_binary (y); puts (""); + printf ("Expected "); mpfr_dump (x); + printf ("Got "); mpfr_dump (y); exit (1); } @@ -170,14 +170,14 @@ test2 (void) printf("Wrong result for zeta(%s=", val[i]); mpfr_print_binary (x); printf (").\nGot : "); - mpfr_print_binary(y); putchar('\n'); + mpfr_dump (y); printf("Expected: "); mpfr_set_str (y, val[i+1], 2, MPFR_RNDZ); - mpfr_print_binary(y); putchar('\n'); + mpfr_dump (y); mpfr_set_prec(y, 65); mpfr_zeta(y, x, MPFR_RNDZ); printf("+ Prec : "); - mpfr_print_binary(y); putchar('\n'); + mpfr_dump (y); exit(1); } } |