summaryrefslogtreecommitdiff
path: root/tests/tcmp.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2000-12-01 14:58:32 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2000-12-01 14:58:32 +0000
commitc3a6ff25fa82fce1400baecaaccd5328bb51895e (patch)
treed3e22d6359e589761ebd97d4f0524249feaa9892 /tests/tcmp.c
parent0ea08f43d4ea2c2568c569ad43df76dabd7d149e (diff)
downloadmpfr-c3a6ff25fa82fce1400baecaaccd5328bb51895e.tar.gz
fixed bug in mpfr_cmp3 (when b=0, s not taken into account)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@820 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tcmp.c')
-rw-r--r--tests/tcmp.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/tcmp.c b/tests/tcmp.c
index c31a2e967..cdaae6b74 100644
--- a/tests/tcmp.c
+++ b/tests/tcmp.c
@@ -34,7 +34,9 @@ extern int isnan();
int main()
{
- double x,y; mpfr_t xx,yy; int i,c;
+ double x, y;
+ mpfr_t xx, yy;
+ int i, c;
mpfr_init2(xx, 65); mpfr_init2(yy, 65);
mpfr_set_str_raw(xx, "0.10011010101000110101010000000011001001001110001011101011111011101E623");
@@ -98,6 +100,17 @@ int main()
exit(1);
}
+ mpfr_set_d (xx, 0.0, GMP_RNDN);
+ mpfr_set_d (yy, 1.0, GMP_RNDN);
+ if (i = mpfr_cmp3 (xx, yy, 1) >= 0) {
+ fprintf (stderr, "Error: mpfr_cmp3 (0, 1, 1) gives %d instead of a negative value\n", i);
+ exit (1);
+ }
+ if (i = mpfr_cmp3 (xx, yy, -1) <= 0) {
+ fprintf (stderr, "Error: mpfr_cmp3 (0, 1, -1) gives %d instead of a positive value\n", i);
+ exit (1);
+ }
+
for (i=0;i<1000000;) { x=drand(); y=drand();
if (!isnan(x) && !isnan(y)) {
i++;
@@ -110,6 +123,7 @@ int main()
}
}
}
+
mpfr_clear(xx); mpfr_clear(yy);
return 0;
}