From bab5aab404897a12fe1c87734ebf2aa270b9b73b Mon Sep 17 00:00:00 2001 From: vlefevre Date: Thu, 18 Aug 2005 16:35:19 +0000 Subject: Converted tabs to spaces with expand. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3725 280ebfd0-de03-0410-8827-d642c229c3f4 --- log2.c | 58 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'log2.c') diff --git a/log2.c b/log2.c index f31b2e44e..efcd61ffc 100644 --- a/log2.c +++ b/log2.c @@ -35,33 +35,33 @@ mpfr_log2 (mpfr_ptr r, mpfr_srcptr a, mp_rnd_t rnd_mode) { /* If a is NaN, the result is NaN */ if (MPFR_IS_NAN (a)) - { - MPFR_SET_NAN (r); - MPFR_RET_NAN; - } + { + MPFR_SET_NAN (r); + MPFR_RET_NAN; + } /* check for infinity before zero */ else if (MPFR_IS_INF (a)) - { - if (MPFR_IS_NEG (a)) - /* log(-Inf) = NaN */ - { - MPFR_SET_NAN (r); - MPFR_RET_NAN; - } - else /* log(+Inf) = +Inf */ - { - MPFR_SET_INF (r); - MPFR_SET_POS (r); - MPFR_RET (0); - } - } + { + if (MPFR_IS_NEG (a)) + /* log(-Inf) = NaN */ + { + MPFR_SET_NAN (r); + MPFR_RET_NAN; + } + else /* log(+Inf) = +Inf */ + { + MPFR_SET_INF (r); + MPFR_SET_POS (r); + MPFR_RET (0); + } + } else /* a is zero */ - { + { MPFR_ASSERTD (MPFR_IS_ZERO (a)); - MPFR_SET_INF (r); - MPFR_SET_NEG (r); - MPFR_RET (0); /* log2(0) is an exact -infinity */ - } + MPFR_SET_INF (r); + MPFR_SET_NEG (r); + MPFR_RET (0); /* log2(0) is an exact -infinity */ + } } /* If a is negative, the result is NaN */ @@ -99,7 +99,7 @@ mpfr_log2 (mpfr_ptr r, mpfr_srcptr a, mp_rnd_t rnd_mode) /* the optimal number of bits : see algorithms.tex */ Nt = Ny + 3 + MPFR_INT_CEIL_LOG2 (Ny); - /* initialise of intermediary variable */ + /* initialise of intermediary variable */ mpfr_init2 (t, Nt); mpfr_init2 (tt, Nt); @@ -111,14 +111,14 @@ mpfr_log2 (mpfr_ptr r, mpfr_srcptr a, mp_rnd_t rnd_mode) mpfr_const_log2(t,GMP_RNDD); /* log(2) */ mpfr_log(tt,a,GMP_RNDN); /* log(a) */ mpfr_div(t,tt,t,GMP_RNDN); /* log(a)/log(2) */ - + /* estimation of the error */ err = Nt-3; - if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, Ny, rnd_mode))) - break; - + if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, Ny, rnd_mode))) + break; + /* actualisation of the precision */ - MPFR_ZIV_NEXT (loop, Nt); + MPFR_ZIV_NEXT (loop, Nt); mpfr_set_prec (t, Nt); mpfr_set_prec (tt, Nt); } -- cgit v1.2.1