summaryrefslogtreecommitdiff
path: root/tanh.c
diff options
context:
space:
mode:
authordaney <daney@280ebfd0-de03-0410-8827-d642c229c3f4>2001-10-24 16:11:23 +0000
committerdaney <daney@280ebfd0-de03-0410-8827-d642c229c3f4>2001-10-24 16:11:23 +0000
commit19c496d4c55a5a5799cd64b2fcaeccfe1c740e83 (patch)
treef7d419a722b1a53e928acedbb1a779640e3eca98 /tanh.c
parentc0fe53054d517b8d18a156cfbb9d6b5bf0da2381 (diff)
downloadmpfr-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.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/tanh.c b/tanh.c
index 9ff5420f7..d30f18b4a 100644
--- a/tanh.c
+++ b/tanh.c
@@ -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;
}