diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-02-14 23:05:51 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-02-14 23:05:51 +0000 |
commit | 6e5ffc68a8061e42a2680dd99455f89e2f4f8ca9 (patch) | |
tree | 3150eedf9dc6ae8d160042147ff46ac533e723dd /tests/ttanh.c | |
parent | f095a6c8a44a63379841097ddfbf4682e56e4036 (diff) | |
download | mpfr-6e5ffc68a8061e42a2680dd99455f89e2f4f8ca9.tar.gz |
new coverage tests
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2714 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/ttanh.c')
-rw-r--r-- | tests/ttanh.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/ttanh.c b/tests/ttanh.c index 15e6f5efd..2af3093d7 100644 --- a/tests/ttanh.c +++ b/tests/ttanh.c @@ -1,6 +1,6 @@ /* Test file for mpfr_tanh. -Copyright 2001, 2002, 2003 Free Software Foundation. +Copyright 2001, 2002, 2003, 2004 Free Software Foundation. Adapted from tarctan.c. This file is part of the MPFR Library. @@ -28,11 +28,40 @@ MA 02111-1307, USA. */ #define TEST_FUNCTION mpfr_tanh #include "tgeneric.c" +static void +special (void) +{ + mpfr_t x; + + mpfr_init (x); + + mpfr_set_nan (x); + mpfr_tanh (x, x, GMP_RNDN); + MPFR_ASSERTN(mpfr_nan_p (x)); + + mpfr_set_inf (x, 1); + mpfr_tanh (x, x, GMP_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0); + + mpfr_set_inf (x, -1); + mpfr_tanh (x, x, GMP_RNDN); + MPFR_ASSERTN(mpfr_cmp_si (x, -1) == 0); + + mpfr_set_prec (x, 10); + mpfr_set_str_binary (x, "-0.1001011001"); + mpfr_tanh (x, x, GMP_RNDN); + MPFR_ASSERTN(mpfr_cmp_si_2exp (x, -135, -8) == 0); + + mpfr_clear (x); +} + int main (int argc, char *argv[]) { tests_start_mpfr (); + special (); + test_generic (2, 100, 100); tests_end_mpfr (); |