From 19c496d4c55a5a5799cd64b2fcaeccfe1c740e83 Mon Sep 17 00:00:00 2001 From: daney Date: Wed, 24 Oct 2001 16:11:23 +0000 Subject: correct some bugs git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1341 280ebfd0-de03-0410-8827-d642c229c3f4 --- tanh.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'tanh.c') 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; } -- cgit v1.2.1