diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-05-18 08:22:55 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-05-18 08:22:55 +0000 |
commit | 6ce84039a34830e8841936c370539b5e01386e79 (patch) | |
tree | 73ef169251ea14a30662f3ed220be13116dacf45 /tests/tcosh.c | |
parent | a2ac43cf79fb45c4dada0fc9880a184ac32b3878 (diff) | |
download | mpfr-6ce84039a34830e8841936c370539b5e01386e79.tar.gz |
Fix bug of overflow.
Fix bug of ternary value in case of overflow.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3585 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tcosh.c')
-rw-r--r-- | tests/tcosh.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/tcosh.c b/tests/tcosh.c index 74b138a7b..8f953adb3 100644 --- a/tests/tcosh.c +++ b/tests/tcosh.c @@ -32,6 +32,7 @@ static void special (void) { mpfr_t x, y; + int i; mpfr_init (x); mpfr_init (y); @@ -95,7 +96,36 @@ special (void) { printf ("Error: mpfr_cosh for prec=32 (2)\n"); exit (1); - } + } + + mpfr_set_prec (x, 2); + mpfr_clear_flags (); + mpfr_set_str_binary (x, "1E1000000000"); + i = mpfr_cosh (x, x, GMP_RNDN); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (mpfr_overflow_p ()); + MPFR_ASSERTN (i == 1); + + mpfr_clear_flags (); + mpfr_set_str_binary (x, "-1E1000000000"); + i = mpfr_cosh (x, x, GMP_RNDN); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); + MPFR_ASSERTN (i == 1); + + mpfr_clear_flags (); + mpfr_set_str_binary (x, "-1E1000000000"); + i = mpfr_cosh (x, x, GMP_RNDD); + MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); + MPFR_ASSERTN (i == -1); + + mpfr_clear_flags (); + mpfr_set_str_binary (x, "-1E1000000000"); + i = mpfr_cosh (x, x, GMP_RNDU); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); + MPFR_ASSERTN (i == 1); mpfr_clear (x); mpfr_clear (y); |