diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2008-04-07 09:13:52 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2008-04-07 09:13:52 +0000 |
commit | e2075f6f36e1d6f1c1a4a9e3d49783c509089048 (patch) | |
tree | 8f75cabcfb4eebab505afffdbebb8626923f4690 /tests/tcmp.c | |
parent | 09a9b7730daf92039614e0a71640c4744570ca77 (diff) | |
download | mpfr-e2075f6f36e1d6f1c1a4a9e3d49783c509089048.tar.gz |
tcmp.c: fixed some tests (if mpfr_cmp2 returns an incorrect result,
the bug may be some non-reproducible behavior, so don't compute it
a second time to say what the value was!) and clean-up.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5350 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tcmp.c')
-rw-r--r-- | tests/tcmp.c | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/tests/tcmp.c b/tests/tcmp.c index 749c4bf90..7bfde9523 100644 --- a/tests/tcmp.c +++ b/tests/tcmp.c @@ -54,7 +54,7 @@ main (void) mpfr_set_str_binary(xx, "0.10011010101000110101010000000011001001001110001011101011111011101E623"); mpfr_set_str_binary(yy, "0.10011010101000110101010000000011001001001110001011101011111011100E623"); p = 0; - if (mpfr_cmp2(xx, yy, &p) <= 0 || p != 64) + if (mpfr_cmp2 (xx, yy, &p) <= 0 || p != 64) { printf ("Error (1) in mpfr_cmp2\n"); exit (1); @@ -62,7 +62,7 @@ main (void) mpfr_set_str_binary(xx, "0.10100010001110110111000010001000010011111101000100011101000011100"); mpfr_set_str_binary(yy, "0.10100010001110110111000010001000010011111101000100011101000011011"); p = 0; - if (mpfr_cmp2(xx, yy, &p) <= 0 || p != 64) + if (mpfr_cmp2 (xx, yy, &p) <= 0 || p != 64) { printf ("Error (2) in mpfr_cmp2\n"); exit (1); @@ -100,74 +100,72 @@ main (void) /* bug found by Gerardo Ballabio */ mpfr_set_ui(xx, 0, GMP_RNDN); mpfr_set_str (yy, "0.1", 10, GMP_RNDN); - if (mpfr_cmp(xx, yy) >= 0) + if ((c = mpfr_cmp (xx, yy)) >= 0) { - printf ("Error in mpfr_cmp(0.0, 0.1), gives %d\n", mpfr_cmp(xx, yy)); + printf ("Error in mpfr_cmp(0.0, 0.1), gives %d\n", c); exit (1); } mpfr_set_inf (xx, 1); mpfr_set_str (yy, "-23489745.0329", 10, GMP_RNDN); - if (mpfr_cmp(xx, yy) <= 0) + if ((c = mpfr_cmp (xx, yy)) <= 0) { - printf ("Error in mpfr_cmp(Infp, 23489745.0329), gives %d\n", - mpfr_cmp(xx, yy)); + printf ("Error in mpfr_cmp(Infp, 23489745.0329), gives %d\n", c); exit (1); } mpfr_set_inf (xx, 1); mpfr_set_inf (yy, -1); - if (mpfr_cmp(xx, yy) <= 0) + if ((c = mpfr_cmp (xx, yy)) <= 0) { - printf ("Error in mpfr_cmp(Infp, Infm), gives %d\n", mpfr_cmp(xx, yy)); + printf ("Error in mpfr_cmp(Infp, Infm), gives %d\n", c); exit (1); } mpfr_set_inf (xx, -1); mpfr_set_inf (yy, 1); - if (mpfr_cmp(xx, yy) >= 0) + if ((c = mpfr_cmp (xx, yy)) >= 0) { - printf ("Error in mpfr_cmp(Infm, Infp), gives %d\n", mpfr_cmp(xx, yy)); + printf ("Error in mpfr_cmp(Infm, Infp), gives %d\n", c); exit (1); } mpfr_set_inf (xx, 1); mpfr_set_inf (yy, 1); - if (mpfr_cmp(xx, yy) != 0) + if ((c = mpfr_cmp (xx, yy)) != 0) { - printf ("Error in mpfr_cmp(Infp, Infp), gives %d\n", mpfr_cmp(xx, yy)); + printf ("Error in mpfr_cmp(Infp, Infp), gives %d\n", c); exit (1); } mpfr_set_inf (xx, -1); mpfr_set_inf (yy, -1); - if (mpfr_cmp(xx, yy) != 0) + if ((c = mpfr_cmp (xx, yy)) != 0) { - printf ("Error in mpfr_cmp(Infm, Infm), gives %d\n", mpfr_cmp(xx, yy)); + printf ("Error in mpfr_cmp(Infm, Infm), gives %d\n", c); exit (1); } mpfr_set_inf (xx, -1); mpfr_set_str (yy, "2346.09234", 10, GMP_RNDN); - if (mpfr_cmp(xx, yy) >= 0) + if ((c = mpfr_cmp (xx, yy)) >= 0) { - printf ("Error in mpfr_cmp(Infm, 2346.09234), gives %d\n", - mpfr_cmp(xx, yy)); + printf ("Error in mpfr_cmp(Infm, 2346.09234), gives %d\n", c); exit (1); } mpfr_set_ui (xx, 0, GMP_RNDN); mpfr_set_ui (yy, 1, GMP_RNDN); - if ((i = mpfr_cmp3 (xx, yy, 1)) >= 0) + if ((c = mpfr_cmp3 (xx, yy, 1)) >= 0) { - printf ("Error: mpfr_cmp3 (0, 1, 1) gives %ld instead of" - " a negative value\n", i); + printf ("Error: mpfr_cmp3 (0, 1, 1) gives %d instead of" + " a negative value\n", c); exit (1); } - if ((i = mpfr_cmp3 (xx, yy, -1)) <= 0) + if ((c = mpfr_cmp3 (xx, yy, -1)) <= 0) { - printf ("Error: mpfr_cmp3 (0, 1, -1) gives %ld instead of" - " a positive value\n", i); + printf ("Error: mpfr_cmp3 (0, 1, -1) gives %d instead of" + " a positive value\n", c); exit (1); } |