summaryrefslogtreecommitdiff
path: root/tests/teq.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/teq.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/teq.c')
-rw-r--r--tests/teq.c66
1 files changed, 37 insertions, 29 deletions
diff --git a/tests/teq.c b/tests/teq.c
index 13a2d9f4a..6ccae2b21 100644
--- a/tests/teq.c
+++ b/tests/teq.c
@@ -26,42 +26,50 @@ MA 02111-1307, USA. */
#include "mpfr-impl.h"
#include "mpfr-test.h"
-void special _PROTO ((void));
-
static void
teq (mpfr_t x)
{
- mpfr_t y; long k, px, mx;
+ mpfr_t y;
+ long k, px, mx;
- mpfr_init2(y, MPFR_PREC(x));
+ mpfr_init2(y, MPFR_PREC(x));
- mx = (MPFR_PREC(x) - 1)/mp_bits_per_limb;
- px = mp_bits_per_limb - 2;
+ mx = (MPFR_PREC(x) - 1)/mp_bits_per_limb;
+ px = mp_bits_per_limb - 2;
for (k = 2; k < MPFR_PREC(x); k++)
{
- mpfr_set(y, x, GMP_RNDN);
-
- MPFR_MANT(y) [mx] ^= (mp_limb_t) 1 << px;
-
- if (mpfr_eq(y, x, k) ||
- !mpfr_eq(y, x, k - 1))
- {
- fprintf(stderr, "Error in eq.\n");
- printf("x = "); mpfr_print_binary(x); printf("\n");
- printf("y = "); mpfr_print_binary(y); printf("\n");
- printf("k = %ld\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));
- mpfr_clear(x); mpfr_clear(y);
- exit(-1);
- }
-
- if (px) { --px; } else { --mx; px = mp_bits_per_limb - 1; }
+ mpfr_set(y, x, GMP_RNDN);
+
+ MPFR_MANT(y) [mx] ^= (mp_limb_t) 1 << px;
+
+ 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 ("k = %ld\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));
+ mpfr_clear (x); mpfr_clear (y);
+ exit (1);
+ }
+
+ if (px)
+ {
+ --px;
+ }
+ else
+ {
+ --mx;
+ px = mp_bits_per_limb - 1;
+ }
}
- mpfr_clear(y);
+ mpfr_clear(y);
}
-void
+static void
special (void)
{
mpfr_t x, y, z;
@@ -86,7 +94,7 @@ special (void)
if (error)
{
- fprintf (stderr, "Error in mpfr_eq (1, 1+1e-1000)\n");
+ printf ("Error in mpfr_eq (1, 1+1e-1000)\n");
exit (1);
}
@@ -98,19 +106,19 @@ special (void)
int
main (void)
{
- int j; mpfr_t x;
+ int j; mpfr_t x;
tests_start_mpfr ();
special ();
- mpfr_init2 (x, 1000);
+ mpfr_init2 (x, 1000);
for (j=0;j<1000;j++) {
mpfr_random (x);
teq (x);
}
- mpfr_clear (x);
+ mpfr_clear (x);
tests_end_mpfr ();
return 0;