summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-11-10 12:05:20 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-11-10 12:05:20 +0000
commitebfdb477d0d1a6d68ef8ed7654562716d1964eca (patch)
tree2311ac0d6e3f94ca4361d4e3891c19029cb1949a
parentc32d3fbe59a3bd3176fba023ef796d4cadf27b0f (diff)
downloadmpfr-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.c3
-rw-r--r--acosh.c3
-rw-r--r--asin.c3
-rw-r--r--asinh.c3
-rw-r--r--atan.c12
-rw-r--r--atanh.c4
-rw-r--r--const_euler.c4
-rw-r--r--const_log2.c6
-rw-r--r--const_pi.c6
-rw-r--r--cosh.c3
-rw-r--r--erf.c8
-rw-r--r--exp2.c3
-rw-r--r--exp3.c6
-rw-r--r--expm1.c3
-rw-r--r--factorial.c6
-rw-r--r--gamma.c4
-rw-r--r--get_str.c4
-rw-r--r--hypot.c4
-rw-r--r--log10.c4
-rw-r--r--log1p.c3
-rw-r--r--log2.c4
-rw-r--r--pow.c2
-rw-r--r--pow_si.c3
-rw-r--r--sin.c3
-rw-r--r--sin_cos.c5
-rw-r--r--sinh.c3
-rw-r--r--sum.c5
-rw-r--r--tan.c3
-rw-r--r--tanh.c3
29 files changed, 71 insertions, 52 deletions
diff --git a/acos.c b/acos.c
index 41d072a08..ec5c75653 100644
--- a/acos.c
+++ b/acos.c
@@ -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);
diff --git a/acosh.c b/acosh.c
index 185b43236..1ff434d51 100644
--- a/acosh.c
+++ b/acosh.c
@@ -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);
diff --git a/asin.c b/asin.c
index 2165e4d1b..6bf567104 100644
--- a/asin.c
+++ b/asin.c
@@ -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);
diff --git a/asinh.c b/asinh.c
index b7932672a..fb77629ee 100644
--- a/asinh.c
+++ b/asinh.c
@@ -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);
diff --git a/atan.c b/atan.c
index 62e3c98c8..8de1c4ca1 100644
--- a/atan.c
+++ b/atan.c
@@ -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;
}
diff --git a/atanh.c b/atanh.c
index a58b3eea6..12d944e9a 100644
--- a/atanh.c
+++ b/atanh.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 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);
diff --git a/cosh.c b/cosh.c
index 2809594bf..82d9c7691 100644
--- a/cosh.c
+++ b/cosh.c
@@ -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);
diff --git a/erf.c b/erf.c
index ba3a1690b..d1706245c 100644
--- a/erf.c
+++ b/erf.c
@@ -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);
diff --git a/exp2.c b/exp2.c
index cc829c302..286b78d52 100644
--- a/exp2.c
+++ b/exp2.c
@@ -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);
diff --git a/exp3.c b/exp3.c
index 57a1f7ad9..91f7c75cc 100644
--- a/exp3.c
+++ b/exp3.c
@@ -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;
diff --git a/expm1.c b/expm1.c
index 67ab6183b..795287d5d 100644
--- a/expm1.c
+++ b/expm1.c
@@ -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));
diff --git a/gamma.c b/gamma.c
index d9f16fc86..f18dc0d4e 100644
--- a/gamma.c
+++ b/gamma.c
@@ -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);
diff --git a/get_str.c b/get_str.c
index c3ed46c28..09bceaa81 100644
--- a/get_str.c
+++ b/get_str.c
@@ -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 (;;)
{
diff --git a/hypot.c b/hypot.c
index 013ade76c..ed19112aa 100644
--- a/hypot.c
+++ b/hypot.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 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);
diff --git a/log10.c b/log10.c
index ffa5bc43a..798b7b36f 100644
--- a/log10.c
+++ b/log10.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 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);
diff --git a/log1p.c b/log1p.c
index 925911cd0..400f9b590 100644
--- a/log1p.c
+++ b/log1p.c
@@ -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);
diff --git a/log2.c b/log2.c
index f260a8873..548cb123d 100644
--- a/log2.c
+++ b/log2.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 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);
diff --git a/pow.c b/pow.c
index e40a502bd..a5c3e1a49 100644
--- a/pow.c
+++ b/pow.c
@@ -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);
diff --git a/pow_si.c b/pow_si.c
index 1d170eaed..fe130c14d 100644
--- a/pow_si.c
+++ b/pow_si.c
@@ -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 ();
diff --git a/sin.c b/sin.c
index d6091ed99..4e4560189 100644
--- a/sin.c
+++ b/sin.c
@@ -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);
diff --git a/sin_cos.c b/sin_cos.c
index 0e6195236..b810117d5 100644
--- a/sin_cos.c
+++ b/sin_cos.c
@@ -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);
}
}
diff --git a/sinh.c b/sinh.c
index 81e18f60e..b13ae1674 100644
--- a/sinh.c
+++ b/sinh.c
@@ -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);
diff --git a/sum.c b/sum.c
index 9f1824ee7..44c36ce06 100644
--- a/sum.c
+++ b/sum.c
@@ -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;
diff --git a/tan.c b/tan.c
index 2eabba089..f5234b094 100644
--- a/tan.c
+++ b/tan.c
@@ -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);
diff --git a/tanh.c b/tanh.c
index 0e0198728..a19f34efb 100644
--- a/tanh.c
+++ b/tanh.c
@@ -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);