diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-09-29 13:58:06 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-09-29 13:58:06 +0000 |
commit | f2af580a8d5f41bc8fdebf7209c5a2959c83efc6 (patch) | |
tree | 049b34ab0e842b44e5d327a40a5001379d86c0fd /tests/tcmp_ui.c | |
parent | f70d2f99fa9a99f09e1f9f602efe5930c079cee6 (diff) | |
download | mpfr-f2af580a8d5f41bc8fdebf7209c5a2959c83efc6.tar.gz |
cmp(x,y) if x=NAN or y=NAN returns 0 and erange flag.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3010 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tcmp_ui.c')
-rw-r--r-- | tests/tcmp_ui.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/tcmp_ui.c b/tests/tcmp_ui.c index a5c83518d..819bf4649 100644 --- a/tests/tcmp_ui.c +++ b/tests/tcmp_ui.c @@ -27,7 +27,10 @@ MA 02111-1307, USA. */ int main (void) { - mpfr_t x; unsigned long i; long s; + mpfr_t x; + unsigned long i; + long s; + int c; tests_start_mpfr (); @@ -123,6 +126,23 @@ main (void) /* now EXP(x)=BITS_PER_MP_LIMB */ MPFR_ASSERTN(mpfr_cmp_si (x, 1) > 0); + /* Check NAN */ + mpfr_set_nan (x); + mpfr_clear_erangeflag (); + c = mpfr_cmp_ui (x, 12); + if (c != 0 || !mpfr_erangeflag_p () ) + { + printf ("NAN error (1)\n"); + exit (1); + } + mpfr_clear_erangeflag (); + c = mpfr_cmp_si (x, -12); + if (c != 0 || !mpfr_erangeflag_p () ) + { + printf ("NAN error (2)\n"); + exit (1); + } + mpfr_clear (x); tests_end_mpfr (); |