diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-05-05 15:10:43 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-05-05 15:10:43 +0000 |
commit | b014c2c809c91ed02d4ead819c4729dc91e5725c (patch) | |
tree | eb93a531ea209e7754b990b75b216d40bdfa7ddf /tests/ttanh.c | |
parent | d63890a4106e33f0ca5537feda1b409e379eb204 (diff) | |
download | mpfr-b014c2c809c91ed02d4ead819c4729dc91e5725c.tar.gz |
Fix a bug in cas of overflow in tanh.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2901 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/ttanh.c')
-rw-r--r-- | tests/ttanh.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ttanh.c b/tests/ttanh.c index 2af3093d7..f8bed846f 100644 --- a/tests/ttanh.c +++ b/tests/ttanh.c @@ -55,11 +55,38 @@ special (void) mpfr_clear (x); } +static void +special_overflow (void) +{ + mpfr_t x, y; + + mpfr_set_emin (-125); + mpfr_set_emax (128); + + mpfr_init2 (x, 24); + mpfr_init2 (y, 24); + + mpfr_set_str_binary (x, "0.101100100000000000110100E7"); + mpfr_tanh (y, x, GMP_RNDN); + if (mpfr_cmp_ui (y, 1)) + { + printf("Overflow error.\n"); + mpfr_dump (y); + exit (1); + } + + mpfr_clear (y); + mpfr_clear (x); + mpfr_set_emin (MPFR_EMIN_MIN); + mpfr_set_emax (MPFR_EMAX_MAX); +} + int main (int argc, char *argv[]) { tests_start_mpfr (); + special_overflow (); special (); test_generic (2, 100, 100); |