diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-11-10 12:05:20 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-11-10 12:05:20 +0000 |
commit | ebfdb477d0d1a6d68ef8ed7654562716d1964eca (patch) | |
tree | 2311ac0d6e3f94ca4361d4e3891c19029cb1949a | |
parent | c32d3fbe59a3bd3176fba023ef796d4cadf27b0f (diff) | |
download | mpfr-ebfdb477d0d1a6d68ef8ed7654562716d1964eca.tar.gz |
Replace __gmpfr_ceil_log2 by MPFR_INT_CEIL_LOG2 when possible.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3076 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | acos.c | 3 | ||||
-rw-r--r-- | acosh.c | 3 | ||||
-rw-r--r-- | asin.c | 3 | ||||
-rw-r--r-- | asinh.c | 3 | ||||
-rw-r--r-- | atan.c | 12 | ||||
-rw-r--r-- | atanh.c | 4 | ||||
-rw-r--r-- | const_euler.c | 4 | ||||
-rw-r--r-- | const_log2.c | 6 | ||||
-rw-r--r-- | const_pi.c | 6 | ||||
-rw-r--r-- | cosh.c | 3 | ||||
-rw-r--r-- | erf.c | 8 | ||||
-rw-r--r-- | exp2.c | 3 | ||||
-rw-r--r-- | exp3.c | 6 | ||||
-rw-r--r-- | expm1.c | 3 | ||||
-rw-r--r-- | factorial.c | 6 | ||||
-rw-r--r-- | gamma.c | 4 | ||||
-rw-r--r-- | get_str.c | 4 | ||||
-rw-r--r-- | hypot.c | 4 | ||||
-rw-r--r-- | log10.c | 4 | ||||
-rw-r--r-- | log1p.c | 3 | ||||
-rw-r--r-- | log2.c | 4 | ||||
-rw-r--r-- | pow.c | 2 | ||||
-rw-r--r-- | pow_si.c | 3 | ||||
-rw-r--r-- | sin.c | 3 | ||||
-rw-r--r-- | sin_cos.c | 5 | ||||
-rw-r--r-- | sinh.c | 3 | ||||
-rw-r--r-- | sum.c | 5 | ||||
-rw-r--r-- | tan.c | 3 | ||||
-rw-r--r-- | tanh.c | 3 |
29 files changed, 71 insertions, 52 deletions
@@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" int @@ -119,7 +120,7 @@ mpfr_acos (mpfr_ptr acos, mpfr_srcptr x, mp_rnd_t rnd_mode) good = 1; } else - realprec += __gmpfr_ceil_log2 ((double) realprec); + realprec += MPFR_INT_CEIL_LOG2 (realprec); mpfr_clear (tmp); mpfr_clear (arcc); @@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The computation of acosh is done by @@ -78,7 +79,7 @@ mpfr_acosh (mpfr_ptr y, mpfr_srcptr x , mp_rnd_t rnd_mode) /* compute the precision of intermediary variable */ Nt = MAX(Nx, Ny); /* the optimal number of bits : see algorithms.ps */ - Nt = Nt + 4 + __gmpfr_ceil_log2 (Nt); + Nt = Nt + 4 + MPFR_INT_CEIL_LOG2 (Nt); /* initialization of intermediary variables */ mpfr_init (t); @@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" int @@ -111,7 +112,7 @@ mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mp_rnd_t rnd_mode) if (mpfr_can_round (arcs, realprec, GMP_RNDN, GMP_RNDZ, MPFR_PREC(asin) + (rnd_mode == GMP_RNDN))) break; - realprec += __gmpfr_ceil_log2 ((double) realprec); + realprec += MPFR_INT_CEIL_LOG2 (realprec); } inexact = mpfr_set (asin, arcs, rnd_mode); @@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The computation of asinh is done by @@ -68,7 +69,7 @@ mpfr_asinh (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) Nt = MAX(Nx, Ny); /* the optimal number of bits : see algorithms.ps */ - Nt = Nt + 4 + __gmpfr_ceil_log2 (Nt); + Nt = Nt + 4 + MPFR_INT_CEIL_LOG2 (Nt); /* initialize intermediary variables */ mpfr_init2 (t, 2); @@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" #define CST 2.27 /* CST=1+ln(2.4)/ln(2) */ @@ -143,11 +144,12 @@ mpfr_atan (mpfr_ptr arctangent, mpfr_srcptr x, mp_rnd_t rnd_mode) mpfr_save_emin_emax (); + /* FIXME: Could use MPFR_INT_CEIL_LOG2? */ prec_x = __gmpfr_ceil_log2 ((double) MPFR_PREC(x) / BITS_PER_MP_LIMB); - logn = __gmpfr_ceil_log2 ((double) prec_x); + logn = MPFR_INT_CEIL_LOG2 ( prec_x); if (logn < 2) logn = 2; - realprec = prec_arctan + __gmpfr_ceil_log2((double) prec_arctan) + 4; + realprec = prec_arctan + MPFR_INT_CEIL_LOG2 (prec_arctan) + 4; mpz_init (ukz); mpz_init (square); @@ -165,8 +167,8 @@ mpfr_atan (mpfr_ptr arctangent, mpfr_srcptr x, mp_rnd_t rnd_mode) while (1) { - N0 = __gmpfr_ceil_log2((double) realprec + supplement + CST); - estimated_delta = 1 + supplement + __gmpfr_ceil_log2((double) (3*N0-2)); + N0 = MPFR_INT_CEIL_LOG2 (realprec + supplement + CST); + estimated_delta = 1 + supplement + MPFR_INT_CEIL_LOG2 (3*N0-2); Prec = realprec + estimated_delta; /* Initialisation */ @@ -234,7 +236,7 @@ mpfr_atan (mpfr_ptr arctangent, mpfr_srcptr x, mp_rnd_t rnd_mode) if (!mpfr_can_round (arctgt, realprec, GMP_RNDN, GMP_RNDZ, MPFR_PREC (arctangent) + (rnd_mode == GMP_RNDN))) - realprec += __gmpfr_ceil_log2 ((double) realprec); + realprec += MPFR_INT_CEIL_LOG2 (realprec); else break; } @@ -19,7 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The computation of acosh is done by @@ -89,7 +89,7 @@ mpfr_atanh (mpfr_ptr y, mpfr_srcptr xt , mp_rnd_t rnd_mode) /* compute the precision of intermediary variable */ Nt=MAX(Nx,Ny); /* the optimal number of bits : see algorithms.ps */ - Nt=Nt+4+__gmpfr_ceil_log2(Nt); + Nt=Nt+4+MPFR_INT_CEIL_LOG2(Nt); /* initialise of intermediary variable */ mpfr_init(t); diff --git a/const_euler.c b/const_euler.c index c61db9a5e..b3b27e3ed 100644 --- a/const_euler.c +++ b/const_euler.c @@ -35,7 +35,7 @@ int unsigned long n; int inexact; - log2m = __gmpfr_ceil_log2 ((double) prec); + log2m = MPFR_INT_CEIL_LOG2 (prec); m = prec + log2m; mpfr_init (y); @@ -81,7 +81,7 @@ mpfr_const_euler_S (mpfr_t x, unsigned long n) N = (long) (ALPHA * (double) n + 1.0); /* ceil(alpha * n) */ m = MPFR_PREC(x) + (unsigned long) ((double) n / LOG2) - + __gmpfr_ceil_log2 ((double) N) + 1; + + MPFR_INT_CEIL_LOG2 (N) + 1; mpz_init_set_ui (a, 1); mpz_mul_2exp (a, a, m); /* a=-2^m where m is the precision of x */ diff --git a/const_log2.c b/const_log2.c index a6e4d7564..83e19a5b4 100644 --- a/const_log2.c +++ b/const_log2.c @@ -59,11 +59,11 @@ mpfr_const_aux_log2 (mpfr_ptr mylog, mp_rnd_t rnd_mode) mpz_init (cst); prec_i_want = MPFR_PREC(mylog); - logn = __gmpfr_ceil_log2 ((double) prec_i_want); + logn = MPFR_INT_CEIL_LOG2 (prec_i_want); prec_x = prec_i_want + logn; while (!inexact) { - prec = __gmpfr_ceil_log2 ((double) prec_x); + prec = MPFR_INT_CEIL_LOG2 (prec_x); mpfr_init2 (tmp1, prec_x); mpfr_init2 (result, prec_x); mpfr_init2 (tmp2, prec_x); @@ -138,7 +138,7 @@ int { /* the following was checked by exhaustive search to give a correct result for all 4 rounding modes up to precx = 13500 */ - N = precx + 2 * __gmpfr_ceil_log2 ((double) precx) + 1; + N = precx + 2 * MPFR_INT_CEIL_LOG2 (precx) + 1; mpz_init (s); /* set to zero */ mpz_init (u); diff --git a/const_pi.c b/const_pi.c index 49ef108cc..1e67fb106 100644 --- a/const_pi.c +++ b/const_pi.c @@ -49,12 +49,12 @@ mpfr_pi_machin3 (mpfr_ptr mylog, mp_rnd_t rnd_mode) MPFR_CLEAR_FLAGS (mylog); prec_i_want = MPFR_PREC (mylog); - logn = __gmpfr_ceil_log2 ((double) prec_i_want); + logn = MPFR_INT_CEIL_LOG2 (prec_i_want); prec_x = prec_i_want + logn; mpz_init (cst); while (!inex) { - prec = __gmpfr_ceil_log2 ((double) prec_x); + prec = MPFR_INT_CEIL_LOG2 (prec_x); mpfr_init2(tmp1, prec_x); mpfr_init2(tmp2, prec_x); @@ -166,7 +166,7 @@ int do { oldN = N; - N = (prec+3)/4 + __gmpfr_ceil_log2((double) N + 1.0); + N = (prec+3)/4 + MPFR_INT_CEIL_LOG2 (N + 1); } while (N != oldN); mpz_init(pi); @@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The computation of cosh is done by @@ -69,7 +70,7 @@ mpfr_cosh (mpfr_ptr y, mpfr_srcptr xt , mp_rnd_t rnd_mode) /* compute the precision of intermediary variable */ Nt = MAX(Nx, Ny); /* The optimal number of bits : see algorithms.ps */ - Nt = Nt + 3 + __gmpfr_ceil_log2 (Nt); + Nt = Nt + 3 + MPFR_INT_CEIL_LOG2 (Nt); /* initialise of intermediary variables */ mpfr_init2 (t, Nt); @@ -20,7 +20,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* #define DEBUG */ @@ -150,7 +150,7 @@ mpfr_erf_0 (mpfr_ptr res, mpfr_srcptr x, mp_rnd_t rnd_mode) do { - m += __gmpfr_ceil_log2 ((double) n); + m += MPFR_INT_CEIL_LOG2 (n); mpfr_set_prec (y, m); mpfr_set_prec (s, m); @@ -242,7 +242,7 @@ mpfr_erfc_inf (mpfr_ptr res, mpfr_srcptr x, mp_rnd_t rnd) do { - m += __gmpfr_ceil_log2 ((double) n); + m += MPFR_INT_CEIL_LOG2 (n); /* check that 2 * (EXP(x) - 1) * x^2 > m, which ensures the smallest term is less than 2^(-m) */ @@ -330,7 +330,7 @@ mpfr_erf_inf (mpfr_ptr res, mpfr_srcptr x, mp_rnd_t rnd) do { - m += __gmpfr_ceil_log2 ((double) n); + m += MPFR_INT_CEIL_LOG2 (n); mpfr_set_prec (tmp, m); mpfr_erfc_inf (tmp, x, GMP_RNDN); /* err <= 1/2 ulp */ sh = MPFR_EXP(tmp); @@ -21,6 +21,7 @@ MA 02111-1307, USA. */ #include <limits.h> +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The computation of y = 2^z is done by @@ -99,7 +100,7 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) /* compute the precision of intermediary variable */ Nt = MAX(Nx, Ny); /* the optimal number of bits : see algorithms.ps */ - Nt = Nt + 5 + __gmpfr_ceil_log2 (Nt); + Nt = Nt + 5 + MPFR_INT_CEIL_LOG2 (Nt); /* initialise of intermediary variable */ mpfr_init2 (t, Nt); @@ -23,6 +23,7 @@ MA 02111-1307, USA. */ #include <stddef.h> #include <limits.h> +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" static int @@ -97,7 +98,7 @@ mpfr_exp_rational (mpfr_ptr y, mpz_srcptr p, int r, int m) accu = 0; while (k > 0) { - mpz_mul (S[k], S[k], ptoj[__gmpfr_ceil_log2((double) nb_terms[k])]); + mpz_mul (S[k], S[k], ptoj[MPFR_INT_CEIL_LOG2 (nb_terms[k])]); mpz_mul (S[k-1], S[k-1], P[k]); accu += nb_terms[k]; mpz_mul_2exp (S[k-1], S[k-1], r * accu); @@ -162,11 +163,12 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) /* decompose x */ /* we first write x = 1.xxxxxxxxxxxxx ----- k bits -- */ + /* FIXME: Can I replace this with MPFR_INT_CEIL_LOG2? */ prec_x = __gmpfr_ceil_log2 ((double) (MPFR_PREC(x)) / BITS_PER_MP_LIMB); if (prec_x < 0) prec_x = 0; - logn = __gmpfr_ceil_log2 ((double) prec_x + MPFR_PREC(y)); + logn = MPFR_INT_CEIL_LOG2 (prec_x + MPFR_PREC (y)); if (logn < 2) logn = 2; @@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The computation of expm1 is done by @@ -75,7 +76,7 @@ mpfr_expm1 (mpfr_ptr y, mpfr_srcptr x , mp_rnd_t rnd_mode) /* compute the precision of intermediary variable */ Nt=MAX(Nx,Ny); /* the optimal number of bits : see algorithms.ps */ - Nt=Nt+5+__gmpfr_ceil_log2(Nt); + Nt=Nt+5+MPFR_INT_CEIL_LOG2(Nt); /* initialise of intermediary variable */ mpfr_init(t); diff --git a/factorial.c b/factorial.c index 9a814cced..bcf587fbc 100644 --- a/factorial.c +++ b/factorial.c @@ -19,7 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The computation of n! is done by @@ -56,7 +56,7 @@ mpfr_fac_ui (mpfr_ptr y, unsigned long int x, mp_rnd_t rnd_mode) Ny = MPFR_PREC(y); /* compute the size of intermediary variable */ - Nt = Ny + 2 * (int) __gmpfr_ceil_log2 ((double) x) + 7; + Nt = Ny + 2 * MPFR_INT_CEIL_LOG2 (x) + 7; mpfr_init2 (t, Nt); /* initialise of intermediary variable */ @@ -74,7 +74,7 @@ mpfr_fac_ui (mpfr_ptr y, unsigned long int x, mp_rnd_t rnd_mode) inexact = round; } - err = Nt - 1 - (int) __gmpfr_ceil_log2 ((double) Nt); + err = Nt - 1 - MPFR_INT_CEIL_LOG2 (Nt); round = !inexact || mpfr_can_round (t, err, rnd, GMP_RNDZ, Ny + (rnd_mode == GMP_RNDN)); @@ -24,7 +24,7 @@ MA 02111-1307, USA. */ #include <stdlib.h> #endif - +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* We use the reflection formula @@ -211,7 +211,7 @@ mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mp_rnd_t rnd_mode) MPFR_PREC(gamma) + (rnd_mode == GMP_RNDN))) break; - realprec += __gmpfr_ceil_log2 ((double) realprec); + realprec += MPFR_INT_CEIL_LOG2 (realprec); } inex = mpfr_set (gamma, GammaTrial, rnd_mode); @@ -571,10 +571,10 @@ mpfr_get_str (char *s, mp_exp_t *e, int b, size_t m, mpfr_srcptr x, mp_rnd_t rnd exact = 1; prec = (mp_exp_t) mpfr_ceil_double ((double) m / log_b2[b-2]) + 1; exp = ((mp_exp_t) m < g) ? g - (mp_exp_t) m : (mp_exp_t) m - g; - log_2prec = (mp_exp_t) __gmpfr_ceil_log2 ((double) prec); + log_2prec = (mp_exp_t) MPFR_INT_CEIL_LOG2 (prec); prec += log_2prec; /* number of guard bits */ if (exp != 0) /* add maximal exponentiation error */ - prec += 3 * (mp_exp_t) __gmpfr_ceil_log2 ((double) exp); + prec += 3 * (mp_exp_t) MPFR_INT_CEIL_LOG2 (exp); for (;;) { @@ -19,7 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The computation of hypot of x and y is done by @@ -108,7 +108,7 @@ mpfr_hypot (mpfr_ptr z, mpfr_srcptr x , mpfr_srcptr y , mp_rnd_t rnd_mode) /* compute the working precision -- see algorithms.ps */ Nt = MAX(MAX(MAX(Nx, Ny), Nz), 8); - Nt = Nt - 8 + __gmpfr_ceil_log2 (Nt); + Nt = Nt - 8 + MPFR_INT_CEIL_LOG2 (Nt); /* initialise the intermediary variables */ mpfr_init (t); @@ -19,7 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The computation of r=log10(a) @@ -99,7 +99,7 @@ mpfr_log10 (mpfr_ptr r, mpfr_srcptr a, mp_rnd_t rnd_mode) /* compute the precision of intermediary variable */ Nt = MAX(Nx, Ny); /* the optimal number of bits : see algorithms.ps */ - Nt = Nt + 4+ __gmpfr_ceil_log2 (Nt); + Nt = Nt + 4+ MPFR_INT_CEIL_LOG2 (Nt); /* initialise of intermediary variables */ mpfr_init (t); @@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The computation of log1p is done by @@ -92,7 +93,7 @@ mpfr_log1p (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) /* compute the precision of intermediary variable */ Nt = MAX(Nx,Ny); /* the optimal number of bits : see algorithms.ps */ - Nt = Nt + 5 + __gmpfr_ceil_log2 (Nt); + Nt = Nt + 5 + MPFR_INT_CEIL_LOG2 (Nt); /* initialise of intermediary variable */ mpfr_init (t); @@ -19,7 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The computation of r=log2(a) @@ -100,7 +100,7 @@ mpfr_log2 (mpfr_ptr r, mpfr_srcptr a, mp_rnd_t rnd_mode) /* compute the precision of intermediary variable */ Nt=MAX(Nx,Ny); /* the optimal number of bits : see algorithms.ps */ - Nt=Nt+3+__gmpfr_ceil_log2(Nt); + Nt=Nt + 3 + MPFR_INT_CEIL_LOG2 (Nt); /* initialise of intermediary variable */ mpfr_init(t); @@ -365,7 +365,7 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd_mode) Nt = MAX(Nx, Ny); Nt = MAX(Nt, Nz); /* take account of the output precision too! */ /* the optimal number of bits : see algorithms.ps */ - Nt = Nt + 5 + __gmpfr_ceil_log2 (Nt); + Nt = Nt + 5 + MPFR_INT_CEIL_LOG2 (Nt); /* initialise of intermediary variable */ mpfr_init (t); @@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The computation of y=pow(x,z) is done by @@ -92,7 +93,7 @@ mpfr_pow_si (mpfr_ptr y, mpfr_srcptr x, long int n, mp_rnd_t rnd_mode) /* compute the precision of intermediary variable */ Nt = MAX(Nx,Ny); /* the optimal number of bits : see algorithms.ps */ - Nt = Nt + 3 + __gmpfr_ceil_log2 (Nt); + Nt = Nt + 3 + MPFR_INT_CEIL_LOG2 (Nt); mpfr_save_emin_emax (); @@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* determine the sign of sin(x) using argument reduction. @@ -117,7 +118,7 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) } precy = MPFR_PREC(y); - m = precy + __gmpfr_ceil_log2 ((double) precy) + m = precy + MPFR_INT_CEIL_LOG2 (precy) + MAX (0, MPFR_GET_EXP (x)) + 13; sign = mpfr_sin_sign (x); @@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* (y, z) <- (sin(x), cos(x)), return value is 0 iff both results are exact */ @@ -48,7 +49,7 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mp_rnd_t rnd_mode) /* MPFR_CLEAR_FLAGS is useless since we use mpfr_set to set y and z */ prec = MAX(MPFR_PREC(y), MPFR_PREC(z)); - m = prec + __gmpfr_ceil_log2 ((double) prec) + ABS (MPFR_GET_EXP (x)) + 13; + m = prec + MPFR_INT_CEIL_LOG2 (prec) + ABS (MPFR_GET_EXP (x)) + 13; mpfr_init2 (c, m); mpfr_init2 (k, m); @@ -85,7 +86,7 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mp_rnd_t rnd_mode) if (ok == 0) { - m += __gmpfr_ceil_log2 ((double) m); + m += MPFR_INT_CEIL_LOG2 (m); mpfr_set_prec (c, m); } } @@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The computation of sinh is done by @@ -79,7 +80,7 @@ mpfr_sinh (mpfr_ptr y, mpfr_srcptr xt, mp_rnd_t rnd_mode) /* compute the precision of intermediary variable */ Nt = MAX(Nx, Ny); /* the optimal number of bits : see algorithms.ps */ - Nt = Nt + __gmpfr_ceil_log2 (5) + __gmpfr_ceil_log2 (Nt); + Nt = Nt + MPFR_INT_CEIL_LOG2 (5) + MPFR_INT_CEIL_LOG2 (Nt); /* initialise of intermediary variable */ mpfr_init (t); @@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* Performs a counting sort of the entries */ @@ -48,7 +49,7 @@ void mpfr_count_sort (mpfr_ptr const tab[], unsigned long n, } exp_num = max - min + 1; - if (exp_num > (unsigned long) 42 * __gmpfr_ceil_log2 ((double)n)) + if (exp_num > (unsigned long) 42 * MPFR_INT_CEIL_LOG2 (n)) /* FIXME : better test */ { heap_sort_exp_clean (tab, n, perm); @@ -207,7 +208,7 @@ int mpfr_sum (mpfr_ptr ret, mpfr_ptr const tab[], unsigned long n, mpfr_count_sort (tab, n, perm); initial_f = MPFR_PREC(tab[0]); - k = __gmpfr_ceil_log2 ((double) n) + 1; + k = MPFR_INT_CEIL_LOG2 (n) + 1; mpfr_init2 (cur_sum, initial_f); initial_guard_digits = k + 2; guard_digits = initial_guard_digits; @@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* computes tan(x) = sign(x)*sqrt(1/cos(x)^2-1) */ @@ -45,7 +46,7 @@ mpfr_tan (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) } precy = MPFR_PREC(y); - m = precy + __gmpfr_ceil_log2 ((double) precy) + m = precy + MPFR_INT_CEIL_LOG2 (precy) + ABS (MPFR_GET_EXP (x)) + 13; mpfr_init2 (s, m); @@ -19,6 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The computation of cosh is done by @@ -72,7 +73,7 @@ mpfr_tanh (mpfr_ptr y, mpfr_srcptr xt , mp_rnd_t rnd_mode) /* Compute the precision of intermediary variable */ Nt = MAX (Nx, Ny); /* The optimal number of bits: see algorithms.ps */ - Nt = Nt + /*__gmpfr_ceil_log2 (9)*/ 4 + __gmpfr_ceil_log2 (Nt); + Nt = Nt + /*MPFR_INT_CEIL_LOG2 (9)*/ 4 + MPFR_INT_CEIL_LOG2 (Nt); /* initialise of intermediary variable */ mpfr_init2 (t, Nt); |