diff options
author | hanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-11-21 15:21:39 +0000 |
---|---|---|
committer | hanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-11-21 15:21:39 +0000 |
commit | 01b2aebd57955fa9514550221f25cb684a792d85 (patch) | |
tree | fafb151cbbdfb4ab3394ca5ba1f8b1cfa3a2bc4c /tests/tcmp.c | |
parent | ebb0a24940eb551ce03eb361910c423fee7d6499 (diff) | |
download | mpfr-01b2aebd57955fa9514550221f25cb684a792d85.tar.gz |
Infinis, premiere tentative (tests)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@794 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tcmp.c')
-rw-r--r-- | tests/tcmp.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/tcmp.c b/tests/tcmp.c index 002a77e1d..0efc9d83b 100644 --- a/tests/tcmp.c +++ b/tests/tcmp.c @@ -27,6 +27,9 @@ MA 02111-1307, USA. */ #include "mpfr.h" #include "mpfr-impl.h" +#define Infp 1/0. +#define Infm -1/0. + extern int isnan(); int main() @@ -63,6 +66,38 @@ int main() exit(1); } + mpfr_set_d(xx, Infp, GMP_RNDN); + mpfr_set_d(yy, -23489745.0329, GMP_RNDN); + if (mpfr_cmp(xx, yy) <= 0) { + fprintf(stderr, + "Error in mpfr_cmp(Infp, 23489745.0329), gives %d\n", mpfr_cmp(xx, yy)); + exit(1); + } + + mpfr_set_d(xx, Infp, GMP_RNDN); + mpfr_set_d(yy, Infm, GMP_RNDN); + if (mpfr_cmp(xx, yy) <= 0) { + fprintf(stderr, + "Error in mpfr_cmp(Infp, Infm), gives %d\n", mpfr_cmp(xx, yy)); + exit(1); + } + + mpfr_set_d(xx, Infm, GMP_RNDN); + mpfr_set_d(yy, Infp, GMP_RNDN); + if (mpfr_cmp(xx, yy) >= 0) { + fprintf(stderr, + "Error in mpfr_cmp(Infm, Infp), gives %d\n", mpfr_cmp(xx, yy)); + exit(1); + } + + mpfr_set_d(xx, Infm, GMP_RNDN); + mpfr_set_d(yy, 2346.09234, GMP_RNDN); + if (mpfr_cmp(xx, yy) >= 0) { + fprintf(stderr, + "Error in mpfr_cmp(Infm, 2346.09234), gives %d\n", mpfr_cmp(xx, yy)); + exit(1); + } + for (i=0;i<1000000;) { x=drand(); y=drand(); if (!isnan(x) && !isnan(y)) { i++; |