diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-05-13 11:41:39 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-05-13 11:41:39 +0000 |
commit | 5b028b20d51c6229fd5f9eeed94ee953032d35cf (patch) | |
tree | 3c1189b5042997b8753b191f12b57ed3814d137e /tanh.c | |
parent | f621c4664ae6c2fd29da01cd6b39ee6d1efc3f56 (diff) | |
download | mpfr-5b028b20d51c6229fd5f9eeed94ee953032d35cf.tar.gz |
Add support for FAST_COMPUTE_IS_SMALL_INPUT.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3552 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tanh.c')
-rw-r--r-- | tanh.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -38,7 +38,7 @@ mpfr_tanh (mpfr_ptr y, mpfr_srcptr xt , mp_rnd_t rnd_mode) { if (MPFR_IS_NAN (xt)) { - MPFR_SET_NAN (y); + MPFR_SET_NAN (y); MPFR_RET_NAN; } else if (MPFR_IS_INF (xt)) @@ -54,10 +54,13 @@ mpfr_tanh (mpfr_ptr y, mpfr_srcptr xt , mp_rnd_t rnd_mode) MPFR_RET (0); } } - + + /* tanh(x) = x - x^3/3 + ... so the error is < 2^(3*EXP(x)-1) */ + MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, xt, -2*MPFR_GET_EXP(xt)+1,0,rnd_mode, ); + MPFR_SAVE_EXPO_MARK (expo); MPFR_TMP_INIT_ABS (x, xt); - + /* General case */ { /* Declaration of the intermediary variable */ |