diff options
author | daney <daney@280ebfd0-de03-0410-8827-d642c229c3f4> | 2001-10-24 16:11:23 +0000 |
---|---|---|
committer | daney <daney@280ebfd0-de03-0410-8827-d642c229c3f4> | 2001-10-24 16:11:23 +0000 |
commit | 19c496d4c55a5a5799cd64b2fcaeccfe1c740e83 (patch) | |
tree | f7d419a722b1a53e928acedbb1a779640e3eca98 /tanh.c | |
parent | c0fe53054d517b8d18a156cfbb9d6b5bf0da2381 (diff) | |
download | mpfr-19c496d4c55a5a5799cd64b2fcaeccfe1c740e83.tar.gz |
correct some bugs
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1341 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tanh.c')
-rw-r--r-- | tanh.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -94,7 +94,7 @@ mpfr_tanh (y, xt, rnd_mode) mp_prec_t Ny = MPFR_PREC(y); /* Precision of input variable */ mp_prec_t Nt; /* Precision of the intermediary variable */ - mp_prec_t err; /* Precision of error */ + long int err; /* Precision of error */ /* compute the precision of intermediary variable */ Nt=MAX(Nx,Ny); @@ -129,15 +129,12 @@ mpfr_tanh (y, xt, rnd_mode) d = MPFR_EXP(te)-MPFR_EXP(t); /* estimation of the error */ - if ((int)(Nt) < (int) (_mpfr_ceil_log2(7+pow(2,d+1))) ) - err = 0; - else - err = Nt-(_mpfr_ceil_log2(7+pow(2,d+1))); + err = Nt-(_mpfr_ceil_log2(7+pow(2,d+1))); /* actualisation of the precision */ Nt += 10; - } while (!mpfr_can_round(t,err,GMP_RNDN,rnd_mode,Ny)); + } while ((err <0)||!mpfr_can_round(t,err,GMP_RNDN,rnd_mode,Ny)); if (flag_neg==1) MPFR_CHANGE_SIGN(t); @@ -148,6 +145,7 @@ mpfr_tanh (y, xt, rnd_mode) mpfr_clear(ta); mpfr_clear(tb); } + mpfr_clear(x); return inexact; } |