summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2006-10-25 17:49:57 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2006-10-25 17:49:57 +0000
commite2748856b898f29b86815d34982ff34a452655e5 (patch)
tree5d0c8301758d9fc0f4c56edd77a0135086c02afa /tests
parent8e11845df8d98488067a7a612573b2fd1ff8cd9b (diff)
downloadmpfr-e2748856b898f29b86815d34982ff34a452655e5.tar.gz
fixed overflow/underflow problems in csch and sech
fixed problem for huge argument in coth git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4161 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r--tests/tcoth.c28
-rw-r--r--tests/tcsch.c16
-rw-r--r--tests/tsech.c16
3 files changed, 60 insertions, 0 deletions
diff --git a/tests/tcoth.c b/tests/tcoth.c
index 94605256d..1fef81189 100644
--- a/tests/tcoth.c
+++ b/tests/tcoth.c
@@ -98,6 +98,34 @@ check_bugs (void)
exit (1);
}
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+ mpfr_set_str (x, "18.368400284838550", 10, GMP_RNDN);
+ mpfr_set_str (y, "1.0000000000000002", 10, GMP_RNDN);
+ mpfr_coth (x, x, GMP_RNDN);
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error for coth(18.368400284838550)\n");
+ exit (1);
+ }
+
+ mpfr_set_str (x, "18.714973875118520", 10, GMP_RNDN);
+ mpfr_coth (x, x, GMP_RNDN);
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error for coth(18.714973875118520)\n");
+ exit (1);
+ }
+
+ mpfr_set_str (x, "18.714973875118524", 10, GMP_RNDN);
+ mpfr_coth (x, x, GMP_RNDN);
+ if (mpfr_cmp_ui (x, 1) != 0)
+ {
+ printf ("Error for coth(18.714973875118524)\n");
+ exit (1);
+ }
+
mpfr_clear (x);
mpfr_clear (y);
}
diff --git a/tests/tcsch.c b/tests/tcsch.c
index 172625488..271666518 100644
--- a/tests/tcsch.c
+++ b/tests/tcsch.c
@@ -75,6 +75,22 @@ check_specials (void)
exit (1);
}
+ /* check huge x */
+ mpfr_set_str (x, "8e8", 10, GMP_RNDN);
+ mpfr_csch (y, x, GMP_RNDN);
+ if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0))
+ {
+ printf ("Error: csch(8e8) != +0\n");
+ exit (1);
+ }
+ mpfr_set_str (x, "-8e8", 10, GMP_RNDN);
+ mpfr_csch (y, x, GMP_RNDN);
+ if (! (mpfr_zero_p (y) && MPFR_SIGN (y) < 0))
+ {
+ printf ("Error: csch(-8e8) != -0\n");
+ exit (1);
+ }
+
mpfr_clear (x);
mpfr_clear (y);
}
diff --git a/tests/tsech.c b/tests/tsech.c
index 3a585763e..623def916 100644
--- a/tests/tsech.c
+++ b/tests/tsech.c
@@ -75,6 +75,22 @@ check_specials (void)
exit (1);
}
+ /* check huge x */
+ mpfr_set_str (x, "8e8", 10, GMP_RNDN);
+ mpfr_sech (y, x, GMP_RNDN);
+ if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0))
+ {
+ printf ("Error: sech(8e8) != +0\n");
+ exit (1);
+ }
+ mpfr_set_str (x, "-8e8", 10, GMP_RNDN);
+ mpfr_sech (y, x, GMP_RNDN);
+ if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0))
+ {
+ printf ("Error: sech(-8e8) != +0\n");
+ exit (1);
+ }
+
mpfr_clear (x);
mpfr_clear (y);
}