summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorryde <ryde@280ebfd0-de03-0410-8827-d642c229c3f4>2003-06-09 22:48:18 +0000
committerryde <ryde@280ebfd0-de03-0410-8827-d642c229c3f4>2003-06-09 22:48:18 +0000
commit674e99596457dcafd4ddd10a7660ad893cb18772 (patch)
treeabc668ca7c2cb8eb031995f4fd6b88d026cdc12c
parent8a6c5d3a53a2ea00254a54d7723667bcdd124727 (diff)
downloadmpfr-674e99596457dcafd4ddd10a7660ad893cb18772.tar.gz
Patch by Torbjorn: use puts not putchar, to avoid GNUPro compiler bug.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2317 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--tests/tabs.c8
-rw-r--r--tests/tacos.c4
-rw-r--r--tests/tadd.c44
-rw-r--r--tests/tasin.c4
-rw-r--r--tests/tatan.c6
-rw-r--r--tests/tcmp2.c24
-rw-r--r--tests/tconst_euler.c8
-rw-r--r--tests/tconst_log2.c2
-rw-r--r--tests/tconst_pi.c2
-rw-r--r--tests/tcos.c10
-rw-r--r--tests/tdiv.c40
-rw-r--r--tests/tdiv_ui.c12
-rw-r--r--tests/texceptions.c4
-rw-r--r--tests/texp.c10
-rw-r--r--tests/tfactorial.c8
-rw-r--r--tests/tfma.c6
-rw-r--r--tests/tgamma.c4
-rw-r--r--tests/tgeneric.c12
-rw-r--r--tests/tget_str.c2
-rw-r--r--tests/thyperbolic.c4
-rw-r--r--tests/thypot.c12
-rw-r--r--tests/tlog.c4
-rw-r--r--tests/tmul_ui.c18
-rw-r--r--tests/tpow.c12
-rw-r--r--tests/tpow3.c12
-rw-r--r--tests/trandom.c6
-rw-r--r--tests/tset_d.c10
-rw-r--r--tests/tset_si.c4
-rw-r--r--tests/tset_str.c54
-rw-r--r--tests/tsin_cos.c2
-rw-r--r--tests/tsqrt.c8
-rw-r--r--tests/tsub.c44
-rw-r--r--tests/tsub_ui.c8
-rw-r--r--tests/tui_div.c6
-rw-r--r--tests/tui_pow.c12
-rw-r--r--tests/tui_sub.c8
-rw-r--r--tests/tzeta.c4
37 files changed, 217 insertions, 221 deletions
diff --git a/tests/tabs.c b/tests/tabs.c
index 8c86a0f63..aa984f5d5 100644
--- a/tests/tabs.c
+++ b/tests/tabs.c
@@ -64,9 +64,9 @@ check_inexact (void)
((inexact < 0) && (cmp >= 0)))
{
fprintf (stderr, "Wrong inexact flag: expected %d, got %d\n", cmp, inexact);
- printf ("x="); mpfr_print_binary (x); putchar ('\n');
- printf ("absx="); mpfr_print_binary (absx); putchar ('\n');
- printf ("y="); mpfr_print_binary (y); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("absx="); mpfr_print_binary (absx); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
exit (1);
}
}
@@ -141,7 +141,7 @@ main (int argc, char *argv[])
fprintf(stderr,
"Mismatch on d = %.20e\n", d);
fprintf(stderr, "dd=%.20e\n", dd);
- mpfr_print_binary(x); putchar('\n');
+ mpfr_print_binary(x); puts ("");
exit(1);
}
}
diff --git a/tests/tacos.c b/tests/tacos.c
index 58814f2b7..35da08bed 100644
--- a/tests/tacos.c
+++ b/tests/tacos.c
@@ -82,10 +82,10 @@ main (void)
mpfr_print_rnd_mode (rnd));
printf (" got ");
mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf (" expected ");
mpfr_out_str (stdout, 2, prec, y, GMP_RNDN);
- putchar ('\n');
+ puts ("");
}
}
}
diff --git a/tests/tadd.c b/tests/tadd.c
index cca26951c..fbe71bf99 100644
--- a/tests/tadd.c
+++ b/tests/tadd.c
@@ -86,8 +86,8 @@ check2a (double x, int px, double y, int py, int pz, mp_rnd_t rnd_mode,
if (mpfr_cmp(xx, zz)) {
printf("x=%1.20e,%d y=%1.20e,%d pz=%d,rnd=%s\n",
x,px,y,py,pz,mpfr_print_rnd_mode(rnd_mode));
- printf("got "); mpfr_print_binary(zz); putchar('\n');
- printf("instead of "); mpfr_print_binary(xx); putchar('\n');
+ printf("got "); mpfr_print_binary(zz); puts ("");
+ printf("instead of "); mpfr_print_binary(xx); puts ("");
exit(1);
}
mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz);
@@ -113,9 +113,9 @@ check64 (void)
{
fprintf (stderr, "mpfr_add(u, x, t) failed for prec(x)=29, prec(t)=58\n");
printf ("expected "); mpfr_out_str (stdout, 2, 29, t, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf ("got "); mpfr_out_str (stdout, 2, 29, u, GMP_RNDN);
- putchar ('\n');
+ puts ("");
exit(1);
}
@@ -128,7 +128,7 @@ check64 (void)
if (MPFR_MANT(u)[0] << 2)
{
fprintf (stderr, "result not normalized for prec=2\n");
- mpfr_print_binary (u); putchar ('\n');
+ mpfr_print_binary (u); puts ("");
exit (1);
}
mpfr_set_str_raw (t, "-1.0e-1");
@@ -137,7 +137,7 @@ check64 (void)
fprintf (stderr, "mpfr_add(u, x, t) failed for prec(x)=4, prec(t)=2\n");
printf ("expected -1.0e-1\n");
printf ("got "); mpfr_out_str (stdout, 2, 4, u, GMP_RNDN);
- putchar ('\n');
+ puts ("");
exit (1);
}
@@ -152,7 +152,7 @@ check64 (void)
fprintf (stderr, "mpfr_add(u, x, t) failed for prec(x)=8, prec(t)=4\n");
printf ("expected -1.010e-1\n");
printf ("got "); mpfr_out_str (stdout, 2, 4, u, GMP_RNDN);
- putchar ('\n');
+ puts ("");
exit (1);
}
@@ -180,7 +180,7 @@ check64 (void)
mpfr_sub(u, x, t, GMP_RNDU);
mpfr_set_str_raw(t, "0.1011000101110010000101111111011100111111101010011011110110101011101000000100");
if (mpfr_cmp(u,t)) {
- printf("expect "); mpfr_print_binary(t); putchar('\n');
+ printf("expect "); mpfr_print_binary(t); puts ("");
fprintf (stderr, "mpfr_add failed for precisions 53-76\n"); exit(1);
}
mpfr_set_prec(x, 53); mpfr_set_prec(t, 108); mpfr_set_prec(u, 108);
@@ -189,7 +189,7 @@ check64 (void)
mpfr_sub(u, x, t, GMP_RNDU);
mpfr_set_str_raw(t, "0.101100010111001000010111111101110011111110101001101111011010101110100000001011000010101110011000000000111111");
if (mpfr_cmp(u,t)) {
- printf("expect "); mpfr_print_binary(t); putchar('\n');
+ printf("expect "); mpfr_print_binary(t); puts ("");
fprintf(stderr, "mpfr_add failed for precisions 53-108\n"); exit(1);
}
mpfr_set_prec(x, 97); mpfr_set_prec(t, 97); mpfr_set_prec(u, 97);
@@ -235,9 +235,9 @@ check64 (void)
mpfr_add(u, x, t, GMP_RNDU);
if ((MPFR_MANT(u)[0] & 1) != 1) {
printf("error in mpfr_add with rnd_mode=GMP_RNDU\n");
- printf("b= "); mpfr_print_binary(x); putchar('\n');
- printf("c= "); mpfr_print_binary(t); putchar('\n');
- printf("b+c="); mpfr_print_binary(u); putchar('\n');
+ printf("b= "); mpfr_print_binary(x); puts ("");
+ printf("c= "); mpfr_print_binary(t); puts ("");
+ printf("b+c="); mpfr_print_binary(u); puts ("");
exit(1);
}
@@ -351,9 +351,9 @@ check_case_1b (void)
if (mpfr_cmp_ui (a, 1) != 0)
{
fprintf (stderr, "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); putchar('\n');
- printf("c="); mpfr_print_binary(c); putchar('\n');
- printf("a="); mpfr_print_binary(a); putchar('\n');
+ printf("b="); mpfr_print_binary(b); puts ("");
+ printf("c="); mpfr_print_binary(c); puts ("");
+ printf("a="); mpfr_print_binary(a); puts ("");
exit (1);
}
}
@@ -472,9 +472,9 @@ check_inexact (void)
if (mpfr_add (z, x, u, rnd))
{
fprintf (stderr, "z <- x + u should be exact\n");
- printf ("x="); mpfr_print_binary (x); putchar ('\n');
- printf ("u="); mpfr_print_binary (u); putchar ('\n');
- printf ("z="); mpfr_print_binary (z); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("u="); mpfr_print_binary (u); puts ("");
+ printf ("z="); mpfr_print_binary (z); puts ("");
exit (1);
}
for (rnd=0; rnd<4; rnd++)
@@ -488,10 +488,10 @@ check_inexact (void)
fprintf (stderr, "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); putchar ('\n');
- printf ("u="); mpfr_print_binary (u); putchar ('\n');
- printf ("y= "); mpfr_print_binary (y); putchar ('\n');
- printf ("x+u="); mpfr_print_binary (z); putchar ('\n');
+ 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 ("");
exit (1);
}
}
diff --git a/tests/tasin.c b/tests/tasin.c
index 778c45f2c..b1fd9be4e 100644
--- a/tests/tasin.c
+++ b/tests/tasin.c
@@ -77,10 +77,10 @@ main (void)
mpfr_print_rnd_mode (rnd));
printf (" got ");
mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf (" expected ");
mpfr_out_str (stdout, 2, prec, y, GMP_RNDN);
- putchar ('\n');
+ puts ("");
}
}
}
diff --git a/tests/tatan.c b/tests/tatan.c
index dbf0d4d2b..22f51e112 100644
--- a/tests/tatan.c
+++ b/tests/tatan.c
@@ -105,13 +105,13 @@ main (int argc, char *argv[])
mpfr_print_rnd_mode (rnd));
printf (" got ");
mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf (" expected ");
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf (" approximation was ");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
exit (1);
}
}
diff --git a/tests/tcmp2.c b/tests/tcmp2.c
index e26f3b426..8e8adbffc 100644
--- a/tests/tcmp2.c
+++ b/tests/tcmp2.c
@@ -199,10 +199,10 @@ special (void)
printf ("Error in mpfr_cmp2:\n");
printf ("x=");
mpfr_print_binary (x);
- putchar ('\n');
+ puts ("");
printf ("y=");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
printf ("got %lu, expected 1\n", j);
exit (1);
}
@@ -213,8 +213,8 @@ special (void)
j = 0;
if (mpfr_cmp2(x, y, &j) <= 0 || j != 32) {
printf("Error in mpfr_cmp2:\n");
- printf("x="); mpfr_print_binary(x); putchar('\n');
- printf("y="); mpfr_print_binary(y); putchar('\n');
+ printf("x="); mpfr_print_binary(x); puts ("");
+ printf("y="); mpfr_print_binary(y); puts ("");
printf("got %lu, expected 32\n", j);
exit(1);
}
@@ -225,8 +225,8 @@ special (void)
j = 0;
if (mpfr_cmp2(x, y, &j) <= 0 || j != 164) {
printf("Error in mpfr_cmp2:\n");
- printf("x="); mpfr_print_binary(x); putchar('\n');
- printf("y="); mpfr_print_binary(y); putchar('\n');
+ printf("x="); mpfr_print_binary(x); puts ("");
+ printf("y="); mpfr_print_binary(y); puts ("");
printf("got %lu, expected 164\n", j);
exit(1);
}
@@ -238,8 +238,8 @@ special (void)
j = 0;
if (mpfr_cmp2(x, y, &j) <= 0 || j != 127) {
printf("Error in mpfr_cmp2:\n");
- printf("x="); mpfr_print_binary(x); putchar('\n');
- printf("y="); mpfr_print_binary(y); putchar('\n');
+ printf("x="); mpfr_print_binary(x); puts ("");
+ printf("y="); mpfr_print_binary(y); puts ("");
printf("got %lu, expected 127\n", j);
exit(1);
}
@@ -251,8 +251,8 @@ special (void)
j = 0;
if (mpfr_cmp2(x, y, &j) <= 0 || j != 63) {
printf("Error in mpfr_cmp2:\n");
- printf("x="); mpfr_print_binary(x); putchar('\n');
- printf("y="); mpfr_print_binary(y); putchar('\n');
+ printf("x="); mpfr_print_binary(x); puts ("");
+ printf("y="); mpfr_print_binary(y); puts ("");
printf("got %lu, expected 63\n", j);
exit(1);
}
@@ -264,8 +264,8 @@ special (void)
j = 0;
if (mpfr_cmp2(x, y, &j) <= 0 || j != 63) {
printf("Error in mpfr_cmp2:\n");
- printf("x="); mpfr_print_binary(x); putchar('\n');
- printf("y="); mpfr_print_binary(y); putchar('\n');
+ printf("x="); mpfr_print_binary(x); puts ("");
+ printf("y="); mpfr_print_binary(y); puts ("");
printf("got %lu, expected 63\n", j);
exit(1);
}
diff --git a/tests/tconst_euler.c b/tests/tconst_euler.c
index a86b1154d..8dd947f8e 100644
--- a/tests/tconst_euler.c
+++ b/tests/tconst_euler.c
@@ -42,7 +42,7 @@ main (int argc, char *argv[])
mpfr_init2 (gamma, prec);
mpfr_const_euler (gamma, GMP_RNDN);
printf("gamma="); mpfr_out_str (stdout, 10, 0, gamma, GMP_RNDD);
- putchar ('\n');
+ puts ("");
mpfr_clear (gamma);
return 0;
}
@@ -72,13 +72,13 @@ main (int argc, char *argv[])
mpfr_print_rnd_mode (rnd));
printf (" got ");
mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf (" expected ");
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf (" approximation was ");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
exit (1);
}
}
diff --git a/tests/tconst_log2.c b/tests/tconst_log2.c
index 47840cb9d..587f59867 100644
--- a/tests/tconst_log2.c
+++ b/tests/tconst_log2.c
@@ -101,7 +101,7 @@ main (int argc, char *argv[])
mpfr_const_log2 (x, rnd);
printf ("log(2)=");
mpfr_out_str (stdout, 10, 0, x, rnd);
- putchar('\n');
+ puts ("");
}
mpfr_set_prec (x, 53);
diff --git a/tests/tconst_pi.c b/tests/tconst_pi.c
index 245f1455e..54ccb6dc6 100644
--- a/tests/tconst_pi.c
+++ b/tests/tconst_pi.c
@@ -54,7 +54,7 @@ main (int argc, char *argv[])
{
printf ("Pi=");
mpfr_out_str (stdout, 10, 0, x, rnd);
- putchar ('\n');
+ puts ("");
}
}
else if (mpfr_get_d1 (x) != 3.141592653589793116)
diff --git a/tests/tcos.c b/tests/tcos.c
index 8be61672e..866454815 100644
--- a/tests/tcos.c
+++ b/tests/tcos.c
@@ -111,8 +111,8 @@ main (int argc, char *argv[])
if (mpfr_cmp (y, x))
{
fprintf (stderr, "Error for prec=30, rnd=GMP_RNDU\n");
- printf ("expected "); mpfr_print_binary (x); putchar ('\n');
- printf (" got "); mpfr_print_binary (y); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (x); puts ("");
+ printf (" got "); mpfr_print_binary (y); puts ("");
exit (1);
}
@@ -124,8 +124,8 @@ main (int argc, char *argv[])
if (mpfr_cmp (y, x))
{
fprintf (stderr, "Error for prec=59, rnd=GMP_RNDU\n");
- printf ("expected "); mpfr_print_binary (x); putchar ('\n');
- printf (" got "); mpfr_print_binary (y); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (x); puts ("");
+ printf (" got "); mpfr_print_binary (y); puts ("");
exit (1);
}
@@ -137,7 +137,7 @@ main (int argc, char *argv[])
if (mpfr_cmp (y, x))
{
fprintf (stderr, "Error for x=1.1100e-2, rnd=GMP_RNDD\n");
- printf ("expected 1.1100e-1, got "); mpfr_print_binary (y); putchar ('\n');
+ printf ("expected 1.1100e-1, got "); mpfr_print_binary (y); puts ("");
exit (1);
}
diff --git a/tests/tdiv.c b/tests/tdiv.c
index 9ceb89981..6355c449a 100644
--- a/tests/tdiv.c
+++ b/tests/tdiv.c
@@ -143,8 +143,8 @@ check_convergence (void)
mpfr_set_str_raw(y, "0.10010010011011010100101001010111100000101110010010101E-529");
if (mpfr_cmp(x, y)) {
fprintf(stderr, "Error in mpfr_div for prec=64, rnd=GMP_RNDN\n");
- printf("got "); mpfr_print_binary(x); putchar('\n');
- printf("instead of "); mpfr_print_binary(y); putchar('\n');
+ printf("got "); mpfr_print_binary(x); puts ("");
+ printf("instead of "); mpfr_print_binary(y); puts ("");
exit(1);
}
@@ -158,7 +158,7 @@ check_convergence (void)
if (mpfr_cmp_ui(y, 1)) {
fprintf(stderr, "mpfr_div failed for x=1.0, y=1.0, prec=%u rnd=%s\n",
i, mpfr_print_rnd_mode(j));
- printf("got "); mpfr_print_binary(y); putchar('\n');
+ printf("got "); mpfr_print_binary(y); puts ("");
exit(1);
}
}
@@ -192,8 +192,8 @@ check_lowr (void)
{
fprintf(stderr, "Error in mpfr_div rnd=GMP_RNDN\n");
printf("Dividing ");
- printf("got "); mpfr_print_binary(z2); putchar('\n');
- printf("instead of "); mpfr_print_binary(z); putchar('\n');
+ printf("got "); mpfr_print_binary(z2); puts ("");
+ printf("instead of "); mpfr_print_binary(z); puts ("");
printf("inex flag = %d\n", c);
exit(1);
}
@@ -211,8 +211,8 @@ check_lowr (void)
{
fprintf(stderr, "Error in mpfr_div rnd=GMP_RNDN\n");
printf("Dividing ");
- printf("got "); mpfr_print_binary(z2); putchar('\n');
- printf("instead of "); mpfr_print_binary(z); putchar('\n');
+ printf("got "); mpfr_print_binary(z2); puts ("");
+ printf("instead of "); mpfr_print_binary(z); puts ("");
printf("inex flag = %d\n", c);
exit(1);
}
@@ -223,8 +223,8 @@ check_lowr (void)
{
fprintf(stderr, "Error in mpfr_div [even rnd?] rnd=GMP_RNDN\n");
printf("Dividing ");
- printf("got "); mpfr_print_binary(z2); putchar('\n');
- printf("instead of "); mpfr_print_binary(z); putchar('\n');
+ printf("got "); mpfr_print_binary(z2); puts ("");
+ printf("instead of "); mpfr_print_binary(z); puts ("");
printf("inex flag = %d\n", 1);
exit(1);
}
@@ -236,8 +236,8 @@ check_lowr (void)
{
fprintf(stderr, "Error in mpfr_div [even rnd?] rnd=GMP_RNDN\n");
printf("Dividing ");
- printf("got "); mpfr_print_binary(z2); putchar('\n');
- printf("instead of "); mpfr_print_binary(z); putchar('\n');
+ printf("got "); mpfr_print_binary(z2); puts ("");
+ printf("instead of "); mpfr_print_binary(z); puts ("");
printf("inex flag = %d\n", 1);
exit(1);
}
@@ -267,8 +267,8 @@ check_lowr (void)
if (c != -1 || mpfr_cmp(z2, z))
{
fprintf(stderr, "Error in mpfr_div rnd=GMP_RNDD\n");
- printf("got "); mpfr_print_binary(z2); putchar('\n');
- printf("instead of "); mpfr_print_binary(z); putchar('\n');
+ printf("got "); mpfr_print_binary(z2); puts ("");
+ printf("instead of "); mpfr_print_binary(z); puts ("");
printf("inex flag = %d\n", c);
exit(1);
}
@@ -280,8 +280,8 @@ check_lowr (void)
if (c != 1 || mpfr_cmp(z2, z))
{
fprintf(stderr, "Error in mpfr_div rnd=GMP_RNDU\n");
- printf("got "); mpfr_print_binary(z2); putchar('\n');
- printf("instead of "); mpfr_print_binary(z); putchar('\n');
+ printf("got "); mpfr_print_binary(z2); puts ("");
+ printf("instead of "); mpfr_print_binary(z); puts ("");
printf("inex flag = %d\n", c);
exit(1);
}
@@ -331,7 +331,7 @@ check_inexact (void)
{
fprintf (stderr, "Wrong inexact flag (1): expected 1, got %d\n",
inexact);
- mpfr_print_binary(y); putchar('\n');
+ mpfr_print_binary(y); puts ("");
exit (1);
}
@@ -363,10 +363,10 @@ check_inexact (void)
fprintf (stderr, "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); putchar ('\n');
- printf ("u="); mpfr_print_binary (u); putchar ('\n');
- printf ("y="); mpfr_print_binary (y); putchar ('\n');
- printf ("y*u="); mpfr_print_binary (z); putchar ('\n');
+ 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 ("");
exit (1);
}
}
diff --git a/tests/tdiv_ui.c b/tests/tdiv_ui.c
index 5a30e779e..ad0bfae2d 100644
--- a/tests/tdiv_ui.c
+++ b/tests/tdiv_ui.c
@@ -104,8 +104,8 @@ special (void)
if (mpfr_get_d1 (x) != mpfr_get_d1 (y))
{
fprintf (stderr, "division by 1.0 fails for xprec=%u, yprec=%u\n", xprec, yprec);
- printf ("expected "); mpfr_print_binary (x); putchar ('\n');
- printf ("got "); mpfr_print_binary (y); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (x); puts ("");
+ printf ("got "); mpfr_print_binary (y); puts ("");
exit (1);
}
}
@@ -143,8 +143,8 @@ check_inexact (void)
if (mpfr_mul_ui (z, y, u, rnd))
{
fprintf (stderr, "z <- y * u should be exact for u=%lu\n", u);
- printf ("y="); mpfr_print_binary (y); putchar ('\n');
- printf ("z="); mpfr_print_binary (z); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ printf ("z="); mpfr_print_binary (z); puts ("");
exit (1);
}
cmp = mpfr_cmp (z, x);
@@ -154,8 +154,8 @@ check_inexact (void)
{
fprintf (stderr, "Wrong inexact flag for u=%lu, rnd=%s\n", u,
mpfr_print_rnd_mode(rnd));
- printf ("x="); mpfr_print_binary (x); putchar ('\n');
- printf ("y="); mpfr_print_binary (y); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
exit (1);
}
}
diff --git a/tests/texceptions.c b/tests/texceptions.c
index 7f2fd829e..bfa18cc80 100644
--- a/tests/texceptions.c
+++ b/tests/texceptions.c
@@ -93,7 +93,7 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Error: x+x rounded to nearest for x=2^1023 should give +Inf\n");
printf ("emax = %ld\n", mpfr_get_emax ());
- printf ("got "); mpfr_print_binary (x); putchar ('\n');
+ printf ("got "); mpfr_print_binary (x); puts ("");
exit (1);
}
@@ -113,7 +113,7 @@ main (int argc, char *argv[])
if (mpfr_cmp_ui (y, 0))
{
fprintf (stderr, "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); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); puts ("");
exit (1);
}
diff --git a/tests/texp.c b/tests/texp.c
index bd8e8c544..dd71068ff 100644
--- a/tests/texp.c
+++ b/tests/texp.c
@@ -96,10 +96,10 @@ check_large (double d, int n, mp_rnd_t rnd)
else
printf ("exp(%1.20e)=", d);
mpfr_out_str (stdout, 10, 0, y, rnd);
- putchar ('\n');
+ puts ("");
printf (" =");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
if (n == 53)
printf (" =%1.20e\n", mpfr_get_d1 (y));
@@ -200,13 +200,13 @@ compare_exp2_exp3 (int n)
printf ("mpfr_exp_2 and mpfr_exp3 disagree for rnd=%s and\nx=",
mpfr_print_rnd_mode (rnd));
mpfr_print_binary (x);
- putchar ('\n');
+ puts ("");
printf ("mpfr_exp_2 gives ");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
printf ("mpfr_exp3 gives ");
mpfr_print_binary (z);
- putchar ('\n');
+ puts ("");
exit (1);
}
}
diff --git a/tests/tfactorial.c b/tests/tfactorial.c
index 712570a4a..7e368c4ec 100644
--- a/tests/tfactorial.c
+++ b/tests/tfactorial.c
@@ -87,7 +87,7 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Wrong inexact flag: expected inexact\n");
printf ("n=%u prec=%u\n", n, prec);
- mpfr_print_binary(z); putchar('\n');
+ mpfr_print_binary(z); puts ("");
exit (1);
}
}
@@ -99,13 +99,13 @@ main (int argc, char *argv[])
mpfr_print_rnd_mode (rnd));
printf (" got ");
mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf (" expected ");
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf (" approximation was ");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
exit (1);
}
}
diff --git a/tests/tfma.c b/tests/tfma.c
index 4bbad6a35..d7f69bb1b 100644
--- a/tests/tfma.c
+++ b/tests/tfma.c
@@ -295,13 +295,13 @@ main (int argc, char *argv[])
mpfr_print_rnd_mode (rnd));
printf ("got ");
mpfr_out_str (stdout, 2, prec, s, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf ("expected ");
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf ("approx ");
mpfr_print_binary (slong);
- putchar ('\n');
+ puts ("");
exit (1);
}
if (((inexact == 0) && (compare != 0)) ||
diff --git a/tests/tgamma.c b/tests/tgamma.c
index 20cc6021c..584ec712e 100644
--- a/tests/tgamma.c
+++ b/tests/tgamma.c
@@ -88,10 +88,10 @@ main (void)
mpfr_print_rnd_mode (rnd));
printf (" got ");
mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf (" expected ");
mpfr_out_str (stdout, 2, prec, y, GMP_RNDN);
- putchar ('\n');
+ puts ("");
}
}
}
diff --git a/tests/tgeneric.c b/tests/tgeneric.c
index 70a8a7903..4be686bcd 100644
--- a/tests/tgeneric.c
+++ b/tests/tgeneric.c
@@ -63,13 +63,13 @@ test_generic (int p0, int p1, int N)
mpfr_print_rnd_mode (rnd));
printf ("got ");
mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf ("expected ");
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf ("approx ");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
exit (1);
}
compare2 = mpfr_cmp (t, y);
@@ -85,9 +85,9 @@ test_generic (int p0, int p1, int N)
{
fprintf (stderr, "Wrong inexact flag for rnd=%s: expected %d, got %d\n",
mpfr_print_rnd_mode (rnd), compare, inexact);
- printf ("x="); mpfr_print_binary (x); putchar ('\n');
- printf ("y="); mpfr_print_binary (y); putchar ('\n');
- printf ("t="); mpfr_print_binary (t); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ printf ("t="); mpfr_print_binary (t); puts ("");
exit (1);
}
}
diff --git a/tests/tget_str.c b/tests/tget_str.c
index 61e549866..4aa0ddd9a 100644
--- a/tests/tget_str.c
+++ b/tests/tget_str.c
@@ -155,7 +155,7 @@ check_small (void)
{
fprintf(stderr, "Error in mpfr_get_str: 688 printed up to 4 bits should give 1.011e9\ninstead of ");
mpfr_out_str (stderr, 2, 4, x, GMP_RNDU);
- putchar ('\n');
+ puts ("");
exit (1);
}
(*__gmp_free_func) (s, strlen (s) + 1);
diff --git a/tests/thyperbolic.c b/tests/thyperbolic.c
index 2e2a8208b..33832c219 100644
--- a/tests/thyperbolic.c
+++ b/tests/thyperbolic.c
@@ -548,10 +548,10 @@ check_O (void)
/*
mpfr_out_str(stdout, 2,40,th,GMP_RNDN);
- putchar('\n');
+ puts ("");
mpfr_out_str(stdout, 2,40,ath,GMP_RNDU);
- putchar('\n');
+ puts ("");
*/
if(mpfr_cmp_ui(ath,2)!=0)
diff --git a/tests/thypot.c b/tests/thypot.c
index 55b0146ed..5caadd6ff 100644
--- a/tests/thypot.c
+++ b/tests/thypot.c
@@ -131,13 +131,13 @@ main (int argc, char *argv[])
mpfr_print_rnd_mode (rnd));
printf (" got ");
mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf (" expected ");
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf (" approximation was ");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
exit (1);
}
compare2 = mpfr_cmp (t, y);
@@ -153,9 +153,9 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Wrong inexact flag for rnd=%s: expected %d, got %d\n",
mpfr_print_rnd_mode (rnd), compare, inexact);
- printf ("x1="); mpfr_print_binary (x1); putchar ('\n');
- printf ("x2="); mpfr_print_binary (x2); putchar ('\n');
- printf ("t="); mpfr_print_binary (t); putchar ('\n');
+ printf ("x1="); mpfr_print_binary (x1); puts ("");
+ printf ("x2="); mpfr_print_binary (x2); puts ("");
+ printf ("t="); mpfr_print_binary (t); puts ("");
exit (1);
}
}
diff --git a/tests/tlog.c b/tests/tlog.c
index 92deb86fc..d7b89eb14 100644
--- a/tests/tlog.c
+++ b/tests/tlog.c
@@ -90,8 +90,8 @@ check3 (double d, unsigned long prec, mp_rnd_t rnd)
mpfr_init2(x, prec); mpfr_init2(y, prec);
mpfr_set_d(x, d, rnd);
mpfr_log(y, x, rnd);
- mpfr_out_str(stdout, 10, 0, y, rnd); putchar('\n');
- mpfr_print_binary(y); putchar('\n');
+ mpfr_out_str(stdout, 10, 0, y, rnd); puts ("");
+ mpfr_print_binary(y); puts ("");
mpfr_clear(x); mpfr_clear(y);
}
diff --git a/tests/tmul_ui.c b/tests/tmul_ui.c
index aaeaf952a..fd6e08e19 100644
--- a/tests/tmul_ui.c
+++ b/tests/tmul_ui.c
@@ -103,8 +103,8 @@ main (int argc, char *argv[])
if (mpfr_cmp (x, y))
{
fprintf (stderr, "Error in mpfr_mul_ui: 1*y != y\n");
- printf ("y= "); mpfr_print_binary (y); putchar ('\n');
- printf ("1*y="); mpfr_print_binary (x); putchar ('\n');
+ printf ("y= "); mpfr_print_binary (y); puts ("");
+ printf ("1*y="); mpfr_print_binary (x); puts ("");
exit (1);
}
@@ -147,7 +147,7 @@ main (int argc, char *argv[])
if (mpfr_cmp_ui(x, 0) <= 0)
{
fprintf(stderr, "Error in mpfr_mul_ui: 4*3.0 does not give a positive result:\n");
- mpfr_print_binary(x); putchar('\n');
+ mpfr_print_binary(x); puts ("");
printf("mpfr_cmp_ui(x, 0) = %d\n", mpfr_cmp_ui(x, 0));
exit(1);
}
@@ -160,7 +160,7 @@ main (int argc, char *argv[])
if (mpfr_cmp (x, y))
{
fprintf (stderr, "Error in mul_ui for 1335*(0.100001111E9)\n");
- printf ("got "); mpfr_print_binary (x); putchar ('\n');
+ printf ("got "); mpfr_print_binary (x); puts ("");
exit(1);
}
@@ -174,7 +174,7 @@ main (int argc, char *argv[])
if (mpfr_cmp(x, y))
{
printf("Error for 121*y: expected result is:\n");
- mpfr_print_binary(y); putchar('\n');
+ mpfr_print_binary(y); puts ("");
}
mpfr_set_prec (x, 32);
@@ -201,8 +201,8 @@ main (int argc, char *argv[])
if (mpfr_cmp (x, y))
{
printf ("Error for 23 * 2143861251406875.0\n");
- printf ("expected "); mpfr_print_binary (x); putchar ('\n');
- printf ("got "); mpfr_print_binary (y); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (x); puts ("");
+ printf ("got "); mpfr_print_binary (y); puts ("");
exit (1);
}
@@ -218,8 +218,8 @@ main (int argc, char *argv[])
if (mpfr_get_d1 (x) != mpfr_get_d1 (y))
{
fprintf (stderr, "multiplication by 1.0 fails for xprec=%u, yprec=%u\n", xprec, yprec);
- printf ("expected "); mpfr_print_binary (x); putchar ('\n');
- printf ("got "); mpfr_print_binary (y); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (x); puts ("");
+ printf ("got "); mpfr_print_binary (y); puts ("");
exit (1);
}
}
diff --git a/tests/tpow.c b/tests/tpow.c
index a824bf545..d94af9dc4 100644
--- a/tests/tpow.c
+++ b/tests/tpow.c
@@ -98,10 +98,10 @@ check_inexact (mp_prec_t p)
{
fprintf (stderr, "results differ for u=%lu rnd=%s\n", u,
mpfr_print_rnd_mode(rnd));
- printf ("x="); mpfr_print_binary (x); putchar ('\n');
- printf ("y="); mpfr_print_binary (y); putchar ('\n');
- printf ("t="); mpfr_print_binary (t); putchar ('\n');
- printf ("z="); mpfr_print_binary (z); putchar ('\n');
+ 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 ("");
exit (1);
}
if (((inexact == 0) && (cmp != 0)) ||
@@ -110,8 +110,8 @@ check_inexact (mp_prec_t p)
fprintf (stderr, "Wrong inexact flag for p=%u, q=%u, rnd=%s\n",
(unsigned) p, (unsigned) q, mpfr_print_rnd_mode (rnd));
printf ("expected %d, got %d\n", cmp, inexact);
- printf ("u=%lu x=", u); mpfr_print_binary (x); putchar ('\n');
- printf ("y="); mpfr_print_binary (y); putchar ('\n');
+ printf ("u=%lu x=", u); mpfr_print_binary (x); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
exit (1);
}
}
diff --git a/tests/tpow3.c b/tests/tpow3.c
index e4964753a..8cf2dffc5 100644
--- a/tests/tpow3.c
+++ b/tests/tpow3.c
@@ -89,13 +89,13 @@ main (int argc, char *argv[])
mpfr_print_rnd_mode (rnd));
printf ("got ");
mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf ("expected ");
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf ("approx ");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
exit (1);
}
compare2 = mpfr_cmp (t, y);
@@ -111,9 +111,9 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Wrong inexact flag for rnd=%s: expected %d, got %d\n",
mpfr_print_rnd_mode (rnd), compare, inexact);
- printf ("x="); mpfr_print_binary (x); putchar ('\n');
- printf ("y="); mpfr_print_binary (y); putchar ('\n');
- printf ("t="); mpfr_print_binary (t); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ printf ("t="); mpfr_print_binary (t); puts ("");
exit (1);
}
}
diff --git a/tests/trandom.c b/tests/trandom.c
index 933f8524c..3c512c59e 100644
--- a/tests/trandom.c
+++ b/tests/trandom.c
@@ -104,14 +104,14 @@ test_random2 (unsigned long nbtests, unsigned long prec, int verbose)
if (MPFR_MANT(x)[0] & ((MP_LIMB_T_ONE << sh) - MP_LIMB_T_ONE))
{
fprintf (stderr, "Error: mpfr_random2() returns invalid numbers:\n");
- mpfr_print_binary (x); putchar ('\n');
+ mpfr_print_binary (x); puts ("");
exit (1);
}
/* check that exponent is in correct range */
if (mpfr_get_exp (x) != 0)
{
fprintf (stderr, "Error: mpfr_random2 (.., .., 0) does not return a 0 exponent:\n");
- mpfr_print_binary (x); putchar ('\n');
+ mpfr_print_binary (x); puts ("");
exit (1);
}
d = mpfr_get_d1 (x); av += d; var += d*d;
@@ -175,7 +175,7 @@ test_urandomb (unsigned long nbtests, unsigned long prec, int verbose)
if (MPFR_MANT(x)[0] & ((MP_LIMB_T_ONE << sh) - MP_LIMB_T_ONE))
{
fprintf (stderr, "Error: mpfr_urandomb() returns invalid numbers:\n");
- mpfr_print_binary (x); putchar ('\n');
+ mpfr_print_binary (x); puts ("");
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 2b3c4578b..84a9e922d 100644
--- a/tests/tset_d.c
+++ b/tests/tset_d.c
@@ -51,7 +51,7 @@ main (int argc, char *argv[])
fprintf (stderr, "got ");
mpfr_out_str (stderr, 10, 10, x, GMP_RNDN);
fprintf (stderr, "\n");
- mpfr_print_binary (x); putchar ('\n');
+ mpfr_print_binary (x); puts ("");
exit (1);
}
}
@@ -84,13 +84,13 @@ main (int argc, char *argv[])
mpfr_init2(z, 32);
mpfr_set_d(z, 1.0, 0);
if (mpfr_get_d1 (z) != 1.0) {
- mpfr_print_binary(z); putchar('\n');
+ mpfr_print_binary(z); puts ("");
printf("Error: 1.0 != 1.0\n"); exit(1);
}
mpfr_set_prec(x, 53); mpfr_init2(y, 53);
mpfr_set_d(x, d=-1.08007920352320089721e+150, 0);
if (mpfr_get_d1 (x) != d) {
- mpfr_print_binary(x); putchar('\n');
+ mpfr_print_binary(x); puts ("");
printf("Error: get_d o set_d <> identity for d = %1.20e %1.20e\n",d,
mpfr_get_d1 (x)); exit(1);
}
@@ -100,7 +100,7 @@ main (int argc, char *argv[])
d = -6.72658901114033715233e-165;
mpfr_set_d(x, d, 0);
if (d != mpfr_get_d1 (x)) {
- mpfr_print_binary(x); putchar('\n');
+ mpfr_print_binary(x); puts ("");
printf("Error: get_d o set_d <> identity for d = %1.20e %1.20e\n",d,
mpfr_get_d1 (x)); exit(1);
}
@@ -123,7 +123,7 @@ main (int argc, char *argv[])
fprintf (stderr,
"Mismatch on : %1.18g != %1.18g\n", d, mpfr_get_d1 (x));
mpfr_print_binary (x);
- putchar ('\n');
+ puts ("");
exit (1);
}
}
diff --git a/tests/tset_si.c b/tests/tset_si.c
index 8a0c62a7a..36771751c 100644
--- a/tests/tset_si.c
+++ b/tests/tset_si.c
@@ -97,7 +97,7 @@ main (int argc, char *argv[])
|| inex >= 0)
{
fprintf(stderr, "Error in mpfr_set_si(x:3, 77617, GMP_RNDD)\n");
- mpfr_print_binary(x); putchar('\n');
+ mpfr_print_binary(x); puts ("");
exit(1);
}
inex = mpfr_set_ui(x, 77617, GMP_RNDD); /* should be 65536 */
@@ -105,7 +105,7 @@ main (int argc, char *argv[])
|| inex >= 0)
{
fprintf(stderr, "Error in mpfr_set_ui(x:3, 77617, GMP_RNDD)\n");
- mpfr_print_binary(x); putchar('\n');
+ mpfr_print_binary(x); puts ("");
exit(1);
}
diff --git a/tests/tset_str.c b/tests/tset_str.c
index 1eb550908..e200c18a4 100644
--- a/tests/tset_str.c
+++ b/tests/tset_str.c
@@ -46,7 +46,7 @@ main (int argc, char *argv[])
mpfr_init2 (x, prec);
mpfr_set_str_raw (x, argv[1]);
mpfr_out_str (stdout, 10, 0, x, GMP_RNDN);
- putchar ('\n');
+ puts ("");
mpfr_clear (x);
return 0;
}
@@ -91,9 +91,9 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Error in mpfr_set_str (1a):\n");
mpfr_print_binary (x);
- putchar ('\n');
+ puts ("");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
mpfr_clear (x);
mpfr_clear (y);
exit (1);
@@ -105,9 +105,9 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Error in mpfr_set_str (1b):\n");
mpfr_print_binary (x);
- putchar ('\n');
+ puts ("");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
mpfr_clear (x);
mpfr_clear (y);
exit (1);
@@ -171,11 +171,11 @@ main (int argc, char *argv[])
mpfr_print_rnd_mode (k));
printf ("x=");
mpfr_print_binary (x);
- putchar('\n');
+ puts ("");
printf ("s=%s, exp=%d, base=%d\n", str, (int) e, base);
printf ("y=");
mpfr_print_binary (y);
- putchar('\n');
+ puts ("");
mpfr_clear (x);
mpfr_clear (y);
exit (1);
@@ -230,9 +230,9 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Error in mpfr_set_str (2):\n");
mpfr_print_binary (x);
- putchar ('\n');
+ puts ("");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
mpfr_clear (x);
mpfr_clear (y);
exit (1);
@@ -251,9 +251,9 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Error in mpfr_set_str (3):\n");
mpfr_print_binary (x);
- putchar ('\n');
+ puts ("");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
mpfr_clear (x);
mpfr_clear (y);
exit (1);
@@ -275,9 +275,9 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Error in mpfr_set_str (4):\n");
mpfr_print_binary (x);
- putchar ('\n');
+ puts ("");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
mpfr_clear (x);
mpfr_clear (y);
exit (1);
@@ -294,9 +294,9 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Error in mpfr_set_str (5):\n");
mpfr_print_binary (x);
- putchar ('\n');
+ puts ("");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
mpfr_clear (x);
mpfr_clear (y);
exit (1);
@@ -311,9 +311,9 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Error in mpfr_set_str (6):\n");
mpfr_print_binary (x);
- putchar ('\n');
+ puts ("");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
mpfr_clear (x);
mpfr_clear (y);
exit (1);
@@ -328,9 +328,9 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Error in mpfr_set_str (7):\n");
mpfr_print_binary (x);
- putchar ('\n');
+ puts ("");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
mpfr_clear (x);
mpfr_clear (y);
exit (1);
@@ -368,14 +368,10 @@ main (int argc, char *argv[])
mpfr_get_str (str + 2, &exp, base[cbase],
nb_digit, x, rnd[crnd]);
- if (str[2] == '-')
- {
- str[0] = '-'; str[1] = '0'; str[2] = '.';
- }
- else
- {
- str[0] = '0'; str[1] = '.';
- }
+ str[0] = '-';
+ str[(str[2] == '-')] = '0';
+ str[(str[2] == '-') + 1] = '.';
+
for (str1 = str; *str1 != 0; str1++);
sprintf (str1, "@%i", (int) exp);
@@ -386,10 +382,10 @@ main (int argc, char *argv[])
fprintf (stderr, "Error in mpfr_set_str for nb_digit=%u, base=%u, rnd=%s:\n", nb_digit, base[cbase], mpfr_print_rnd_mode (rnd[crnd]));
fprintf (stderr, "instead of: ");
mpfr_print_binary (x);
- putchar ('\n');
+ puts ("");
fprintf (stderr, "return : ");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
}
}
diff --git a/tests/tsin_cos.c b/tests/tsin_cos.c
index e6fd5e6b2..8b4d48a4c 100644
--- a/tests/tsin_cos.c
+++ b/tests/tsin_cos.c
@@ -39,7 +39,7 @@ large_test (int prec, int N)
mpfr_set_d (x, 3.0, GMP_RNDN);
mpfr_sqrt (x, x, GMP_RNDN);
for (i=0; i<N; i++) mpfr_sin_cos (s, c, x, GMP_RNDN);
- mpfr_out_str (stdout, 10, 0, s, GMP_RNDN); putchar('\n');
+ mpfr_out_str (stdout, 10, 0, s, GMP_RNDN); puts ("");
mpfr_clear (x);
mpfr_clear (s);
mpfr_clear (c);
diff --git a/tests/tsqrt.c b/tests/tsqrt.c
index 5ae89e7ab..bd161faa3 100644
--- a/tests/tsqrt.c
+++ b/tests/tsqrt.c
@@ -68,8 +68,8 @@ check4 (double a, mp_rnd_t rnd_mode, char *Q)
{
printf("mpfr_sqrt failed for a=%1.20e, rnd_mode=%s\n",
a, mpfr_print_rnd_mode(rnd_mode));
- printf("expected "); mpfr_print_binary(res); putchar('\n');
- printf("got "); mpfr_print_binary(q); putchar('\n');
+ printf("expected "); mpfr_print_binary(res); puts ("");
+ printf("got "); mpfr_print_binary(q); puts ("");
mpfr_clear(q); mpfr_clear(res);
exit(1);
}
@@ -175,7 +175,7 @@ special (void)
if (mpfr_get_d1 (x) != 1.5)
{
fprintf (stderr, "Error: sqrt(1+ulp(1), up) should give 1.5 (prec=%u)\n", (unsigned) p);
- printf ("got "); mpfr_print_binary (x); putchar ('\n');
+ printf ("got "); mpfr_print_binary (x); puts ("");
exit (1);
}
}
@@ -243,7 +243,7 @@ check_inexact (mp_prec_t p)
printf ("x=");
mpfr_print_binary (x);
printf (" rnd=%s\n", mpfr_print_rnd_mode (rnd));
- printf ("y="); mpfr_print_binary (y); putchar ('\n');
+ printf ("y="); mpfr_print_binary (y); puts ("");
exit (1);
}
mpfr_clear (x);
diff --git a/tests/tsub.c b/tests/tsub.c
index 27b0acafb..ffff6e901 100644
--- a/tests/tsub.c
+++ b/tests/tsub.c
@@ -47,8 +47,8 @@ check_diverse (void)
if (mpfr_cmp (z, y))
{
fprintf (stderr, "Error in mpfr_sub (5)\n");
- printf ("expected "); mpfr_print_binary (y); putchar ('\n');
- printf ("got "); mpfr_print_binary (z); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (y); puts ("");
+ printf ("got "); mpfr_print_binary (z); puts ("");
exit (1);
}
@@ -60,8 +60,8 @@ check_diverse (void)
if (mpfr_cmp (z, y))
{
fprintf (stderr, "Error in mpfr_sub (7)\n");
- printf ("expected "); mpfr_print_binary (y); putchar ('\n');
- printf ("got "); mpfr_print_binary (z); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (y); puts ("");
+ printf ("got "); mpfr_print_binary (z); puts ("");
exit (1);
}
@@ -73,8 +73,8 @@ check_diverse (void)
if (mpfr_cmp (z, y))
{
fprintf (stderr, "Error in mpfr_sub (6)\n");
- printf ("expected "); mpfr_print_binary (y); putchar ('\n');
- printf ("got "); mpfr_print_binary (z); putchar ('\n');
+ printf ("expected "); mpfr_print_binary (y); puts ("");
+ printf ("got "); mpfr_print_binary (z); puts ("");
exit (1);
}
@@ -109,8 +109,8 @@ check_diverse (void)
if (mpfr_cmp (x, y))
{
fprintf (stderr, "Error in mpfr_sub (1 - 1E-33) with prec=33\n");
- printf ("Expected "); mpfr_print_binary (y); putchar ('\n');
- printf ("got "); mpfr_print_binary (x); putchar ('\n');
+ printf ("Expected "); mpfr_print_binary (y); puts ("");
+ printf ("got "); mpfr_print_binary (x); puts ("");
exit (1);
}
@@ -122,7 +122,7 @@ check_diverse (void)
if (mpfr_cmp_ui (x, 1))
{
fprintf (stderr, "Error in mpfr_sub (1 - 1E-33) with prec=32\n");
- printf ("Expected 1.0, got "); mpfr_print_binary (x); putchar ('\n');
+ printf ("Expected 1.0, got "); mpfr_print_binary (x); puts ("");
exit (1);
}
@@ -192,8 +192,8 @@ check_diverse (void)
mpfr_sub (z, x, y, GMP_RNDN);
if (mpfr_cmp (z, x)) {
fprintf (stderr, "mpfr_sub(z, x, y) failed for prec(x)=112, prec(y)=98\n");
- printf ("expected "); mpfr_print_binary (x); putchar('\n');
- printf ("got "); mpfr_print_binary (z); putchar('\n');
+ printf ("expected "); mpfr_print_binary (x); puts ("");
+ printf ("got "); mpfr_print_binary (z); puts ("");
exit (1);
}
@@ -270,8 +270,8 @@ bug_ddefour(void)
if (mpfr_cmp(ex2, ex3))
{
fprintf (stderr, "Error in ddefour test.\n");
- printf ("ex2="); mpfr_print_binary (ex2); putchar ('\n');
- printf ("ex3="); mpfr_print_binary (ex3); putchar ('\n');
+ printf ("ex2="); mpfr_print_binary (ex2); puts ("");
+ printf ("ex3="); mpfr_print_binary (ex3); puts ("");
exit (1);
}
@@ -312,11 +312,11 @@ check_two_sum (mp_prec_t p)
{
fprintf (stderr, "Wrong inexact flag for prec=%u, rnd=%s\n", (unsigned)p,
mpfr_print_rnd_mode (rnd));
- printf ("x="); mpfr_print_binary(x); putchar('\n');
- printf ("y="); mpfr_print_binary(y); putchar('\n');
- printf ("u="); mpfr_print_binary(u); putchar('\n');
- printf ("v="); mpfr_print_binary(v); putchar('\n');
- printf ("w="); mpfr_print_binary(w); putchar('\n');
+ 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 ("inexact = %d\n", inexact);
exit (1);
}
@@ -387,10 +387,10 @@ check_inexact (void)
fprintf (stderr, "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); putchar ('\n');
- printf ("u="); mpfr_print_binary (u); putchar ('\n');
- printf ("y= "); mpfr_print_binary (y); putchar ('\n');
- printf ("x-u="); mpfr_print_binary (z); putchar ('\n');
+ 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 ("");
exit (1);
}
}
diff --git a/tests/tsub_ui.c b/tests/tsub_ui.c
index c6e7e5998..532817c13 100644
--- a/tests/tsub_ui.c
+++ b/tests/tsub_ui.c
@@ -91,10 +91,10 @@ check_two_sum (mp_prec_t p)
fprintf (stderr, "Wrong inexact flag for prec=%u, rnd=%s\n", (unsigned)p,
mpfr_print_rnd_mode (rnd));
printf ("x=%u\n", x);
- printf ("y="); mpfr_print_binary(y); putchar('\n');
- printf ("u="); mpfr_print_binary(u); putchar('\n');
- printf ("v="); mpfr_print_binary(v); putchar('\n');
- printf ("w="); mpfr_print_binary(w); putchar('\n');
+ 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 ("inexact = %d\n", inexact);
exit (1);
}
diff --git a/tests/tui_div.c b/tests/tui_div.c
index 773638689..deacaf669 100644
--- a/tests/tui_div.c
+++ b/tests/tui_div.c
@@ -90,9 +90,9 @@ check_inexact (void)
fprintf (stderr, "Wrong inexact flag for u=%lu, rnd=%s\n", u,
mpfr_print_rnd_mode(rnd));
printf ("expected %d, got %d\n", cmp, inexact);
- printf ("x="); mpfr_print_binary (x); putchar ('\n');
- printf ("y="); mpfr_print_binary (y); putchar ('\n');
- printf ("y*x="); mpfr_print_binary (z); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ printf ("y*x="); mpfr_print_binary (z); puts ("");
exit (1);
}
}
diff --git a/tests/tui_pow.c b/tests/tui_pow.c
index fbde84e2f..35b836506 100644
--- a/tests/tui_pow.c
+++ b/tests/tui_pow.c
@@ -115,13 +115,13 @@ main (int argc, char *argv[])
mpfr_print_rnd_mode (rnd));
printf ("got ");
mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf ("expected ");
mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf ("approx ");
mpfr_print_binary (y);
- putchar ('\n');
+ puts ("");
exit (1);
}
compare2 = mpfr_cmp (t, y);
@@ -137,9 +137,9 @@ main (int argc, char *argv[])
{
fprintf (stderr, "Wrong inexact flag for rnd=%s: expected %d, got %d\n",
mpfr_print_rnd_mode (rnd), compare, inexact);
- printf ("x="); mpfr_print_binary (x); putchar ('\n');
- printf ("y="); mpfr_print_binary (y); putchar ('\n');
- printf ("t="); mpfr_print_binary (t); putchar ('\n');
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ printf ("t="); mpfr_print_binary (t); puts ("");
exit (1);
}
}
diff --git a/tests/tui_sub.c b/tests/tui_sub.c
index 9900bc253..231a228f5 100644
--- a/tests/tui_sub.c
+++ b/tests/tui_sub.c
@@ -182,10 +182,10 @@ check_two_sum (mp_prec_t p)
fprintf (stderr, "Wrong inexact flag for prec=%u, rnd=%s\n", (unsigned)p,
mpfr_print_rnd_mode (rnd));
printf ("x=%u\n", x);
- printf ("y="); mpfr_print_binary(y); putchar('\n');
- printf ("u="); mpfr_print_binary(u); putchar('\n');
- printf ("v="); mpfr_print_binary(v); putchar('\n');
- printf ("w="); mpfr_print_binary(w); putchar('\n');
+ 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 ("inexact = %d\n", inexact);
exit (1);
}
diff --git a/tests/tzeta.c b/tests/tzeta.c
index 255066a79..52ded9827 100644
--- a/tests/tzeta.c
+++ b/tests/tzeta.c
@@ -72,10 +72,10 @@ test_generic ()
mpfr_print_rnd_mode (rnd));
printf (" got ");
mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
- putchar ('\n');
+ puts ("");
printf (" expected ");
mpfr_out_str (stdout, 2, prec, y, GMP_RNDN);
- putchar ('\n');
+ puts ("");
exit (1);
}
}