summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/tcosh.c32
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);