summaryrefslogtreecommitdiff
path: root/tests/tmul_ui.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2003-09-25 08:15:42 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2003-09-25 08:15:42 +0000
commitfd5e5221f3d42f1d1e29d99a15ac43a76460bf9b (patch)
tree332aef339e58cafd2dc32ee33efc6e2cbb66852a /tests/tmul_ui.c
parent788b255e420f8d4ba0f0b43ce87b00b62d60a896 (diff)
downloadmpfr-fd5e5221f3d42f1d1e29d99a15ac43a76460bf9b.tar.gz
Changed the remaining stderr to stdout.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2449 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tmul_ui.c')
-rw-r--r--tests/tmul_ui.c73
1 files changed, 37 insertions, 36 deletions
diff --git a/tests/tmul_ui.c b/tests/tmul_ui.c
index 30111acce..cafef1614 100644
--- a/tests/tmul_ui.c
+++ b/tests/tmul_ui.c
@@ -43,31 +43,32 @@ check_inexact (mp_prec_t p)
u = randlimb ();
if (mpfr_mul_ui (z, x, u, GMP_RNDN))
{
- fprintf (stderr, "Error: result should be exact\n");
+ printf ("Error: result should be exact\n");
exit (1);
}
for (q=2; q<=p; q++)
for (rnd=0; rnd<4; rnd++)
{
- mpfr_set_prec (y, q);
- inexact = mpfr_mul_ui (y, x, u, rnd);
- cmp = mpfr_cmp (y, z);
- if (((inexact == 0) && (cmp != 0)) ||
- ((inexact < 0) && (cmp >= 0)) ||
- ((inexact > 0) && (cmp <= 0)))
- {
- fprintf (stderr, "Wrong inexact flag for p=%u, q=%u, rnd=%s\n",
- (unsigned) p, (unsigned) q, mpfr_print_rnd_mode (rnd));
- exit (1);
- }
+ mpfr_set_prec (y, q);
+ inexact = mpfr_mul_ui (y, x, u, rnd);
+ cmp = mpfr_cmp (y, z);
+ if (((inexact == 0) && (cmp != 0)) ||
+ ((inexact < 0) && (cmp >= 0)) ||
+ ((inexact > 0) && (cmp <= 0)))
+ {
+ printf ("Wrong inexact flag for p=%u, q=%u, rnd=%s\n",
+ (unsigned int) p, (unsigned int) q,
+ mpfr_print_rnd_mode (rnd));
+ exit (1);
+ }
}
mpfr_set_prec (x, 2);
mpfr_set_ui (x, 1, GMP_RNDN);
if (mpfr_mul_ui (x, x, 5, GMP_RNDZ) == 0)
{
- fprintf (stderr, "mul_ui(1, 5) cannot be exact with prec=2\n");
+ printf ("mul_ui(1, 5) cannot be exact with prec=2\n");
exit (1);
}
@@ -88,7 +89,7 @@ main (int argc, char *argv[])
for (p=2; p<100; p++)
for (i=1; i<50; i++)
check_inexact (p);
-
+
mpfr_init2 (x, 53);
mpfr_init2 (y, 53);
@@ -97,12 +98,12 @@ main (int argc, char *argv[])
mpfr_mul_ui (x, y, 1, GMP_RNDZ);
if (MPFR_MANT(x)[MPFR_PREC(x)/mp_bits_per_limb] >> (mp_bits_per_limb-1) == 0)
{
- fprintf (stderr, "Error in mpfr_mul_ui: result not normalized\n");
+ printf ("Error in mpfr_mul_ui: result not normalized\n");
exit (1);
}
if (mpfr_cmp (x, y))
{
- fprintf (stderr, "Error in mpfr_mul_ui: 1*y != y\n");
+ 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 ("");
exit (1);
@@ -112,7 +113,7 @@ main (int argc, char *argv[])
mpfr_mul_ui (x, x, 3, GMP_RNDU);
if (!mpfr_inf_p (x) || (mpfr_sgn (x) <= 0))
{
- fprintf (stderr, "Error in mpfr_mul_ui: +Inf*3 does not give +Inf\n");
+ printf ("Error in mpfr_mul_ui: +Inf*3 does not give +Inf\n");
exit (1);
}
@@ -120,7 +121,7 @@ main (int argc, char *argv[])
mpfr_mul_ui (x, x, 3, GMP_RNDU);
if (!mpfr_inf_p (x) || (mpfr_sgn (x) >= 0))
{
- fprintf (stderr, "Error in mpfr_mul_ui: -Inf*3 does not give -Inf\n");
+ printf ("Error in mpfr_mul_ui: -Inf*3 does not give -Inf\n");
exit (1);
}
@@ -128,7 +129,7 @@ main (int argc, char *argv[])
mpfr_mul_ui (x, x, 3, GMP_RNDU);
if (!mpfr_nan_p(x))
{
- fprintf (stderr, "Error in mpfr_mul_ui: NaN*3 does not give NaN\n");
+ printf ("Error in mpfr_mul_ui: NaN*3 does not give NaN\n");
exit (1);
}
@@ -136,7 +137,7 @@ main (int argc, char *argv[])
mpfr_mul_ui (x, x, 3, GMP_RNDU);
if (mpfr_get_d1 (x) != 1.0)
{
- fprintf (stderr, "Error in mpfr_mul_ui: U(Z(1/3)*3) does not give 1\n");
+ printf ("Error in mpfr_mul_ui: U(Z(1/3)*3) does not give 1\n");
exit (1);
}
@@ -146,7 +147,7 @@ main (int argc, char *argv[])
mpfr_mul_ui(x, y, 4, GMP_RNDZ);
if (mpfr_cmp_ui(x, 0) <= 0)
{
- fprintf(stderr, "Error in mpfr_mul_ui: 4*3.0 does not give a positive result:\n");
+ printf("Error in mpfr_mul_ui: 4*3.0 does not give a positive result:\n");
mpfr_print_binary(x); puts ("");
printf("mpfr_cmp_ui(x, 0) = %d\n", mpfr_cmp_ui(x, 0));
exit(1);
@@ -159,7 +160,7 @@ main (int argc, char *argv[])
mpfr_set_str_raw (y, "0.101100001E19"); /* 361472 */
if (mpfr_cmp (x, y))
{
- fprintf (stderr, "Error in mul_ui for 1335*(0.100001111E9)\n");
+ printf ("Error in mul_ui for 1335*(0.100001111E9)\n");
printf ("got "); mpfr_print_binary (x); puts ("");
exit(1);
}
@@ -192,7 +193,7 @@ main (int argc, char *argv[])
printf ("Error for 6 * 120\n");
exit (1);
}
-
+
mpfr_set_prec (x, 68);
mpfr_set_prec (y, 64);
mpfr_set_d (x, 2143861251406875.0, GMP_RNDN);
@@ -205,24 +206,25 @@ main (int argc, char *argv[])
printf ("got "); mpfr_print_binary (y); puts ("");
exit (1);
}
-
+
for (xprec = 53; xprec <= 128; xprec++)
{
mpfr_set_prec (x, xprec);
mpfr_set_str_raw (x, "0.1100100100001111110011111000000011011100001100110111E2");
for (yprec = 53; yprec <= 128; yprec++)
- {
- mpfr_set_prec (y, yprec);
- mpfr_mul_ui (y, x, 1, GMP_RNDN);
- 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); puts ("");
- printf ("got "); mpfr_print_binary (y); puts ("");
- exit (1);
- }
- }
+ {
+ mpfr_set_prec (y, yprec);
+ mpfr_mul_ui (y, x, 1, GMP_RNDN);
+ if (mpfr_get_d1 (x) != mpfr_get_d1 (y))
+ {
+ 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 ("");
+ exit (1);
+ }
+ }
}
mpfr_set_prec (x, 128);
@@ -236,7 +238,6 @@ main (int argc, char *argv[])
printf ("Error for 17 * ULONG_HIGHBIT\n");
exit (1);
}
-
mpfr_clear(x); mpfr_clear(y);