diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | README.dev | 4 | ||||
-rw-r--r-- | TODO | 8 | ||||
-rw-r--r-- | acos.c | 2 | ||||
-rw-r--r-- | acosh.c | 2 | ||||
-rw-r--r-- | add1.c | 4 | ||||
-rw-r--r-- | add1sp.c | 2 | ||||
-rw-r--r-- | ai.c | 4 | ||||
-rw-r--r-- | asin.c | 2 | ||||
-rw-r--r-- | asinh.c | 2 | ||||
-rw-r--r-- | atan.c | 6 | ||||
-rw-r--r-- | atan2.c | 2 | ||||
-rw-r--r-- | atanh.c | 2 | ||||
-rw-r--r-- | cbrt.c | 6 | ||||
-rw-r--r-- | cmp.c | 2 | ||||
-rw-r--r-- | cmp_abs.c | 2 | ||||
-rw-r--r-- | cmp_si.c | 4 | ||||
-rw-r--r-- | cmp_ui.c | 4 | ||||
-rw-r--r-- | const_euler.c | 2 | ||||
-rw-r--r-- | cos.c | 4 | ||||
-rw-r--r-- | cot.c | 2 | ||||
-rw-r--r-- | coth.c | 8 | ||||
-rw-r--r-- | csc.c | 2 | ||||
-rw-r--r-- | csch.c | 2 | ||||
-rw-r--r-- | digamma.c | 16 | ||||
-rw-r--r-- | div.c | 2 | ||||
-rw-r--r-- | div_2si.c | 2 | ||||
-rw-r--r-- | div_2ui.c | 2 | ||||
-rw-r--r-- | div_ui.c | 2 | ||||
-rw-r--r-- | eint.c | 16 | ||||
-rw-r--r-- | eq.c | 2 | ||||
-rw-r--r-- | erf.c | 8 | ||||
-rw-r--r-- | erfc.c | 10 | ||||
-rw-r--r-- | exceptions.c | 22 | ||||
-rw-r--r-- | exp.c | 8 | ||||
-rw-r--r-- | exp2.c | 2 | ||||
-rw-r--r-- | exp3.c | 10 | ||||
-rw-r--r-- | exp_2.c | 40 | ||||
-rw-r--r-- | expm1.c | 6 | ||||
-rw-r--r-- | fits_intmax.c | 2 | ||||
-rw-r--r-- | fits_s.h | 2 | ||||
-rw-r--r-- | fits_u.h | 2 | ||||
-rw-r--r-- | fits_uintmax.c | 2 | ||||
-rw-r--r-- | fma.c | 2 | ||||
-rw-r--r-- | fms.c | 2 | ||||
-rw-r--r-- | frac.c | 2 | ||||
-rw-r--r-- | gamma.c | 4 | ||||
-rw-r--r-- | get_d.c | 4 | ||||
-rw-r--r-- | get_d64.c | 4 | ||||
-rw-r--r-- | get_exp.c | 2 | ||||
-rw-r--r-- | get_flt.c | 2 | ||||
-rw-r--r-- | get_ld.c | 6 | ||||
-rw-r--r-- | get_si.c | 2 | ||||
-rw-r--r-- | get_str.c | 36 | ||||
-rw-r--r-- | get_ui.c | 2 | ||||
-rw-r--r-- | get_z.c | 4 | ||||
-rw-r--r-- | get_z_exp.c | 2 | ||||
-rw-r--r-- | gmp_op.c | 10 | ||||
-rw-r--r-- | hypot.c | 2 | ||||
-rw-r--r-- | isinteger.c | 2 | ||||
-rw-r--r-- | jn.c | 6 | ||||
-rw-r--r-- | jyn_asympt.c | 2 | ||||
-rw-r--r-- | li2.c | 32 | ||||
-rw-r--r-- | lngamma.c | 18 | ||||
-rw-r--r-- | log.c | 2 | ||||
-rw-r--r-- | log10.c | 2 | ||||
-rw-r--r-- | log1p.c | 4 | ||||
-rw-r--r-- | log2.c | 2 | ||||
-rw-r--r-- | mbench/mfv5.cc | 2 | ||||
-rw-r--r-- | mbench/mpfr-v6.c | 2 | ||||
-rw-r--r-- | modf.c | 2 | ||||
-rw-r--r-- | mpfr-impl.h | 38 | ||||
-rw-r--r-- | mpfr.h | 71 | ||||
-rw-r--r-- | mpfr.texi | 42 | ||||
-rw-r--r-- | mpn_exp.c | 8 | ||||
-rw-r--r-- | mul.c | 12 | ||||
-rw-r--r-- | mul_2si.c | 2 | ||||
-rw-r--r-- | mul_2ui.c | 2 | ||||
-rw-r--r-- | next.c | 4 | ||||
-rw-r--r-- | out_str.c | 2 | ||||
-rw-r--r-- | pow.c | 14 | ||||
-rw-r--r-- | pow_si.c | 2 | ||||
-rw-r--r-- | pow_z.c | 4 | ||||
-rw-r--r-- | print_raw.c | 2 | ||||
-rw-r--r-- | rem1.c | 2 | ||||
-rw-r--r-- | rint.c | 2 | ||||
-rw-r--r-- | root.c | 12 | ||||
-rw-r--r-- | round_near_x.c | 6 | ||||
-rw-r--r-- | round_p.c | 6 | ||||
-rw-r--r-- | round_prec.c | 6 | ||||
-rw-r--r-- | set_d.c | 2 | ||||
-rw-r--r-- | set_exp.c | 2 | ||||
-rw-r--r-- | set_f.c | 2 | ||||
-rw-r--r-- | set_ld.c | 4 | ||||
-rw-r--r-- | set_si_2exp.c | 2 | ||||
-rw-r--r-- | set_ui_2exp.c | 2 | ||||
-rw-r--r-- | set_z_exp.c | 4 | ||||
-rw-r--r-- | setmax.c | 2 | ||||
-rw-r--r-- | setmin.c | 2 | ||||
-rw-r--r-- | sin.c | 11 | ||||
-rw-r--r-- | sin_cos.c | 17 | ||||
-rw-r--r-- | sinh.c | 2 | ||||
-rw-r--r-- | sinh_cosh.c | 2 | ||||
-rw-r--r-- | sqr.c | 6 | ||||
-rw-r--r-- | sqrt.c | 2 | ||||
-rw-r--r-- | stack_interface.c | 6 | ||||
-rw-r--r-- | strtofr.c | 50 | ||||
-rw-r--r-- | sub1.c | 6 | ||||
-rw-r--r-- | sub1sp.c | 4 | ||||
-rw-r--r-- | subnormal.c | 2 | ||||
-rw-r--r-- | sum.c | 6 | ||||
-rw-r--r-- | swap.c | 2 | ||||
-rw-r--r-- | tanh.c | 2 | ||||
-rw-r--r-- | tests/mpfr-test.h | 12 | ||||
-rw-r--r-- | tests/random2.c | 2 | ||||
-rw-r--r-- | tests/tacos.c | 2 | ||||
-rw-r--r-- | tests/tadd.c | 2 | ||||
-rw-r--r-- | tests/tadd1sp.c | 2 | ||||
-rw-r--r-- | tests/tasin.c | 2 | ||||
-rw-r--r-- | tests/tatan.c | 4 | ||||
-rw-r--r-- | tests/tcan_round.c | 2 | ||||
-rw-r--r-- | tests/tcos.c | 4 | ||||
-rw-r--r-- | tests/tcosh.c | 2 | ||||
-rw-r--r-- | tests/tcot.c | 4 | ||||
-rw-r--r-- | tests/tcoth.c | 2 | ||||
-rw-r--r-- | tests/tdiv.c | 4 | ||||
-rw-r--r-- | tests/tests.c | 14 | ||||
-rw-r--r-- | tests/texceptions.c | 6 | ||||
-rw-r--r-- | tests/texp.c | 14 | ||||
-rw-r--r-- | tests/texp10.c | 10 | ||||
-rw-r--r-- | tests/texp2.c | 10 | ||||
-rw-r--r-- | tests/tfactorial.c | 4 | ||||
-rw-r--r-- | tests/tfprintf.c | 2 | ||||
-rw-r--r-- | tests/tfrac.c | 2 | ||||
-rw-r--r-- | tests/tgamma.c | 4 | ||||
-rw-r--r-- | tests/tgeneric.c | 2 | ||||
-rw-r--r-- | tests/tget_f.c | 2 | ||||
-rw-r--r-- | tests/tget_str.c | 16 | ||||
-rw-r--r-- | tests/tget_z.c | 2 | ||||
-rw-r--r-- | tests/thypot.c | 2 | ||||
-rw-r--r-- | tests/tinternals.c | 2 | ||||
-rw-r--r-- | tests/tlgamma.c | 2 | ||||
-rw-r--r-- | tests/tlog.c | 2 | ||||
-rw-r--r-- | tests/tmodf.c | 2 | ||||
-rw-r--r-- | tests/tmul.c | 2 | ||||
-rw-r--r-- | tests/tmul_2exp.c | 4 | ||||
-rw-r--r-- | tests/tmul_ui.c | 2 | ||||
-rw-r--r-- | tests/tpow.c | 22 | ||||
-rw-r--r-- | tests/tpow_all.c | 8 | ||||
-rw-r--r-- | tests/tpow_z.c | 2 | ||||
-rw-r--r-- | tests/tprintf.c | 2 | ||||
-rw-r--r-- | tests/trandom.c | 2 | ||||
-rw-r--r-- | tests/trint.c | 2 | ||||
-rw-r--r-- | tests/tround_prec.c | 2 | ||||
-rw-r--r-- | tests/tsec.c | 2 | ||||
-rw-r--r-- | tests/tsech.c | 2 | ||||
-rw-r--r-- | tests/tset.c | 2 | ||||
-rw-r--r-- | tests/tset_exp.c | 2 | ||||
-rw-r--r-- | tests/tset_f.c | 2 | ||||
-rw-r--r-- | tests/tset_ld.c | 2 | ||||
-rw-r--r-- | tests/tset_si.c | 2 | ||||
-rw-r--r-- | tests/tset_str.c | 6 | ||||
-rw-r--r-- | tests/tset_z.c | 2 | ||||
-rw-r--r-- | tests/tset_z_exp.c | 8 | ||||
-rw-r--r-- | tests/tsin_cos.c | 4 | ||||
-rw-r--r-- | tests/tsprintf.c | 4 | ||||
-rw-r--r-- | tests/tsqr.c | 2 | ||||
-rw-r--r-- | tests/tstrtofr.c | 2 | ||||
-rw-r--r-- | tests/tsub1sp.c | 2 | ||||
-rw-r--r-- | tests/tsubnormal.c | 6 | ||||
-rw-r--r-- | tests/tsum.c | 2 | ||||
-rw-r--r-- | tests/ttanh.c | 2 | ||||
-rw-r--r-- | tests/tui_pow.c | 2 | ||||
-rw-r--r-- | tests/turandom.c | 2 | ||||
-rw-r--r-- | ui_pow_ui.c | 2 | ||||
-rw-r--r-- | urandom.c | 4 | ||||
-rw-r--r-- | urandomb.c | 2 | ||||
-rw-r--r-- | vasprintf.c | 22 | ||||
-rw-r--r-- | yn.c | 20 | ||||
-rw-r--r-- | zeta.c | 10 |
180 files changed, 544 insertions, 539 deletions
@@ -37,6 +37,8 @@ Changes from versions 2.4.* to version 3.0: in the future) and it is now signed (it was unsigned in MPFR 2.*, but this was not documented). In practice, this change should not affect existing code that assumed nothing on the precision type. +- MPFR now has its own exponent type mpfr_exp_t, which is currently + the same as GMP's mp_exp_t. - Functions mpfr_random and mpfr_random2 have been removed. - mpfr_get_f and mpfr_get_z now return a ternary value. - New functions mpfr_buildopt_tls_p and mpfr_buildopt_decimal_p giving diff --git a/README.dev b/README.dev index 7504a10c9..adea2c491 100644 --- a/README.dev +++ b/README.dev @@ -698,9 +698,9 @@ Avoid mixing signed and unsigned types, as this can lead signed types to be automatically converted into unsigned types (usual arithmetic conversions). If such a signed type contains a negative value, the result will probably be incorrect. With MPFR 2.x, this problem could -arise with mp_exp_t, which is signed, and mpfr_prec_t (mp_prec_t), +arise with mpfr_exp_t, which is signed, and mpfr_prec_t (mp_prec_t), which was unsigned (it is now signed), meaning that in general, a cast -of a mpfr_prec_t into a mp_exp_t was needed. +of a mpfr_prec_t into a mpfr_exp_t was needed. Note that such bugs are difficult to detect because they may depend on the platform (e.g., on LP64, 32-bit unsigned int + 64-bit long is OK, @@ -216,8 +216,8 @@ Table of contents: - radians - sqrtpi -- mpfr_frexp(mpfr_t rop, mp_exp_t *n, mpfr_t op, mpfr_rnd_t rnd) suggested by - Steve Kargl <sgk@troutmask.apl.washington.edu> Sun, 7 Aug 2005 +- mpfr_frexp(mpfr_t rop, mpfr_exp_t *n, mpfr_t op, mpfr_rnd_t rnd) suggested + by Steve Kargl <sgk@troutmask.apl.washington.edu> Sun, 7 Aug 2005 - mpfr_inp_raw, mpfr_out_raw (cf mail "Serialization of mpfr_t" from Alexey and answer from Granlund on mpfr list, May 2007) - [maybe useful for SAGE] implement companion frac_* functions to the rint_* @@ -415,9 +415,7 @@ Table of contents: - add an option to use a 32-bit exponent type (int) on LP64 machines, mainly for developers, in order to be able to test the case where the extended exponent range is the same as the default exponent range, on - such platforms. This would need to rename all mp_exp_t as mpfr_exp_t - and add a typedef either to mp_exp_t (default) or to int (when this - option is enabled). + such platforms. - test underflow/overflow detection of various functions (in particular mpfr_exp) in reduced exponent ranges, including ranges that do not @@ -27,7 +27,7 @@ int mpfr_acos (mpfr_ptr acos, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { mpfr_t xp, arcc, tmp; - mp_exp_t supplement; + mpfr_exp_t supplement; mpfr_prec_t prec; int sign, compared, inexact; MPFR_SAVE_EXPO_DECL (expo); @@ -73,7 +73,7 @@ mpfr_acosh (mpfr_ptr y, mpfr_srcptr x , mpfr_rnd_t rnd_mode) /* Declaration of the size variables */ mpfr_prec_t Ny = MPFR_PREC(y); /* Precision of output variable */ mpfr_prec_t Nt; /* Precision of the intermediary variable */ - mp_exp_t err, exp_te, d; /* Precision of error */ + mpfr_exp_t err, exp_te, d; /* Precision of error */ MPFR_ZIV_DECL (loop); /* compute the precision of intermediary variable */ @@ -30,7 +30,7 @@ mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) mp_limb_t *ap, *bp, *cp; mpfr_prec_t aq, bq, cq, aq2; mp_size_t an, bn, cn; - mp_exp_t difw, exp; + mpfr_exp_t difw, exp; int sh, rb, fb, inex; mpfr_uexp_t diff_exp; MPFR_TMP_DECL(marker); @@ -206,7 +206,7 @@ mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) /* determine rounding and sticky bits (and possible carry) */ - difw = (mp_exp_t) an - (mp_exp_t) (diff_exp / GMP_NUMB_BITS); + difw = (mpfr_exp_t) an - (mpfr_exp_t) (diff_exp / GMP_NUMB_BITS); /* difw is the number of limbs from b (regarded as having an infinite precision) that have already been combined with c; -n if the next n limbs from b won't be combined with c. */ @@ -91,7 +91,7 @@ mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) unsigned int sh; mp_size_t n; mp_limb_t *ap, *cp; - mp_exp_t bx; + mpfr_exp_t bx; mp_limb_t limb; int inexact; MPFR_TMP_DECL(marker); @@ -209,9 +209,9 @@ mpfr_ai (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) /* FIXME: if s==0 */ test1 = MPFR_IS_ZERO (ti) - || ( MPFR_EXP (ti) + (mp_exp_t)prec + 3 <= MPFR_EXP (s) ); + || ( MPFR_EXP (ti) + (mpfr_exp_t)prec + 3 <= MPFR_EXP (s) ); test2 = MPFR_IS_ZERO (tip1) - || ( MPFR_EXP (tip1) + (mp_exp_t)prec + 3 <= MPFR_EXP (s) ); + || ( MPFR_EXP (tip1) + (mpfr_exp_t)prec + 3 <= MPFR_EXP (s) ); if ( test1 && test2 && (x3u <= k*(k+1)/2) ) break; /* FIXME: if k*(k+1) overflows */ @@ -28,7 +28,7 @@ mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mpfr_rnd_t rnd_mode) mpfr_t xp; int compared, inexact; mpfr_prec_t prec; - mp_exp_t xp_exp; + mpfr_exp_t xp_exp; MPFR_SAVE_EXPO_DECL (expo); MPFR_ZIV_DECL (loop); @@ -33,7 +33,7 @@ mpfr_asinh (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) int signx, neg; mpfr_prec_t Ny, Nt; mpfr_t t; /* auxiliary variables */ - mp_exp_t err; + mpfr_exp_t err; MPFR_SAVE_EXPO_DECL (expo); MPFR_ZIV_DECL (loop); @@ -39,7 +39,7 @@ mpfr_atan_aux (mpfr_ptr y, mpz_ptr p, long r, int m, mpz_t *tab) { mpz_t *S, *Q, *ptoj; unsigned long n, i, k, j, l; - mp_exp_t diff, expo; + mpfr_exp_t diff, expo; int im, done; mpfr_prec_t mult, *accu, *log2_nb_terms; mpfr_prec_t precy = MPFR_PREC(y); @@ -192,7 +192,7 @@ mpfr_atan (mpfr_ptr atan, mpfr_srcptr x, mpfr_rnd_t rnd_mode) mpfr_t xp, arctgt, sk, tmp, tmp2; mpz_t ukz; mpz_t *tabz; - mp_exp_t exptol; + mpfr_exp_t exptol; mpfr_prec_t prec, realprec, est_lost, lost; unsigned long twopoweri, log2p, red; int comparaison, inexact; @@ -329,7 +329,7 @@ mpfr_atan (mpfr_ptr atan, mpfr_srcptr x, mpfr_rnd_t rnd_mode) /* Argument reduction: atan(x) = 2 atan((sqrt(1+x^2)-1)/x). We want |sk| < k/sqrt(p) where p is the target precision. */ lost = 0; - for (red = 0; MPFR_GET_EXP(sk) > - (mp_exp_t) log2p; red ++) + for (red = 0; MPFR_GET_EXP(sk) > - (mpfr_exp_t) log2p; red ++) { lost = 9 - 2 * MPFR_EXP(sk); mpfr_mul (tmp, sk, sk, MPFR_RNDN); @@ -29,7 +29,7 @@ mpfr_atan2 (mpfr_ptr dest, mpfr_srcptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) mpfr_t tmp, pi; int inexact; mpfr_prec_t prec; - mp_exp_t e; + mpfr_exp_t e; MPFR_SAVE_EXPO_DECL (expo); MPFR_ZIV_DECL (loop); @@ -32,7 +32,7 @@ mpfr_atanh (mpfr_ptr y, mpfr_srcptr xt , mpfr_rnd_t rnd_mode) int inexact; mpfr_t x, t, te; mpfr_prec_t Nx, Ny, Nt; - mp_exp_t err; + mpfr_exp_t err; MPFR_ZIV_DECL (loop); MPFR_SAVE_EXPO_DECL (expo); @@ -45,7 +45,7 @@ int mpfr_cbrt (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { mpz_t m; - mp_exp_t e, r, sh; + mpfr_exp_t e, r, sh; mpfr_prec_t n, size_m, tmp; int inexact, negative; MPFR_SAVE_EXPO_DECL (expo); @@ -91,7 +91,7 @@ mpfr_cbrt (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) /* we want 3*n-2 <= size_m + 3*sh + r <= 3*n i.e. 3*sh + size_m + r <= 3*n */ - sh = (3 * (mp_exp_t) n - (mp_exp_t) size_m - r) / 3; + sh = (3 * (mpfr_exp_t) n - (mpfr_exp_t) size_m - r) / 3; sh = 3 * sh + r; if (sh >= 0) { @@ -114,7 +114,7 @@ mpfr_cbrt (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) sh = tmp - n; if (sh > 0) /* we have to flush to 0 the last sh bits from m */ { - inexact = inexact || ((mp_exp_t) mpz_scan1 (m, 0) < sh); + inexact = inexact || ((mpfr_exp_t) mpz_scan1 (m, 0) < sh); mpz_fdiv_q_2exp (m, m, sh); e += 3 * sh; } @@ -31,7 +31,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., int mpfr_cmp3 (mpfr_srcptr b, mpfr_srcptr c, int s) { - mp_exp_t be, ce; + mpfr_exp_t be, ce; mp_size_t bn, cn; mp_limb_t *bp, *cp; @@ -28,7 +28,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., int mpfr_cmpabs (mpfr_srcptr b, mpfr_srcptr c) { - mp_exp_t be, ce; + mpfr_exp_t be, ce; mp_size_t bn, cn; mp_limb_t *bp, *cp; @@ -31,7 +31,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., */ int -mpfr_cmp_si_2exp (mpfr_srcptr b, long int i, mp_exp_t f) +mpfr_cmp_si_2exp (mpfr_srcptr b, long int i, mpfr_exp_t f) { int si; @@ -50,7 +50,7 @@ mpfr_cmp_si_2exp (mpfr_srcptr b, long int i, mp_exp_t f) return MPFR_INT_SIGN (b); else /* b and i are of same sign si */ { - mp_exp_t e; + mpfr_exp_t e; unsigned long ai; int k; mp_size_t bn; @@ -31,7 +31,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., */ int -mpfr_cmp_ui_2exp (mpfr_srcptr b, unsigned long int i, mp_exp_t f) +mpfr_cmp_ui_2exp (mpfr_srcptr b, unsigned long int i, mpfr_exp_t f) { if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(b) )) { @@ -53,7 +53,7 @@ mpfr_cmp_ui_2exp (mpfr_srcptr b, unsigned long int i, mp_exp_t f) return 1; else /* b > 0, i > 0 */ { - mp_exp_t e; + mpfr_exp_t e; int k; mp_size_t bn; mp_limb_t c, *bp; diff --git a/const_euler.c b/const_euler.c index b5d810325..39cdeadaf 100644 --- a/const_euler.c +++ b/const_euler.c @@ -55,7 +55,7 @@ mpfr_const_euler_internal (mpfr_t x, mpfr_rnd_t rnd) MPFR_ZIV_INIT (loop, m); for (;;) { - mp_exp_t exp_S, err; + mpfr_exp_t exp_S, err; /* since prec >= 1, we have m >= 24 here, which ensures n >= 9 below */ n = 1 + (unsigned long) ((double) m * LOG2 / 2.0); MPFR_ASSERTD (n >= 9); @@ -41,7 +41,7 @@ static int mpfr_cos2_aux (mpfr_ptr f, mpfr_srcptr r) { mpz_t x, t, s; - mp_exp_t ex, l, m; + mpfr_exp_t ex, l, m; mpfr_prec_t p, q; unsigned long i, maxi, imax; @@ -133,7 +133,7 @@ mpfr_cos (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) mpfr_prec_t K0, K, precy, m, k, l; int inexact, reduce = 0; mpfr_t r, s, xr, c; - mp_exp_t exps, cancel = 0, expx; + mpfr_exp_t exps, cancel = 0, expx; MPFR_ZIV_DECL (loop); MPFR_SAVE_EXPO_DECL (expo); MPFR_GROUP_DECL (group); @@ -50,7 +50,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., an underflow is not possible as emin = - emax. The overflow is a real overflow possibly except when |x| = 2^emin. */ #define ACTION_TINY(y,x,r) \ - if (MPFR_EXP(x) + 1 <= -2 * (mp_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y))) \ + if (MPFR_EXP(x) + 1 <= -2 * (mpfr_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y))) \ { \ int two2emin; \ int signx = MPFR_SIGN(x); \ @@ -42,10 +42,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., if (MPFR_GET_EXP(z) == 1) /* 1 <= |z| < 2 */ \ { \ /* the following is exact by Sterbenz theorem */ \ - mpfr_sub_si (z, z, MPFR_SIGN(z) > 0 ? 1 : -1, MPFR_RNDN); \ - if (MPFR_IS_ZERO(z) || MPFR_GET_EXP(z) <= - (mp_exp_t) precy) \ + mpfr_sub_si (z, z, MPFR_SIGN(z) > 0 ? 1 : -1, MPFR_RNDN); \ + if (MPFR_IS_ZERO(z) || MPFR_GET_EXP(z) <= - (mpfr_exp_t) precy) \ { \ - mpfr_add_si (z, z, MPFR_SIGN(z) > 0 ? 1 : -1, MPFR_RNDN); \ + mpfr_add_si (z, z, MPFR_SIGN(z) > 0 ? 1 : -1, MPFR_RNDN); \ break; \ } \ } @@ -63,7 +63,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., result. If x < 2^E, then y > 2^(-E), thus ufp(y) > 2^(-E-1). A sufficient condition is thus EXP(x) + 1 <= -2 MAX(PREC(x),PREC(Y)). */ #define ACTION_TINY(y,x,r) \ - if (MPFR_EXP(x) + 1 <= -2 * (mp_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y))) \ + if (MPFR_EXP(x) + 1 <= -2 * (mpfr_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y))) \ { \ int signx = MPFR_SIGN(x); \ inexact = mpfr_ui_div (y, 1, x, r); \ @@ -46,7 +46,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., If x < 2^E, then y > 2^(-E), thus ufp(y) > 2^(-E-1). A sufficient condition is thus EXP(x) <= -2 MAX(PREC(x),PREC(Y)). */ #define ACTION_TINY(y,x,r) \ - if (MPFR_EXP(x) <= -2 * (mp_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y))) \ + if (MPFR_EXP(x) <= -2 * (mpfr_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y))) \ { \ int signx = MPFR_SIGN(x); \ inexact = mpfr_ui_div (y, 1, x, r); \ @@ -49,7 +49,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., result. If x < 2^E, then y > 2^(-E), thus ufp(y) > 2^(-E-1). A sufficient condition is thus EXP(x) <= -2 MAX(PREC(x),PREC(Y)). */ #define ACTION_TINY(y,x,r) \ - if (MPFR_EXP(x) <= -2 * (mp_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y))) \ + if (MPFR_EXP(x) <= -2 * (mpfr_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y))) \ { \ int signx = MPFR_SIGN(x); \ inexact = mpfr_ui_div (y, 1, x, r); \ @@ -28,12 +28,12 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., Returns an integer e such that the error is bounded by 2^e ulps of the result s. */ -static mp_exp_t +static mpfr_exp_t mpfr_digamma_approx (mpfr_ptr s, mpfr_srcptr x) { mpfr_prec_t p = MPFR_PREC (s); mpfr_t t, u, invxx; - mp_exp_t e, exps, f, expu; + mpfr_exp_t e, exps, f, expu; mpz_t *INITIALIZED(B); /* variable B declared as initialized */ unsigned long n0, n; /* number of allocated B[] */ @@ -80,7 +80,7 @@ mpfr_digamma_approx (mpfr_ptr s, mpfr_srcptr x) sum((10n+4)/2^n, n=1..infinity) = 24 */ exps = mpfr_get_exp (s); expu = mpfr_get_exp (u); - if (expu < exps - (mp_exp_t) p) + if (expu < exps - (mpfr_exp_t) p) break; mpfr_sub (s, s, u, MPFR_RNDN); /* error <= 24 + n/2 */ if (mpfr_get_exp (s) < exps) @@ -122,7 +122,7 @@ mpfr_digamma_reflection (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { mpfr_prec_t p = MPFR_PREC(y) + 10, q; mpfr_t t, u, v; - mp_exp_t e1, expv; + mpfr_exp_t e1, expv; int inex; MPFR_ZIV_DECL (loop); @@ -157,7 +157,7 @@ mpfr_digamma_reflection (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { mpfr_const_pi (v, MPFR_RNDN); /* v = Pi*(1+theta) for |theta|<=2^(-p) */ mpfr_mul (t, v, x, MPFR_RNDN); /* (1+theta)^2 */ - e1 = MPFR_EXP(t) - (mp_exp_t) p + 1; /* bound for t: err(t) <= 2^e1 */ + e1 = MPFR_EXP(t) - (mpfr_exp_t) p + 1; /* bound for t: err(t) <= 2^e1 */ mpfr_cot (t, t, MPFR_RNDN); /* cot(t * (1+h)) = cot(t) - theta * (1 + cot(t)^2) with |theta|<=t*h */ if (MPFR_EXP(t) > 0) @@ -165,7 +165,7 @@ mpfr_digamma_reflection (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) else e1 = e1 + 1; /* now theta * (1 + cot(t)^2) <= 2^e1 */ - e1 += (mp_exp_t) p - MPFR_EXP(t); /* error is now 2^e1 ulps */ + e1 += (mpfr_exp_t) p - MPFR_EXP(t); /* error is now 2^e1 ulps */ mpfr_mul (t, t, v, MPFR_RNDN); e1 ++; mpfr_digamma (v, u, MPFR_RNDN); /* error <= 1/2 ulp */ @@ -204,7 +204,7 @@ mpfr_digamma_positive (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) mpfr_prec_t p = MPFR_PREC(y) + 10, q; mpfr_t t, u, x_plus_j; int inex; - mp_exp_t errt, erru, expt; + mpfr_exp_t errt, erru, expt; unsigned long j = 0, min; MPFR_ZIV_DECL (loop); @@ -333,7 +333,7 @@ mpfr_digamma (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) A sufficient condition is thus EXP(x) <= -2 MAX(PREC(x),PREC(Y)). */ if (MPFR_EXP(x) < -2) { - if (MPFR_EXP(x) <= -2 * (mp_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y))) + if (MPFR_EXP(x) <= -2 * (mpfr_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y))) { int signx = MPFR_SIGN(x); inex = mpfr_si_div (y, -1, x, rnd_mode); @@ -149,7 +149,7 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mpfr_rnd_t rnd_mode) mp_limb_t sticky; mp_limb_t sticky3; mp_limb_t round_bit = MPFR_LIMB_ZERO; - mp_exp_t qexp; + mpfr_exp_t qexp; int sign_quotient; int extra_bit; int sh, sh2; @@ -34,7 +34,7 @@ mpfr_div_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd_mode) if (MPFR_LIKELY( MPFR_IS_PURE_FP(y) )) { - mp_exp_t exp = MPFR_GET_EXP (y); + mpfr_exp_t exp = MPFR_GET_EXP (y); if (MPFR_UNLIKELY( n > 0 && (__gmpfr_emin > MPFR_EMAX_MAX - n || exp < __gmpfr_emin + n)) ) { @@ -51,7 +51,7 @@ mpfr_div_2ui (mpfr_ptr y, mpfr_srcptr x, unsigned long n, mpfr_rnd_t rnd_mode) overflow; the first test useful so that the real test can't lead to an integer overflow. */ { - mp_exp_t exp = MPFR_GET_EXP (y); + mpfr_exp_t exp = MPFR_GET_EXP (y); if (MPFR_UNLIKELY( __gmpfr_emin > MPFR_EMAX_MAX - (long) n || exp < __gmpfr_emin + (long) n) ) { @@ -31,7 +31,7 @@ mpfr_div_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mpfr_rnd_t rnd_mode int sh; mp_size_t xn, yn, dif; mp_limb_t *xp, *yp, *tmp, c, d; - mp_exp_t exp; + mpfr_exp_t exp; int inexact, middle = 1, nexttoinf; MPFR_TMP_DECL(marker); @@ -32,13 +32,13 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., /* compute in y an approximation of sum(x^k/k/k!, k=1..infinity), and return e such that the absolute error is bound by 2^e ulp(y) */ -static mp_exp_t +static mpfr_exp_t mpfr_eint_aux (mpfr_t y, mpfr_srcptr x) { mpfr_t eps; /* dynamic (absolute) error bound on t */ mpfr_t erru, errs; mpz_t m, s, t, u; - mp_exp_t e, sizeinbase; + mpfr_exp_t e, sizeinbase; mpfr_prec_t w = MPFR_PREC(y); unsigned long k; MPFR_GROUP_DECL (group); @@ -48,7 +48,7 @@ mpfr_eint_aux (mpfr_t y, mpfr_srcptr x) thus |R(x)/x| <= |x|/2 thus if |x| <= 2^(-PREC(y)) we have |S - o(x)| <= ulp(y) */ - if (MPFR_GET_EXP(x) <= - (mp_exp_t) w) + if (MPFR_GET_EXP(x) <= - (mpfr_exp_t) w) { mpfr_set (y, x, MPFR_RNDN); return 0; @@ -148,13 +148,13 @@ mpfr_eint_aux (mpfr_t y, mpfr_srcptr x) Assumes x >= PREC(y) * log(2). Returns the error bound in terms of ulp(y). */ -static mp_exp_t +static mpfr_exp_t mpfr_eint_asympt (mpfr_ptr y, mpfr_srcptr x) { mpfr_prec_t p = MPFR_PREC(y); mpfr_t invx, t, err; unsigned long k; - mp_exp_t err_exp; + mpfr_exp_t err_exp; mpfr_init2 (t, p); mpfr_init2 (invx, p); @@ -163,7 +163,7 @@ mpfr_eint_asympt (mpfr_ptr y, mpfr_srcptr x) mpfr_set_ui (t, 1, MPFR_RNDN); /* exact */ mpfr_set (y, t, MPFR_RNDN); mpfr_set_ui (err, 0, MPFR_RNDN); - for (k = 1; MPFR_GET_EXP(t) + (mp_exp_t) p > MPFR_GET_EXP(y); k++) + for (k = 1; MPFR_GET_EXP(t) + (mpfr_exp_t) p > MPFR_GET_EXP(y); k++) { mpfr_mul (t, t, invx, MPFR_RNDN); /* 2 more roundings */ mpfr_mul_ui (t, t, k, MPFR_RNDN); /* 1 more rounding: t = k!/x^k*(1+u)^e @@ -195,7 +195,7 @@ mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) { int inex; mpfr_t tmp, ump; - mp_exp_t err, te; + mpfr_exp_t err, te; mpfr_prec_t prec; MPFR_SAVE_EXPO_DECL (expo); MPFR_ZIV_DECL (loop); @@ -244,7 +244,7 @@ mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) mpfr_sub (ump, x, tmp, MPFR_RNDD); mpfr_const_log2 (tmp, MPFR_RNDU); mpfr_div (ump, ump, tmp, MPFR_RNDD); - /* FIXME: We really need mpfr_set_exp_t and mpfr_cmp_exp_t functions. */ + /* FIXME: We really need mpfr_set_exp_t and mpfr_cmpfr_exp_t functions. */ MPFR_ASSERTN (MPFR_EMAX_MAX <= LONG_MAX); if (mpfr_cmp_ui (ump, __gmpfr_emax) >= 0) { @@ -30,7 +30,7 @@ mpfr_eq (mpfr_srcptr u, mpfr_srcptr v, unsigned long int n_bits) { mp_srcptr up, vp; mp_size_t usize, vsize, size, i; - mp_exp_t uexp, vexp; + mpfr_exp_t uexp, vexp; int k; if (MPFR_ARE_SINGULAR(u, v)) @@ -64,7 +64,7 @@ mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) with 1 - x^2/3 <= sqrt(Pi)*erf(x)/2/x <= 1 for x >= 0. This means that if x^2/3 < 2^(-PREC(y)-1) we can decide of the correct rounding, unless we have a worst-case for 2x/sqrt(Pi). */ - if (MPFR_EXP(x) < - (mp_exp_t) (MPFR_PREC(y) / 2)) + if (MPFR_EXP(x) < - (mpfr_exp_t) (MPFR_PREC(y) / 2)) { /* we use 2x/sqrt(Pi) (1 - x^2/3) <= erf(x) <= 2x/sqrt(Pi) for x > 0 and 2x/sqrt(Pi) <= erf(x) <= 2x/sqrt(Pi) (1 - x^2/3) for x < 0. @@ -154,7 +154,7 @@ mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) /* return x*2^e */ static double -mul_2exp (double x, mp_exp_t e) +mul_2exp (double x, mpfr_exp_t e) { if (e > 0) { @@ -181,7 +181,7 @@ static int mpfr_erf_0 (mpfr_ptr res, mpfr_srcptr x, double xf2, mpfr_rnd_t rnd_mode) { mpfr_prec_t n, m; - mp_exp_t nuk, sigmak; + mpfr_exp_t nuk, sigmak; double tauk; mpfr_t y, s, t, u; unsigned int k; @@ -220,7 +220,7 @@ mpfr_erf_0 (mpfr_ptr res, mpfr_srcptr x, double xf2, mpfr_rnd_t rnd_mode) sigmak -= MPFR_GET_EXP(s); nuk = MPFR_GET_EXP(u) - MPFR_GET_EXP(s); - if ((nuk < - (mp_exp_t) m) && ((double) k >= xf2)) + if ((nuk < - (mpfr_exp_t) m) && ((double) k >= xf2)) break; /* tauk <- 1/2 + tauk * 2^sigmak + (1+8k)*2^nuk */ @@ -30,13 +30,13 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., Returns e such that the error is bounded by 2^e ulp(y), or returns 0 in case of underflow. */ -static mp_exp_t +static mpfr_exp_t mpfr_erfc_asympt (mpfr_ptr y, mpfr_srcptr x) { mpfr_t t, xx, err; unsigned long k; mpfr_prec_t prec = MPFR_PREC(y); - mp_exp_t exp_err; + mpfr_exp_t exp_err; mpfr_init2 (t, prec); mpfr_init2 (xx, prec); @@ -60,7 +60,7 @@ mpfr_erfc_asympt (mpfr_ptr y, mpfr_srcptr x) mpfr_mul_2si (err, err, MPFR_GET_EXP (y) - MPFR_GET_EXP (t), MPFR_RNDU); mpfr_add_ui (err, err, 14 * k, MPFR_RNDU); /* 2^(1-p) * t <= 2 ulp(t) */ mpfr_div_2si (err, err, MPFR_GET_EXP (y) - MPFR_GET_EXP (t), MPFR_RNDU); - if (MPFR_GET_EXP (t) + (mp_exp_t) prec <= MPFR_GET_EXP (y)) + if (MPFR_GET_EXP (t) + (mpfr_exp_t) prec <= MPFR_GET_EXP (y)) { /* the truncation error is bounded by |t| < ulp(y) */ mpfr_add_ui (err, err, 1, MPFR_RNDU); @@ -125,7 +125,7 @@ mpfr_erfc (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) { int inex; mpfr_t tmp; - mp_exp_t te, err; + mpfr_exp_t te, err; mpfr_prec_t prec; MPFR_SAVE_EXPO_DECL (expo); MPFR_ZIV_DECL (loop); @@ -156,7 +156,7 @@ mpfr_erfc (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) if (MPFR_SIGN (x) < 0) { - mp_exp_t e = MPFR_EXP(x); + mpfr_exp_t e = MPFR_EXP(x); /* For x < 0 going to -infinity, erfc(x) tends to 2 by below. More precisely, we have 2 + 1/sqrt(Pi)/x/exp(x^2) < erfc(x) < 2. Thus log2 |2 - erfc(x)| <= -log2|x| - x^2 / log(2). diff --git a/exceptions.c b/exceptions.c index 7b7359ef1..dea5ac7b1 100644 --- a/exceptions.c +++ b/exceptions.c @@ -24,12 +24,12 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., unsigned int MPFR_THREAD_ATTR __gmpfr_flags = 0; -mp_exp_t MPFR_THREAD_ATTR __gmpfr_emin = MPFR_EMIN_DEFAULT; -mp_exp_t MPFR_THREAD_ATTR __gmpfr_emax = MPFR_EMAX_DEFAULT; +mpfr_exp_t MPFR_THREAD_ATTR __gmpfr_emin = MPFR_EMIN_DEFAULT; +mpfr_exp_t MPFR_THREAD_ATTR __gmpfr_emax = MPFR_EMAX_DEFAULT; #undef mpfr_get_emin -mp_exp_t +mpfr_exp_t mpfr_get_emin (void) { return __gmpfr_emin; @@ -38,7 +38,7 @@ mpfr_get_emin (void) #undef mpfr_set_emin int -mpfr_set_emin (mp_exp_t exponent) +mpfr_set_emin (mpfr_exp_t exponent) { if (exponent >= MPFR_EMIN_MIN && exponent <= MPFR_EMIN_MAX) { @@ -51,13 +51,13 @@ mpfr_set_emin (mp_exp_t exponent) } } -mp_exp_t +mpfr_exp_t mpfr_get_emin_min (void) { return MPFR_EMIN_MIN; } -mp_exp_t +mpfr_exp_t mpfr_get_emin_max (void) { return MPFR_EMIN_MAX; @@ -65,7 +65,7 @@ mpfr_get_emin_max (void) #undef mpfr_get_emax -mp_exp_t +mpfr_exp_t mpfr_get_emax (void) { return __gmpfr_emax; @@ -74,7 +74,7 @@ mpfr_get_emax (void) #undef mpfr_set_emax int -mpfr_set_emax (mp_exp_t exponent) +mpfr_set_emax (mpfr_exp_t exponent) { if (exponent >= MPFR_EMAX_MIN && exponent <= MPFR_EMAX_MAX) { @@ -87,12 +87,12 @@ mpfr_set_emax (mp_exp_t exponent) } } -mp_exp_t +mpfr_exp_t mpfr_get_emax_min (void) { return MPFR_EMAX_MIN; } -mp_exp_t +mpfr_exp_t mpfr_get_emax_max (void) { return MPFR_EMAX_MAX; @@ -195,7 +195,7 @@ mpfr_check_range (mpfr_ptr x, int t, mpfr_rnd_t rnd_mode) { if (MPFR_LIKELY( MPFR_IS_PURE_FP(x)) ) { /* x is a non-zero FP */ - mp_exp_t exp = MPFR_EXP (x); /* Do not use MPFR_GET_EXP */ + mpfr_exp_t exp = MPFR_EXP (x); /* Do not use MPFR_GET_EXP */ if (MPFR_UNLIKELY( exp < __gmpfr_emin) ) { /* The following test is necessary because in the rounding to the @@ -27,7 +27,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., int mpfr_exp (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { - mp_exp_t expx; + mpfr_exp_t expx; mpfr_prec_t precy; int inexact; MPFR_SAVE_EXPO_DECL (expo); @@ -65,7 +65,7 @@ mpfr_exp (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) /* We must extended the exponent range and save the flags now. */ MPFR_SAVE_EXPO_MARK (expo); - mpfr_init2 (e, sizeof (mp_exp_t) * CHAR_BIT); + mpfr_init2 (e, sizeof (mpfr_exp_t) * CHAR_BIT); mpfr_init2 (bound, 32); inexact = mpfr_set_exp_t (e, expo.saved_emax, MPFR_RNDN); @@ -107,8 +107,8 @@ mpfr_exp (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) /* if x < 2^(-precy), then exp(x) i.e. gives 1 +/- 1 ulp(1) */ if (MPFR_UNLIKELY (expx < 0 && (mpfr_uexp_t) (-expx) > precy)) { - mp_exp_t emin = __gmpfr_emin; - mp_exp_t emax = __gmpfr_emax; + mpfr_exp_t emin = __gmpfr_emin; + mpfr_exp_t emax = __gmpfr_emax; int signx = MPFR_SIGN (x); MPFR_SET_POS (y); @@ -101,7 +101,7 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) /* Declaration of the size variable */ mpfr_prec_t Ny = MPFR_PREC(y); /* target precision */ mpfr_prec_t Nt; /* working precision */ - mp_exp_t err; /* error */ + mpfr_exp_t err; /* error */ MPFR_ZIV_DECL (loop); /* compute the precision of intermediary variable */ @@ -45,7 +45,7 @@ mpfr_exp_rational (mpfr_ptr y, mpz_ptr p, long r, int m, unsigned long n, i, j; mpz_t *S, *ptoj; mpfr_prec_t *log2_nb_terms; - mp_exp_t diff, expo; + mpfr_exp_t diff, expo; mpfr_prec_t precy = MPFR_PREC(y), prec_i_have, prec_ptoj; int k, l; @@ -127,7 +127,7 @@ mpfr_exp_rational (mpfr_ptr y, mpz_ptr p, long r, int m, /* Q[0] now equals i! */ MPFR_MPZ_SIZEINBASE2 (prec_i_have, S[0]); - diff = (mp_exp_t) prec_i_have - 2 * (mp_exp_t) precy; + diff = (mpfr_exp_t) prec_i_have - 2 * (mpfr_exp_t) precy; expo = diff; if (diff >= 0) mpz_fdiv_q_2exp (S[0], S[0], diff); @@ -135,7 +135,7 @@ mpfr_exp_rational (mpfr_ptr y, mpz_ptr p, long r, int m, mpz_mul_2exp (S[0], S[0], -diff); MPFR_MPZ_SIZEINBASE2 (prec_i_have, Q[0]); - diff = (mp_exp_t) prec_i_have - (mpfr_prec_t) precy; + diff = (mpfr_exp_t) prec_i_have - (mpfr_prec_t) precy; expo -= diff; if (diff > 0) mpz_fdiv_q_2exp (Q[0], Q[0], diff); @@ -154,7 +154,7 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { mpfr_t t, x_copy, tmp; mpz_t uk; - mp_exp_t ttt, shift_x; + mpfr_exp_t ttt, shift_x; unsigned long twopoweri; mpz_t *P; mpfr_prec_t *mult; @@ -288,7 +288,7 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) if (MPFR_UNLIKELY (scaled && MPFR_IS_PURE_FP (y))) { int inex2; - mp_exp_t ey; + mpfr_exp_t ey; /* The result has been scaled and needs to be corrected. */ ey = MPFR_GET_EXP (y); @@ -26,13 +26,13 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-impl.h" static unsigned long -mpfr_exp2_aux (mpz_t, mpfr_srcptr, mpfr_prec_t, mp_exp_t *); +mpfr_exp2_aux (mpz_t, mpfr_srcptr, mpfr_prec_t, mpfr_exp_t *); static unsigned long -mpfr_exp2_aux2 (mpz_t, mpfr_srcptr, mpfr_prec_t, mp_exp_t *); -static mp_exp_t -mpz_normalize (mpz_t, mpz_t, mp_exp_t); -static mp_exp_t -mpz_normalize2 (mpz_t, mpz_t, mp_exp_t, mp_exp_t); +mpfr_exp2_aux2 (mpz_t, mpfr_srcptr, mpfr_prec_t, mpfr_exp_t *); +static mpfr_exp_t +mpz_normalize (mpz_t, mpz_t, mpfr_exp_t); +static mpfr_exp_t +mpz_normalize2 (mpz_t, mpz_t, mpfr_exp_t, mpfr_exp_t); #define MY_INIT_MPZ(x, s) { \ (x)->_mp_alloc = (s); \ @@ -42,8 +42,8 @@ mpz_normalize2 (mpz_t, mpz_t, mp_exp_t, mp_exp_t); /* if k = the number of bits of z > q, divides z by 2^(k-q) and returns k-q. Otherwise do nothing and return 0. */ -static mp_exp_t -mpz_normalize (mpz_t rop, mpz_t z, mp_exp_t q) +static mpfr_exp_t +mpz_normalize (mpz_t rop, mpz_t z, mpfr_exp_t q) { size_t k; @@ -52,7 +52,7 @@ mpz_normalize (mpz_t rop, mpz_t z, mp_exp_t q) if (q < 0 || (mpfr_uexp_t) k > (mpfr_uexp_t) q) { mpz_fdiv_q_2exp (rop, z, (unsigned long) ((mpfr_uexp_t) k - q)); - return (mp_exp_t) k - q; + return (mpfr_exp_t) k - q; } if (MPFR_UNLIKELY(rop != z)) mpz_set(rop, z); @@ -63,8 +63,8 @@ mpz_normalize (mpz_t rop, mpz_t z, mp_exp_t q) if expz < target, shift z by (target-expz) bits to the right. Returns target. */ -static mp_exp_t -mpz_normalize2 (mpz_t rop, mpz_t z, mp_exp_t expz, mp_exp_t target) +static mpfr_exp_t +mpz_normalize2 (mpz_t rop, mpz_t z, mpfr_exp_t expz, mpfr_exp_t target) { if (target > expz) mpz_fdiv_q_2exp (rop, z, target-expz); @@ -85,7 +85,7 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) long n; unsigned long K, k, l, err; /* FIXME: Which type ? */ int error_r; - mp_exp_t exps; + mpfr_exp_t exps; mpfr_prec_t q, precy; int inexact; mpfr_t r, s; @@ -169,7 +169,7 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) if (MPFR_IS_PURE_FP (r)) { - mp_exp_t cancel; + mpfr_exp_t cancel; /* number of cancelled bits */ cancel = MPFR_GET_EXP (x) - MPFR_GET_EXP (r); @@ -248,10 +248,10 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) since mpz_mul_2exp(s, s, q-1) reallocates qn+1 limbs) */ static unsigned long -mpfr_exp2_aux (mpz_t s, mpfr_srcptr r, mpfr_prec_t q, mp_exp_t *exps) +mpfr_exp2_aux (mpz_t s, mpfr_srcptr r, mpfr_prec_t q, mpfr_exp_t *exps) { unsigned long l; - mp_exp_t dif, expt, expr; + mpfr_exp_t dif, expt, expr; mp_size_t qn; mpz_t t, rr; mp_size_t sbit, tbit; @@ -262,7 +262,7 @@ mpfr_exp2_aux (mpz_t s, mpfr_srcptr r, mpfr_prec_t q, mp_exp_t *exps) MPFR_TMP_MARK(marker); qn = 1 + (q-1)/GMP_NUMB_BITS; expt = 0; - *exps = 1 - (mp_exp_t) q; /* s = 2^(q-1) */ + *exps = 1 - (mpfr_exp_t) q; /* s = 2^(q-1) */ MY_INIT_MPZ(t, 2*qn+1); MY_INIT_MPZ(rr, qn+1); mpz_set_ui(t, 1); @@ -279,7 +279,7 @@ mpfr_exp2_aux (mpz_t s, mpfr_srcptr r, mpfr_prec_t q, mp_exp_t *exps) MPFR_MPZ_SIZEINBASE2 (tbit, t); dif = *exps + sbit - expt - tbit; /* truncates the bits of t which are < ulp(s) = 2^(1-q) */ - expt += mpz_normalize(t, t, (mp_exp_t) q-dif); /* error at most 2^(1-q) */ + expt += mpz_normalize(t, t, (mpfr_exp_t) q-dif); /* error at most 2^(1-q) */ mpz_fdiv_q_ui (t, t, l); /* error at most 2^(1-q) */ /* the error wrt t^l/l! is here at most 3*l*ulp(s) */ MPFR_ASSERTD (expt == *exps); @@ -306,9 +306,9 @@ mpfr_exp2_aux (mpz_t s, mpfr_srcptr r, mpfr_prec_t q, mp_exp_t *exps) The error is bounded by (l^2+4*l) ulps where l is the return value. */ static unsigned long -mpfr_exp2_aux2 (mpz_t s, mpfr_srcptr r, mpfr_prec_t q, mp_exp_t *exps) +mpfr_exp2_aux2 (mpz_t s, mpfr_srcptr r, mpfr_prec_t q, mpfr_exp_t *exps) { - mp_exp_t expr, *expR, expt; + mpfr_exp_t expr, *expR, expt; mp_size_t sizer; mpfr_prec_t ql; unsigned long l, m, i; @@ -326,7 +326,7 @@ mpfr_exp2_aux2 (mpz_t s, mpfr_srcptr r, mpfr_prec_t q, mp_exp_t *exps) MPFR_TMP_MARK(marker); R = (mpz_t*) MPFR_TMP_ALLOC((m + 1) * sizeof(mpz_t)); /* R[i] is r^i */ - expR = (mp_exp_t*) MPFR_TMP_ALLOC((m + 1) * sizeof(mp_exp_t)); + expR = (mpfr_exp_t*) MPFR_TMP_ALLOC((m + 1) * sizeof(mpfr_exp_t)); /* expR[i] is the exponent for R[i] */ sizer = MPFR_LIMB_SIZE(r); mpz_init (tmp); @@ -31,7 +31,7 @@ int mpfr_expm1 (mpfr_ptr y, mpfr_srcptr x , mpfr_rnd_t rnd_mode) { int inexact; - mp_exp_t ex; + mpfr_exp_t ex; MPFR_SAVE_EXPO_DECL (expo); if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) @@ -78,7 +78,7 @@ mpfr_expm1 (mpfr_ptr y, mpfr_srcptr x , mpfr_rnd_t rnd_mode) if (MPFR_IS_NEG (x) && ex > 5) /* x <= -32 */ { mpfr_t minus_one, t; - mp_exp_t err; + mpfr_exp_t err; mpfr_init2 (minus_one, 2); mpfr_init2 (t, 64); @@ -105,7 +105,7 @@ mpfr_expm1 (mpfr_ptr y, mpfr_srcptr x , mpfr_rnd_t rnd_mode) /* Declaration of the size variable */ mpfr_prec_t Ny = MPFR_PREC(y); /* target precision */ mpfr_prec_t Nt; /* working precision */ - mp_exp_t err, exp_te; /* error */ + mpfr_exp_t err, exp_te; /* error */ MPFR_ZIV_DECL (loop); /* compute the precision of intermediary variable */ diff --git a/fits_intmax.c b/fits_intmax.c index 37303529f..603d0b342 100644 --- a/fits_intmax.c +++ b/fits_intmax.c @@ -47,7 +47,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., int mpfr_fits_intmax_p (mpfr_srcptr f, mpfr_rnd_t rnd) { - mp_exp_t e; + mpfr_exp_t e; int prec; mpfr_t x, y; int neg; @@ -26,7 +26,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., int FUNCTION (mpfr_srcptr f, mpfr_rnd_t rnd) { - mp_exp_t e; + mpfr_exp_t e; int prec; mpfr_t x; int neg; @@ -25,7 +25,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., int FUNCTION (mpfr_srcptr f, mpfr_rnd_t rnd) { - mp_exp_t e; + mpfr_exp_t e; int prec; TYPE s; mpfr_t x; diff --git a/fits_uintmax.c b/fits_uintmax.c index 9a8ebe861..c8fe878ef 100644 --- a/fits_uintmax.c +++ b/fits_uintmax.c @@ -47,7 +47,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., int mpfr_fits_uintmax_p (mpfr_srcptr f, mpfr_rnd_t rnd) { - mp_exp_t e; + mpfr_exp_t e; int prec; uintmax_t s; mpfr_t x; @@ -197,7 +197,7 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z, unsigned long scale = 0; mpfr_t scaled_z; mpfr_srcptr new_z; - mp_exp_t diffexp; + mpfr_exp_t diffexp; mpfr_prec_t pzs; int xy_underflows; @@ -199,7 +199,7 @@ mpfr_fms (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z, unsigned long scale = 0; mpfr_t scaled_z; mpfr_srcptr new_z; - mp_exp_t diffexp; + mpfr_exp_t diffexp; mpfr_prec_t pzs; int xy_underflows; @@ -30,7 +30,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., int mpfr_frac (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) { - mp_exp_t re, ue; + mpfr_exp_t re, ue; mpfr_prec_t uq; mp_size_t un, tn, t0; mp_limb_t *up, *tp, k; @@ -160,7 +160,7 @@ mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mpfr_rnd_t rnd_mode) If x < 2^E, then y > 2^(-E), thus ufp(y) > 2^(-E-1). A sufficient condition is thus EXP(x) + 2 <= -2 MAX(PREC(x),PREC(Y)). */ - if (MPFR_EXP(x) + 2 <= -2 * (mp_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(gamma))) + if (MPFR_EXP(x) + 2 <= -2 * (mpfr_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(gamma))) { int positive = MPFR_IS_POS (x); inex = mpfr_ui_div (gamma, 1, x, rnd_mode); @@ -338,7 +338,7 @@ mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mpfr_rnd_t rnd_mode) MPFR_ZIV_INIT (loop, realprec); for (;;) { - mp_exp_t err_g; + mpfr_exp_t err_g; int ck; MPFR_GROUP_REPREC_4 (group, realprec, xp, tmp, tmp2, GammaTrial); @@ -37,7 +37,7 @@ mpfr_get_d (mpfr_srcptr src, mpfr_rnd_t rnd_mode) { double d; int negative; - mp_exp_t e; + mpfr_exp_t e; if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (src))) { @@ -135,7 +135,7 @@ double mpfr_get_d_2exp (long *expptr, mpfr_srcptr src, mpfr_rnd_t rnd_mode) { double ret; - mp_exp_t exp; + mpfr_exp_t exp; mpfr_t tmp; if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (src))) @@ -297,7 +297,7 @@ _Decimal64 mpfr_get_decimal64 (mpfr_srcptr src, mpfr_rnd_t rnd_mode) { int negative; - mp_exp_t e; + mpfr_exp_t e; /* the encoding of NaN, Inf, zero is the same under DPD or BID */ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (src))) @@ -363,7 +363,7 @@ mpfr_get_decimal64 (mpfr_srcptr src, mpfr_rnd_t rnd_mode) } else { - mp_exp_t e2; + mpfr_exp_t e2; long digits = 16 - (-382 - e); /* if e = -397 then 16 - (-382 - e) = 1 */ mpfr_get_str (s, &e2, 10, digits, src, rnd_mode); @@ -23,7 +23,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-impl.h" #undef mpfr_get_exp -mp_exp_t +mpfr_exp_t mpfr_get_exp (mpfr_srcptr x) { MPFR_ASSERTN(MPFR_IS_PURE_FP(x)); @@ -35,7 +35,7 @@ float mpfr_get_flt (mpfr_srcptr src, mpfr_rnd_t rnd_mode) { int negative; - mp_exp_t e; + mpfr_exp_t e; float d; /* in case of NaN, +Inf, -Inf, +0, -0, the conversion from double to float @@ -38,7 +38,7 @@ mpfr_get_ld (mpfr_srcptr x, mpfr_rnd_t rnd_mode) long double r; /* result */ long double m; double s; /* part of result */ - mp_exp_t sh; /* exponent shift, so that x/2^sh is in the double range */ + mpfr_exp_t sh; /* exponent shift, so that x/2^sh is in the double range */ mpfr_t y, z; int sign; @@ -124,7 +124,7 @@ mpfr_get_ld (mpfr_srcptr x, mpfr_rnd_t rnd_mode) else { mp_limb_t *tmpmant; - mp_exp_t e, denorm; + mpfr_exp_t e, denorm; tmpmant = MPFR_MANT (tmp); e = MPFR_GET_EXP (tmp); @@ -177,7 +177,7 @@ long double mpfr_get_ld_2exp (long *expptr, mpfr_srcptr src, mpfr_rnd_t rnd_mode) { long double ret; - mp_exp_t exp; + mpfr_exp_t exp; mpfr_t tmp; if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (src))) @@ -52,7 +52,7 @@ mpfr_get_si (mpfr_srcptr f, mpfr_rnd_t rnd) { mp_limb_t a; mp_size_t n; - mp_exp_t exp; + mpfr_exp_t exp; /* now the result is in the most significant limb of x */ exp = MPFR_GET_EXP (x); /* since |x| >= 1, exp >= 1 */ @@ -24,8 +24,8 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" -static int mpfr_get_str_aux (char *const, mp_exp_t *const, mp_limb_t *const, - mp_size_t, mp_exp_t, long, int, size_t, mpfr_rnd_t); +static int mpfr_get_str_aux (char *const, mpfr_exp_t *const, mp_limb_t *const, + mp_size_t, mpfr_exp_t, long, int, size_t, mpfr_rnd_t); /* The implicit \0 is useless, but we do not write num_to_text[62] otherwise g++ complains. */ @@ -73,8 +73,8 @@ static const char num_to_text62[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" - MPFR_ROUND_FAILED otherwise (too large error) */ static int -mpfr_get_str_aux (char *const str, mp_exp_t *const exp, mp_limb_t *const r, - mp_size_t n, mp_exp_t f, long e, int b, size_t m, +mpfr_get_str_aux (char *const str, mpfr_exp_t *const exp, mp_limb_t *const r, + mp_size_t n, mpfr_exp_t f, long e, int b, size_t m, mpfr_rnd_t rnd) { const char *num_to_text; @@ -2205,15 +2205,15 @@ const __mpfr_struct __gmpfr_l2b[BASE_MAX-1][2] = { For i=0, uses a 23-bit upper approximation to log(beta)/log(2). For i=1, uses a 76-bit upper approximation to log(2)/log(beta). */ -static mp_exp_t -ceil_mul (mp_exp_t e, int beta, int i) +static mpfr_exp_t +ceil_mul (mpfr_exp_t e, int beta, int i) { mpfr_srcptr p; mpfr_t t; - mp_exp_t r; + mpfr_exp_t r; p = &__gmpfr_l2b[beta-2][i]; - mpfr_init2 (t, sizeof (mp_exp_t) * CHAR_BIT); + mpfr_init2 (t, sizeof (mpfr_exp_t) * CHAR_BIT); mpfr_set_exp_t (t, e, MPFR_RNDU); mpfr_mul (t, t, p, MPFR_RNDU); r = mpfr_get_exp_t (t, MPFR_RNDU); @@ -2235,15 +2235,15 @@ ceil_mul (mp_exp_t e, int beta, int i) the memory space allocated, with free(s, strlen(s)). */ char* -mpfr_get_str (char *s, mp_exp_t *e, int b, size_t m, mpfr_srcptr x, mpfr_rnd_t rnd) +mpfr_get_str (char *s, mpfr_exp_t *e, int b, size_t m, mpfr_srcptr x, mpfr_rnd_t rnd) { const char *num_to_text; int exact; /* exact result */ - mp_exp_t exp, g; - mp_exp_t prec; /* precision of the computation */ + mpfr_exp_t exp, g; + mpfr_exp_t prec; /* precision of the computation */ long err; mp_limb_t *a; - mp_exp_t exp_a; + mpfr_exp_t exp_a; mp_limb_t *result; mp_limb_t *xp; mp_limb_t *reste; @@ -2331,7 +2331,7 @@ mpfr_get_str (char *s, mp_exp_t *e, int b, size_t m, mpfr_srcptr x, mpfr_rnd_t r if (IS_POW2(b)) { int pow2; - mp_exp_t f, r; + mpfr_exp_t f, r; mp_limb_t *x1; mp_size_t nb; int inexp; @@ -2403,10 +2403,10 @@ mpfr_get_str (char *s, mp_exp_t *e, int b, size_t m, mpfr_srcptr x, mpfr_rnd_t r g = ceil_mul (MPFR_GET_EXP (x) - 1, b, 1); exact = 1; prec = ceil_mul (m, b, 0) + 1; - exp = ((mp_exp_t) m < g) ? g - (mp_exp_t) m : (mp_exp_t) m - g; + exp = ((mpfr_exp_t) m < g) ? g - (mpfr_exp_t) m : (mpfr_exp_t) m - g; prec += MPFR_INT_CEIL_LOG2 (prec); /* number of guard bits */ if (exp != 0) /* add maximal exponentiation error */ - prec += 3 * (mp_exp_t) MPFR_INT_CEIL_LOG2 (exp); + prec += 3 * (mpfr_exp_t) MPFR_INT_CEIL_LOG2 (exp); MPFR_ZIV_INIT (loop, prec); for (;;) @@ -2423,7 +2423,7 @@ mpfr_get_str (char *s, mp_exp_t *e, int b, size_t m, mpfr_srcptr x, mpfr_rnd_t r nx = 1 + (MPFR_PREC(x) - 1) / GMP_NUMB_BITS; - if ((mp_exp_t) m == g) /* final exponent is 0, no multiplication or + if ((mpfr_exp_t) m == g) /* final exponent is 0, no multiplication or division to perform */ { if (nx > n) @@ -2432,7 +2432,7 @@ mpfr_get_str (char *s, mp_exp_t *e, int b, size_t m, mpfr_srcptr x, mpfr_rnd_t r MPN_COPY2 (a, n, xp, nx); exp_a = MPFR_GET_EXP (x) - n * GMP_NUMB_BITS; } - else if ((mp_exp_t) m > g) /* we have to multiply x by b^exp */ + else if ((mpfr_exp_t) m > g) /* we have to multiply x by b^exp */ { mp_limb_t *x1; @@ -2523,7 +2523,7 @@ mpfr_get_str (char *s, mp_exp_t *e, int b, size_t m, mpfr_srcptr x, mpfr_rnd_t r else if (ret == -MPFR_ROUND_FAILED) { /* too many digits in mantissa: exp = |m-g| */ - if ((mp_exp_t) m > g) /* exp = m - g, multiply by b^exp */ + if ((mpfr_exp_t) m > g) /* exp = m - g, multiply by b^exp */ { g++; exp --; @@ -29,7 +29,7 @@ mpfr_get_ui (mpfr_srcptr f, mpfr_rnd_t rnd) unsigned long s; mpfr_t x; mp_size_t n; - mp_exp_t exp; + mpfr_exp_t exp; if (!mpfr_fits_ulong_p (f, rnd)) { @@ -28,11 +28,11 @@ mpfr_get_z (mpz_ptr z, mpfr_srcptr f, mpfr_rnd_t rnd) { int inex; mpfr_t r; - mp_exp_t exp = MPFR_EXP (f); + mpfr_exp_t exp = MPFR_EXP (f); /* if exp <= 0, then |f|<1, thus |o(f)|<=1 */ MPFR_ASSERTN (exp < 0 || exp <= MPFR_PREC_MAX); - mpfr_init2 (r, (exp < (mp_exp_t) MPFR_PREC_MIN ? + mpfr_init2 (r, (exp < (mpfr_exp_t) MPFR_PREC_MIN ? MPFR_PREC_MIN : (mpfr_prec_t) exp)); inex = mpfr_rint (r, f, rnd); MPFR_ASSERTN (inex != 1 && inex != -1); /* integral part of f is diff --git a/get_z_exp.c b/get_z_exp.c index 8d4f31dd7..7d1cbd250 100644 --- a/get_z_exp.c +++ b/get_z_exp.c @@ -35,7 +35,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., * Note that this is different from the C function frexp(). */ -mp_exp_t +mpfr_exp_t mpfr_get_z_2exp (mpz_ptr z, mpfr_srcptr f) { mp_size_t fn; @@ -141,9 +141,9 @@ mpfr_div_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mpfr_rnd_t rnd_mode) int mpfr_add_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mpfr_rnd_t rnd_mode) { - mpfr_t t,q; + mpfr_t t,q; mpfr_prec_t p; - mp_exp_t err; + mpfr_exp_t err; int res; MPFR_ZIV_DECL (loop); @@ -194,7 +194,7 @@ mpfr_add_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mpfr_rnd_t rnd_mode) /* We can get 0, but we can't round since q is inexact */ if (MPFR_LIKELY (!MPFR_IS_ZERO (t))) { - err = (mp_exp_t) p - 1 - MAX (MPFR_GET_EXP(q)-MPFR_GET_EXP(t), 0); + err = (mpfr_exp_t) p - 1 - MAX (MPFR_GET_EXP(q)-MPFR_GET_EXP(t), 0); if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, MPFR_PREC (y), rnd_mode))) { res = mpfr_set (y, t, rnd_mode); @@ -217,7 +217,7 @@ mpfr_sub_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z,mpfr_rnd_t rnd_mode) mpfr_t t,q; mpfr_prec_t p; int res; - mp_exp_t err; + mpfr_exp_t err; MPFR_ZIV_DECL (loop); if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) @@ -272,7 +272,7 @@ mpfr_sub_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z,mpfr_rnd_t rnd_mode) /* We can get 0, but we can't round since q is inexact */ if (MPFR_LIKELY (!MPFR_IS_ZERO (t))) { - err = (mp_exp_t) p - 1 - MAX (MPFR_GET_EXP(q)-MPFR_GET_EXP(t), 0); + err = (mpfr_exp_t) p - 1 - MAX (MPFR_GET_EXP(q)-MPFR_GET_EXP(t), 0); res = MPFR_CAN_ROUND (t, err, MPFR_PREC (y), rnd_mode); if (MPFR_LIKELY (res != 0)) /* We can round! */ { @@ -34,7 +34,7 @@ mpfr_hypot (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode) mpfr_prec_t N, Nz; /* size variables */ mpfr_prec_t Nt; /* precision of the intermediary variable */ mpfr_prec_t threshold; - mp_exp_t Ex, sh; + mpfr_exp_t Ex, sh; mpfr_uexp_t diff_exp; MPFR_SAVE_EXPO_DECL (expo); diff --git a/isinteger.c b/isinteger.c index 73976f5a5..c373e8b56 100644 --- a/isinteger.c +++ b/isinteger.c @@ -26,7 +26,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., int mpfr_integer_p (mpfr_srcptr x) { - mp_exp_t expo; + mpfr_exp_t expo; mpfr_prec_t prec; mp_size_t xn; mp_limb_t *xp; @@ -78,7 +78,7 @@ mpfr_jn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r) int inex; unsigned long absn; mpfr_prec_t prec, pbound, err; - mp_exp_t exps, expT; + mpfr_exp_t exps, expT; mpfr_t y, s, t, absz; unsigned long k, zz, k0; MPFR_ZIV_DECL (loop); @@ -162,7 +162,7 @@ mpfr_jn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r) Warning: absn is an unsigned long. */ if ((MPFR_EXP(y) < 0 && absn > (unsigned long) (-__gmpfr_emin)) || (absn <= (unsigned long) (-MPFR_EMIN_MIN) && - MPFR_EXP(y) < __gmpfr_emin / (mp_exp_t) absn)) + MPFR_EXP(y) < __gmpfr_emin / (mpfr_exp_t) absn)) { mpfr_clear (y); return mpfr_underflow (res, (r == MPFR_RNDN) ? MPFR_RNDZ : r, @@ -216,7 +216,7 @@ mpfr_jn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r) exps = MPFR_EXP (s); if (exps > expT) expT = exps; - if (MPFR_EXP (t) + (mp_exp_t) prec <= MPFR_EXP (s) && + if (MPFR_EXP (t) + (mpfr_exp_t) prec <= MPFR_EXP (s) && zz / (2 * k) < k + n) break; } diff --git a/jyn_asympt.c b/jyn_asympt.c index f936f91af..bf4b47ccf 100644 --- a/jyn_asympt.c +++ b/jyn_asympt.c @@ -44,7 +44,7 @@ FUNCTION (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r) mpfr_prec_t w; long k; int inex, stop, diverge = 0; - mp_exp_t err2, err; + mpfr_exp_t err2, err; MPFR_ZIV_DECL (loop); mpfr_init (c); @@ -36,7 +36,7 @@ li2_series (mpfr_t sum, mpfr_srcptr z, mpfr_rnd_t rnd_mode) int i, Bm, Bmax; mpfr_t s, u, v, w; mpfr_prec_t sump, p; - mp_exp_t se, err; + mpfr_exp_t se, err; mpz_t *B; MPFR_ZIV_DECL (loop); @@ -87,7 +87,7 @@ li2_series (mpfr_t sum, mpfr_srcptr z, mpfr_rnd_t rnd_mode) - MPFR_GET_EXP (s); err = 2 + MAX (-1, err); se = MPFR_GET_EXP (s); - if (MPFR_GET_EXP (w) <= se - (mp_exp_t) p) + if (MPFR_GET_EXP (w) <= se - (mpfr_exp_t) p) break; } @@ -95,7 +95,7 @@ li2_series (mpfr_t sum, mpfr_srcptr z, mpfr_rnd_t rnd_mode) the truncation error is less than EXP(z) - 6 * i - 5 (see algorithms.tex) */ err = MAX (err, MPFR_GET_EXP (z) - 6 * i - 5) + 1; - if (MPFR_CAN_ROUND (s, (mp_exp_t) p - err, sump, rnd_mode)) + if (MPFR_CAN_ROUND (s, (mpfr_exp_t) p - err, sump, rnd_mode)) break; MPFR_ZIV_NEXT (loop, p); @@ -159,7 +159,7 @@ mpfr_li2_asympt_pos (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) If in addition 2/x <= 2 ulp(g), i.e., 1/x <= ulp(g), then the total error is bounded by 16 ulp(g). */ - if ((MPFR_EXP (x) >= (mp_exp_t) w - MPFR_EXP (g)) && + if ((MPFR_EXP (x) >= (mpfr_exp_t) w - MPFR_EXP (g)) && MPFR_CAN_ROUND (g, w - 4, MPFR_PREC (y), rnd_mode)) inex = mpfr_set (y, g, rnd_mode); @@ -202,7 +202,7 @@ mpfr_li2_asympt_neg (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) If in addition |1/x| <= 4 ulp(g), then the total error is bounded by 16 ulp(g). */ - if ((MPFR_EXP (x) >= (mp_exp_t) (w - 2) - MPFR_EXP (g)) && + if ((MPFR_EXP (x) >= (mpfr_exp_t) (w - 2) - MPFR_EXP (g)) && MPFR_CAN_ROUND (g, w - 4, MPFR_PREC (y), rnd_mode)) inex = mpfr_neg (y, g, rnd_mode); @@ -218,7 +218,7 @@ int mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { int inexact; - mp_exp_t err; + mpfr_exp_t err; mpfr_prec_t yp, m; MPFR_ZIV_DECL (loop); MPFR_SAVE_EXPO_DECL (expo); @@ -265,7 +265,7 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) /* 0 < x <= 1/2: Li2(x) = S(-log(1-x))-log^2(1-x)/4 */ { mpfr_t s, u; - mp_exp_t expo_l; + mpfr_exp_t expo_l; int k; mpfr_init2 (u, m); @@ -291,7 +291,7 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) + 2^(3 + MAX(1, - expo_l) - EXP(s))) ulp(s) */ err = MAX (err, MAX (1, - expo_l) - 1) - MPFR_GET_EXP (s); err = 2 + MAX (-1, err); - if (MPFR_CAN_ROUND (s, (mp_exp_t) m - err, yp, rnd_mode)) + if (MPFR_CAN_ROUND (s, (mpfr_exp_t) m - err, yp, rnd_mode)) break; next_m: @@ -338,7 +338,7 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) /* x >= 2: Li2(x) = -S(-log(1-1/x))-log^2(x)/2+log^2(1-1/x)/4+pi^2/3 */ { int k; - mp_exp_t expo_l; + mpfr_exp_t expo_l; mpfr_t s, u, xx; if (mpfr_cmp_ui (x, 38) >= 0) @@ -387,7 +387,7 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) mpfr_add (s, s, u, MPFR_RNDN); err = MAX (err, 2) - MPFR_GET_EXP (s); err = 2 + MAX (-1, err); /* error(s) <= 2^err ulp(s) */ - if (MPFR_CAN_ROUND (s, (mp_exp_t) m - err, yp, rnd_mode)) + if (MPFR_CAN_ROUND (s, (mpfr_exp_t) m - err, yp, rnd_mode)) break; MPFR_ZIV_NEXT (loop, m); @@ -407,7 +407,7 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) /* 2 > x > 1: Li2(x) = S(log(x))+log^2(x)/4-log(x)log(x-1)+pi^2/6 */ { int k; - mp_exp_t e1, e2; + mpfr_exp_t e1, e2; mpfr_t s, u, v, xx; mpfr_init2 (s, m); mpfr_init2 (u, m); @@ -439,7 +439,7 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) see algorithms.tex */ err = MAX (MPFR_INT_CEIL_LOG2 (k + 1) + 1 - e1, 1 - e2); err = 2 + MAX (5, err); - if (MPFR_CAN_ROUND (s, (mp_exp_t) m - err, yp, rnd_mode)) + if (MPFR_CAN_ROUND (s, (mpfr_exp_t) m - err, yp, rnd_mode)) break; MPFR_ZIV_NEXT (loop, m); @@ -495,7 +495,7 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) err = MAX (err, 3) - MPFR_GET_EXP (s); err = 2 + MAX (-1, err); - if (MPFR_CAN_ROUND (s, (mp_exp_t) m - err, yp, rnd_mode)) + if (MPFR_CAN_ROUND (s, (mpfr_exp_t) m - err, yp, rnd_mode)) break; MPFR_ZIV_NEXT (loop, m); @@ -515,7 +515,7 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) /* 0 > x >= -1: Li2(x) = -S(log(1-x))-log^2(1-x)/4 */ { int k; - mp_exp_t expo_l; + mpfr_exp_t expo_l; mpfr_t s, u, xx; mpfr_init2 (s, m); mpfr_init2 (u, m); @@ -536,7 +536,7 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) mpfr_sub (s, s, u, MPFR_RNDN); err = MAX (err, - expo_l); err = 2 + MAX (err, 3); - if (MPFR_CAN_ROUND (s, (mp_exp_t) m - err, yp, rnd_mode)) + if (MPFR_CAN_ROUND (s, (mpfr_exp_t) m - err, yp, rnd_mode)) break; MPFR_ZIV_NEXT (loop, m); @@ -608,7 +608,7 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) err = MAX (err, 3) - MPFR_GET_EXP (s); err = 2 + MAX (-1, err) + MPFR_GET_EXP (s); - if (MPFR_CAN_ROUND (s, (mp_exp_t) m - err, yp, rnd_mode)) + if (MPFR_CAN_ROUND (s, (mpfr_exp_t) m - err, yp, rnd_mode)) break; MPFR_ZIV_NEXT (loop, m); @@ -53,7 +53,7 @@ mpfr_gamma_alpha (mpfr_t s, mpfr_prec_t p) static int unit_bit (mpfr_srcptr (x)) { - mp_exp_t expo; + mpfr_exp_t expo; mpfr_prec_t prec; mp_limb_t x0; @@ -100,7 +100,7 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mpfr_rnd_t rnd) unsigned long m, k, maxm; mpz_t *INITIALIZED(B); /* variable B declared as initialized */ int inexact, compared; - mp_exp_t err_s, err_t; + mpfr_exp_t err_s, err_t; unsigned long Bm = 0; /* number of allocated B[] */ unsigned long oldBm; double d; @@ -119,7 +119,7 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mpfr_rnd_t rnd) /* Deal here with tiny inputs. We have for -0.3 <= x <= 0.3: - log|x| - gamma*x <= log|gamma(x)| <= - log|x| - gamma*x + x^2 */ - if (MPFR_EXP(z0) <= - (mp_exp_t) MPFR_PREC(y)) + if (MPFR_EXP(z0) <= - (mpfr_exp_t) MPFR_PREC(y)) { mpfr_t l, h, g; int ok, inex2; @@ -198,7 +198,7 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mpfr_rnd_t rnd) if (compared < 0) { - mp_exp_t err_u; + mpfr_exp_t err_u; /* use reflection formula: gamma(x) = Pi*(x-1)/sin(Pi*(2-x))/gamma(2-x) @@ -373,7 +373,7 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mpfr_rnd_t rnd) /* s:(1+u)^15, t:(1+u)^2, t <= 3/128 */ - for (m = 2; MPFR_GET_EXP(v) + (mp_exp_t) w >= MPFR_GET_EXP(s); m++) + for (m = 2; MPFR_GET_EXP(v) + (mpfr_exp_t) w >= MPFR_GET_EXP(s); m++) { mpfr_mul (t, t, u, MPFR_RNDN); /* (1+u)^(10m-14) */ if (m <= maxm) @@ -468,9 +468,9 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mpfr_rnd_t rnd) We have sqrt(2*Pi)/(z0*(z0+1)*...*(z0+k-1)) <= sqrt(2*Pi)/k! <= 0.5 since k>=3, thus t <= -0.5 and ulp(t) >= 2^(-w). Thus the error on t is bounded by (2.16*k+1.54)*ulp(t). */ - err_t = MPFR_GET_EXP(t) + (mp_exp_t) + err_t = MPFR_GET_EXP(t) + (mpfr_exp_t) __gmpfr_ceil_log2 (2.2 * (double) k + 1.6); - err_s = MPFR_GET_EXP(s) + (mp_exp_t) + err_s = MPFR_GET_EXP(s) + (mpfr_exp_t) __gmpfr_ceil_log2 (2.0 * (double) m + 48.0); mpfr_add (s, s, t, MPFR_RNDN); /* this is a subtraction in fact */ /* the final error in ulp(s) is @@ -586,7 +586,7 @@ mpfr_lgamma (mpfr_ptr y, int *signp, mpfr_srcptr x, mpfr_rnd_t rnd) compute an interval [l,h] such that l <= -log(-x) and -log(-x) - x <= h, and check whether l and h round to the same number for the target precision and rounding modes. */ - if (MPFR_EXP(x) + 1 <= - (mp_exp_t) MPFR_PREC(y)) + if (MPFR_EXP(x) + 1 <= - (mpfr_exp_t) MPFR_PREC(y)) /* since PREC(y) >= 1, this ensures EXP(x) <= -2, thus |x| <= 0.25 < 0.4 */ { @@ -623,7 +623,7 @@ mpfr_lgamma (mpfr_ptr y, int *signp, mpfr_srcptr x, mpfr_rnd_t rnd) return inex; /* if ulp(log(-x)) <= |x| there is no reason to loop, since the width of [l, h] will be at least |x| */ - if (MPFR_EXP(l) < MPFR_EXP(x) + (mp_exp_t) w) + if (MPFR_EXP(l) < MPFR_EXP(x) + (mpfr_exp_t) w) break; w += MPFR_INT_CEIL_LOG2(w) + 3; } @@ -116,7 +116,7 @@ mpfr_log (mpfr_ptr r, mpfr_srcptr a, mpfr_rnd_t rnd_mode) { mp_size_t size; long m; - mp_exp_t cancel; + mpfr_exp_t cancel; /* Calculus of m (depends on p) */ m = (p + 1) / 2 - MPFR_GET_EXP (a) + 1; @@ -92,7 +92,7 @@ mpfr_log10 (mpfr_ptr r, mpfr_srcptr a, mpfr_rnd_t rnd_mode) /* Declaration of the size variable */ mpfr_prec_t Ny = MPFR_PREC(r); /* Precision of output variable */ mpfr_prec_t Nt; /* Precision of the intermediary variable */ - mp_exp_t err; /* Precision of error */ + mpfr_exp_t err; /* Precision of error */ /* compute the precision of intermediary variable */ /* the optimal number of bits : see algorithms.tex */ @@ -30,7 +30,7 @@ int mpfr_log1p (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { int comp, inexact; - mp_exp_t ex; + mpfr_exp_t ex; MPFR_SAVE_EXPO_DECL (expo); if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) @@ -99,7 +99,7 @@ mpfr_log1p (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) /* Declaration of the size variable */ mpfr_prec_t Ny = MPFR_PREC(y); /* target precision */ mpfr_prec_t Nt; /* working precision */ - mp_exp_t err; /* error */ + mpfr_exp_t err; /* error */ MPFR_ZIV_DECL (loop); /* compute the precision of intermediary variable */ @@ -93,7 +93,7 @@ mpfr_log2 (mpfr_ptr r, mpfr_srcptr a, mpfr_rnd_t rnd_mode) /* Declaration of the size variable */ mpfr_prec_t Ny = MPFR_PREC(r); /* target precision */ mpfr_prec_t Nt; /* working precision */ - mp_exp_t err; /* error */ + mpfr_exp_t err; /* error */ MPFR_ZIV_DECL (loop); /* compute the precision of intermediary variable */ diff --git a/mbench/mfv5.cc b/mbench/mfv5.cc index 939800f89..eaa2a76c1 100644 --- a/mbench/mfv5.cc +++ b/mbench/mfv5.cc @@ -71,7 +71,7 @@ build_base (vector<string> &base, const option_test &opt) mpfr_t x; gmp_randstate_t state; const char *str; - mp_exp_t e; + mpfr_exp_t e; char *buffer; mpfr_init2 (x, opt.prec); diff --git a/mbench/mpfr-v6.c b/mbench/mpfr-v6.c index 81ea949cd..8a1854c00 100644 --- a/mbench/mpfr-v6.c +++ b/mbench/mpfr-v6.c @@ -135,7 +135,7 @@ int verbose = 0; void mpf_set_fr (mpf_t dest, mpfr_t src, mp_rnd_t rnd) { - mp_exp_t exp; + mpfr_exp_t exp; char *tmp, *tmp2; long len; @@ -29,7 +29,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., int mpfr_modf (mpfr_ptr iop, mpfr_ptr fop, mpfr_srcptr op, mpfr_rnd_t rnd_mode) { - mp_exp_t ope; + mpfr_exp_t ope; mpfr_prec_t opq; int inexi, inexf; diff --git a/mpfr-impl.h b/mpfr-impl.h index 5613f761b..e415991f5 100644 --- a/mpfr-impl.h +++ b/mpfr-impl.h @@ -204,8 +204,8 @@ extern "C" { #endif __MPFR_DECLSPEC extern MPFR_THREAD_ATTR unsigned int __gmpfr_flags; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mp_exp_t __gmpfr_emin; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mp_exp_t __gmpfr_emax; +__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_exp_t __gmpfr_emin; +__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_exp_t __gmpfr_emax; __MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_prec_t __gmpfr_default_fp_bit_precision; __MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_rnd_t __gmpfr_default_rounding_mode; __MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_pi; @@ -583,10 +583,10 @@ union ieee_double_decimal64 { double d; _Decimal64 d64; }; /* Define limits and unsigned type of exponent. The following definitions * depend on mp_exp_t; if this type changes in GMP, these definitions will - * need to be modified (alternatively, a mpfr_exp_t type could be defined). + * need to be modified. */ #if __GMP_MP_SIZE_T_INT == 1 -typedef unsigned int mpfr_uexp_t; +typedef unsigned int mpfr_uexp_t; # define MPFR_EXP_MAX (INT_MAX) # define MPFR_EXP_MIN (INT_MIN) #else @@ -612,7 +612,7 @@ typedef intmax_t mpfr_eexp_t; /* Invalid exponent value (to track bugs...) */ #define MPFR_EXP_INVALID \ - ((mp_exp_t) 1 << (GMP_NUMB_BITS*sizeof(mp_exp_t)/sizeof(mp_limb_t)-2)) + ((mpfr_exp_t) 1 << (GMP_NUMB_BITS*sizeof(mpfr_exp_t)/sizeof(mp_limb_t)-2)) /* Definition of the exponent limits for MPFR numbers. * These limits are chosen so that if e is such an exponent, then 2e-1 and @@ -1074,8 +1074,8 @@ do { \ typedef struct { unsigned int saved_flags; - mp_exp_t saved_emin; - mp_exp_t saved_emax; + mpfr_exp_t saved_emin; + mpfr_exp_t saved_emax; } mpfr_save_expo_t; #define MPFR_SAVE_EXPO_DECL(x) mpfr_save_expo_t x @@ -1280,7 +1280,7 @@ typedef struct { v=1 or v=x. y is the destination (a mpfr_t), v the value to set (a mpfr_t), - err1+err2 with err2 <= 3 the error term (mp_exp_t's), dir (an int) is + err1+err2 with err2 <= 3 the error term (mpfr_exp_t's), dir (an int) is the direction of the committed error (if dir = 0, it rounds toward 0, if dir=1, it rounds away from 0), rnd the rounding mode. @@ -1291,14 +1291,14 @@ typedef struct { The test is less restrictive than necessary, but the function will finish the check itself. - Note: err1 + err2 is allowed to overflow as mp_exp_t, but it must give + Note: err1 + err2 is allowed to overflow as mpfr_exp_t, but it must give its real value as mpfr_uexp_t. */ #define MPFR_FAST_COMPUTE_IF_SMALL_INPUT(y,v,err1,err2,dir,rnd,extra) \ do { \ mpfr_ptr _y = (y); \ - mp_exp_t _err1 = (err1); \ - mp_exp_t _err2 = (err2); \ + mpfr_exp_t _err1 = (err1); \ + mpfr_exp_t _err2 = (err2); \ if (_err1 > 0) \ { \ mpfr_uexp_t _err = (mpfr_uexp_t) _err1 + _err2; \ @@ -1320,8 +1320,8 @@ typedef struct { #define MPFR_SMALL_INPUT_AFTER_SAVE_EXPO(y,v,err1,err2,dir,rnd,expo,extra) \ do { \ mpfr_ptr _y = (y); \ - mp_exp_t _err1 = (err1); \ - mp_exp_t _err2 = (err2); \ + mpfr_exp_t _err1 = (err1); \ + mpfr_exp_t _err2 = (err2); \ if (_err1 > 0) \ { \ mpfr_uexp_t _err = (mpfr_uexp_t) _err1 + _err2; \ @@ -1614,7 +1614,7 @@ __MPFR_DECLSPEC int mpfr_add1sp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, __MPFR_DECLSPEC int mpfr_sub1sp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t)); __MPFR_DECLSPEC int mpfr_can_round_raw _MPFR_PROTO ((const mp_limb_t *, - mp_size_t, int, mp_exp_t, mpfr_rnd_t, mpfr_rnd_t, mpfr_prec_t)); + mp_size_t, int, mpfr_exp_t, mpfr_rnd_t, mpfr_rnd_t, mpfr_prec_t)); __MPFR_DECLSPEC int mpfr_cmp2 _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr, mpfr_prec_t *)); @@ -1633,11 +1633,11 @@ __MPFR_DECLSPEC int mpfr_powerof2_raw _MPFR_PROTO ((mpfr_srcptr)); __MPFR_DECLSPEC int mpfr_pow_general _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t, int, mpfr_save_expo_t *)); -__MPFR_DECLSPEC void mpfr_setmax _MPFR_PROTO ((mpfr_ptr, mp_exp_t)); -__MPFR_DECLSPEC void mpfr_setmin _MPFR_PROTO ((mpfr_ptr, mp_exp_t)); +__MPFR_DECLSPEC void mpfr_setmax _MPFR_PROTO ((mpfr_ptr, mpfr_exp_t)); +__MPFR_DECLSPEC void mpfr_setmin _MPFR_PROTO ((mpfr_ptr, mpfr_exp_t)); -__MPFR_DECLSPEC long mpfr_mpn_exp _MPFR_PROTO ((mp_limb_t *, mp_exp_t *, int, - mp_exp_t, size_t)); +__MPFR_DECLSPEC long mpfr_mpn_exp _MPFR_PROTO ((mp_limb_t *, mpfr_exp_t *, int, + mpfr_exp_t, size_t)); #ifdef _MPFR_H_HAVE_FILE __MPFR_DECLSPEC void mpfr_fprint_binary _MPFR_PROTO ((FILE *, mpfr_srcptr)); @@ -1687,7 +1687,7 @@ __MPFR_DECLSPEC void mpfr_mulhigh_n _MPFR_PROTO ((mp_ptr, mp_srcptr, __MPFR_DECLSPEC void mpfr_sqrhigh_n _MPFR_PROTO ((mp_ptr, mp_srcptr, mp_size_t)); __MPFR_DECLSPEC int mpfr_round_p _MPFR_PROTO ((mp_limb_t *, mp_size_t, - mp_exp_t, mpfr_prec_t)); + mpfr_exp_t, mpfr_prec_t)); __MPFR_DECLSPEC void mpfr_dump_mant _MPFR_PROTO ((const mp_limb_t *, mpfr_prec_t, mpfr_prec_t, @@ -108,8 +108,8 @@ typedef enum { #endif /* Let's make mpfr_prec_t signed in order to avoid problems due to the - usual arithmetic conversions when mixing mpfr_prec_t and mp_exp_t in - an expression (for error analysis) if casts are forgotten. */ + usual arithmetic conversions when mixing mpfr_prec_t and mpfr_exp_t + in an expression (for error analysis) if casts are forgotten. */ #if _MPFR_PREC_FORMAT == 1 typedef short mpfr_prec_t; typedef unsigned short mpfr_uprec_t; @@ -132,15 +132,18 @@ typedef unsigned long mpfr_uprec_t; /* Definition of sign */ typedef int mpfr_sign_t; +/* Definition of the exponent: same as in GMP. */ +typedef mp_exp_t mpfr_exp_t; + /* Definition of the standard exponent limits */ -#define MPFR_EMAX_DEFAULT ((mp_exp_t) (((unsigned long) 1 << 30) - 1)) +#define MPFR_EMAX_DEFAULT ((mpfr_exp_t) (((unsigned long) 1 << 30) - 1)) #define MPFR_EMIN_DEFAULT (-(MPFR_EMAX_DEFAULT)) /* Definition of the main structure */ typedef struct { mpfr_prec_t _mpfr_prec; mpfr_sign_t _mpfr_sign; - mp_exp_t _mpfr_exp; + mpfr_exp_t _mpfr_exp; mp_limb_t *_mpfr_d; } __mpfr_struct; @@ -233,14 +236,14 @@ __MPFR_DECLSPEC __gmp_const char * mpfr_get_patches _MPFR_PROTO ((void)); __MPFR_DECLSPEC int mpfr_buildopt_tls_p _MPFR_PROTO ((void)); __MPFR_DECLSPEC int mpfr_buildopt_decimal_p _MPFR_PROTO ((void)); -__MPFR_DECLSPEC mp_exp_t mpfr_get_emin _MPFR_PROTO ((void)); -__MPFR_DECLSPEC int mpfr_set_emin _MPFR_PROTO ((mp_exp_t)); -__MPFR_DECLSPEC mp_exp_t mpfr_get_emin_min _MPFR_PROTO ((void)); -__MPFR_DECLSPEC mp_exp_t mpfr_get_emin_max _MPFR_PROTO ((void)); -__MPFR_DECLSPEC mp_exp_t mpfr_get_emax _MPFR_PROTO ((void)); -__MPFR_DECLSPEC int mpfr_set_emax _MPFR_PROTO ((mp_exp_t)); -__MPFR_DECLSPEC mp_exp_t mpfr_get_emax_min _MPFR_PROTO ((void)); -__MPFR_DECLSPEC mp_exp_t mpfr_get_emax_max _MPFR_PROTO ((void)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin _MPFR_PROTO ((void)); +__MPFR_DECLSPEC int mpfr_set_emin _MPFR_PROTO ((mpfr_exp_t)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_min _MPFR_PROTO ((void)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_max _MPFR_PROTO ((void)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax _MPFR_PROTO ((void)); +__MPFR_DECLSPEC int mpfr_set_emax _MPFR_PROTO ((mpfr_exp_t)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_min _MPFR_PROTO ((void)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_max _MPFR_PROTO ((void)); __MPFR_DECLSPEC void mpfr_set_default_rounding_mode _MPFR_PROTO((mpfr_rnd_t)); __MPFR_DECLSPEC mpfr_rnd_t mpfr_get_default_rounding_mode _MPFR_PROTO((void)); @@ -283,12 +286,12 @@ __MPFR_DECLSPEC void __MPFR_DECLSPEC int mpfr_prec_round _MPFR_PROTO ((mpfr_ptr, mpfr_prec_t, mpfr_rnd_t)); __MPFR_DECLSPEC int - mpfr_can_round _MPFR_PROTO ((mpfr_srcptr, mp_exp_t, mpfr_rnd_t, mpfr_rnd_t, + mpfr_can_round _MPFR_PROTO ((mpfr_srcptr, mpfr_exp_t, mpfr_rnd_t, mpfr_rnd_t, mpfr_prec_t)); __MPFR_DECLSPEC mpfr_prec_t mpfr_min_prec _MPFR_PROTO ((mpfr_srcptr)); -__MPFR_DECLSPEC mp_exp_t mpfr_get_exp _MPFR_PROTO ((mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_set_exp _MPFR_PROTO ((mpfr_ptr, mp_exp_t)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_exp _MPFR_PROTO ((mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_set_exp _MPFR_PROTO ((mpfr_ptr, mpfr_exp_t)); __MPFR_DECLSPEC mpfr_prec_t mpfr_get_prec _MPFR_PROTO((mpfr_srcptr)); __MPFR_DECLSPEC void mpfr_set_prec _MPFR_PROTO((mpfr_ptr, mpfr_prec_t)); __MPFR_DECLSPEC void mpfr_set_prec_raw _MPFR_PROTO((mpfr_ptr, mpfr_prec_t)); @@ -306,7 +309,7 @@ __MPFR_DECLSPEC int __MPFR_DECLSPEC int mpfr_set_z _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mpfr_rnd_t)); __MPFR_DECLSPEC int - mpfr_set_z_2exp _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mp_exp_t, mpfr_rnd_t)); + mpfr_set_z_2exp _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mpfr_exp_t, mpfr_rnd_t)); __MPFR_DECLSPEC void mpfr_set_nan _MPFR_PROTO ((mpfr_ptr)); __MPFR_DECLSPEC void mpfr_set_inf _MPFR_PROTO ((mpfr_ptr, int)); __MPFR_DECLSPEC void mpfr_set_zero _MPFR_PROTO ((mpfr_ptr, int)); @@ -318,9 +321,9 @@ __MPFR_DECLSPEC int mpfr_set_si _MPFR_PROTO ((mpfr_ptr, long, mpfr_rnd_t)); __MPFR_DECLSPEC int mpfr_set_ui _MPFR_PROTO ((mpfr_ptr, unsigned long, mpfr_rnd_t)); __MPFR_DECLSPEC int - mpfr_set_si_2exp _MPFR_PROTO ((mpfr_ptr, long, mp_exp_t, mpfr_rnd_t)); + mpfr_set_si_2exp _MPFR_PROTO ((mpfr_ptr, long, mpfr_exp_t, mpfr_rnd_t)); __MPFR_DECLSPEC int - mpfr_set_ui_2exp _MPFR_PROTO ((mpfr_ptr,unsigned long,mp_exp_t,mpfr_rnd_t)); + mpfr_set_ui_2exp _MPFR_PROTO ((mpfr_ptr,unsigned long,mpfr_exp_t,mpfr_rnd_t)); __MPFR_DECLSPEC int mpfr_set_q _MPFR_PROTO ((mpfr_ptr, mpq_srcptr, mpfr_rnd_t)); __MPFR_DECLSPEC int @@ -358,7 +361,7 @@ __MPFR_DECLSPEC intmax_t mpfr_get_sj _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); __MPFR_DECLSPEC uintmax_t mpfr_get_uj _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); #endif -__MPFR_DECLSPEC mp_exp_t mpfr_get_z_2exp _MPFR_PROTO ((mpz_ptr, mpfr_srcptr)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_z_2exp _MPFR_PROTO ((mpz_ptr, mpfr_srcptr)); __MPFR_DECLSPEC float mpfr_get_flt _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); __MPFR_DECLSPEC double mpfr_get_d _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); #ifdef MPFR_WANT_DECIMAL_FLOATS @@ -375,7 +378,7 @@ __MPFR_DECLSPEC long double mpfr_get_ld_2exp _MPFR_PROTO ((long*, mpfr_srcptr, __MPFR_DECLSPEC long mpfr_get_si _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); __MPFR_DECLSPEC unsigned long mpfr_get_ui _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC char*mpfr_get_str _MPFR_PROTO ((char*, mp_exp_t*, int, size_t, +__MPFR_DECLSPEC char*mpfr_get_str _MPFR_PROTO ((char*, mpfr_exp_t*, int, size_t, mpfr_srcptr, mpfr_rnd_t)); __MPFR_DECLSPEC int mpfr_get_z _MPFR_PROTO ((mpz_ptr z, mpfr_srcptr f, mpfr_rnd_t)); @@ -530,9 +533,9 @@ __MPFR_DECLSPEC int mpfr_cmpabs _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); __MPFR_DECLSPEC int mpfr_cmp_ui _MPFR_PROTO ((mpfr_srcptr, unsigned long)); __MPFR_DECLSPEC int mpfr_cmp_si _MPFR_PROTO ((mpfr_srcptr, long)); __MPFR_DECLSPEC int mpfr_cmp_ui_2exp _MPFR_PROTO ((mpfr_srcptr, unsigned long, - mp_exp_t)); + mpfr_exp_t)); __MPFR_DECLSPEC int mpfr_cmp_si_2exp _MPFR_PROTO ((mpfr_srcptr, long, - mp_exp_t)); + mpfr_exp_t)); __MPFR_DECLSPEC void mpfr_reldiff _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t)); __MPFR_DECLSPEC int mpfr_eq _MPFR_PROTO((mpfr_srcptr, mpfr_srcptr, @@ -702,12 +705,12 @@ __MPFR_DECLSPEC int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, char **, int, mpfr_rnd_t)); __MPFR_DECLSPEC size_t mpfr_custom_get_size _MPFR_PROTO ((mpfr_prec_t)); -__MPFR_DECLSPEC void mpfr_custom_init _MPFR_PROTO ((void *, mpfr_prec_t)); +__MPFR_DECLSPEC void mpfr_custom_init _MPFR_PROTO ((void *, mpfr_prec_t)); __MPFR_DECLSPEC void * mpfr_custom_get_mantissa _MPFR_PROTO ((mpfr_srcptr)); -__MPFR_DECLSPEC mp_exp_t mpfr_custom_get_exp _MPFR_PROTO ((mpfr_srcptr)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_custom_get_exp _MPFR_PROTO ((mpfr_srcptr)); __MPFR_DECLSPEC void mpfr_custom_move _MPFR_PROTO ((mpfr_ptr, void *)); __MPFR_DECLSPEC void mpfr_custom_init_set _MPFR_PROTO ((mpfr_ptr, int, - mp_exp_t, mpfr_prec_t, void *)); + mpfr_exp_t, mpfr_prec_t, void *)); __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr)); #if defined (__cplusplus) @@ -718,17 +721,17 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr)); The mpfr_sgn macro uses the fact that __MPFR_EXP_NAN and __MPFR_EXP_ZERO are the smallest values. FIXME: In the following macros, the cast of an unsigned type with MSB set - to the signed type mp_exp_t yields an integer overflow, which can give + to the signed type mpfr_exp_t yields an integer overflow, which can give unexpected results with future compilers and aggressive optimisations. Why not working only with signed types, using INT_MIN and LONG_MIN? */ #if __GMP_MP_SIZE_T_INT -#define __MPFR_EXP_NAN ((mp_exp_t)((~((~(unsigned int)0)>>1))+2)) -#define __MPFR_EXP_ZERO ((mp_exp_t)((~((~(unsigned int)0)>>1))+1)) -#define __MPFR_EXP_INF ((mp_exp_t)((~((~(unsigned int)0)>>1))+3)) +#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+2)) +#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+1)) +#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+3)) #else -#define __MPFR_EXP_NAN ((mp_exp_t)((~((~(unsigned long)0)>>1))+2)) -#define __MPFR_EXP_ZERO ((mp_exp_t)((~((~(unsigned long)0)>>1))+1)) -#define __MPFR_EXP_INF ((mp_exp_t)((~((~(unsigned long)0)>>1))+3)) +#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+2)) +#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+1)) +#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+3)) #endif /* Define MPFR_USE_EXTENSION to avoid "gcc -pedantic" warnings. */ @@ -834,9 +837,9 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr)); #define mpfr_custom_get_mantissa(x) ((void*)((x)->_mpfr_d)) #define mpfr_custom_get_exp(x) ((x)->_mpfr_exp) #define mpfr_custom_move(x,m) do { ((x)->_mpfr_d = (mp_limb_t*)(m)); } while (0) -#define mpfr_custom_init_set(x,k,e,p,m) do { \ +#define mpfr_custom_init_set(x,k,e,p,m) do { \ mpfr_ptr _x = (x); \ - mp_exp_t _e; \ + mpfr_exp_t _e; \ mpfr_kind_t _t; \ int _s, _k; \ _k = (k); \ @@ -1106,11 +1106,11 @@ converted into a reduced-precision (e.g., 53-bit) binary number before MPFR can work with it. @end deftypefun -@deftypefun int mpfr_set_ui_2exp (mpfr_t @var{rop}, unsigned long int @var{op}, mp_exp_t @var{e}, mpfr_rnd_t @var{rnd}) -@deftypefunx int mpfr_set_si_2exp (mpfr_t @var{rop}, long int @var{op}, mp_exp_t @var{e}, mpfr_rnd_t @var{rnd}) +@deftypefun int mpfr_set_ui_2exp (mpfr_t @var{rop}, unsigned long int @var{op}, mpfr_exp_t @var{e}, mpfr_rnd_t @var{rnd}) +@deftypefunx int mpfr_set_si_2exp (mpfr_t @var{rop}, long int @var{op}, mpfr_exp_t @var{e}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_set_uj_2exp (mpfr_t @var{rop}, uintmax_t @var{op}, intmax_t @var{e}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_set_sj_2exp (mpfr_t @var{rop}, intmax_t @var{op}, intmax_t @var{e}, mpfr_rnd_t @var{rnd}) -@deftypefunx int mpfr_set_z_2exp (mpfr_t @var{rop}, mpz_t @var{op}, mp_exp_t @var{e}, mpfr_rnd_t @var{rnd}) +@deftypefunx int mpfr_set_z_2exp (mpfr_t @var{rop}, mpz_t @var{op}, mpfr_exp_t @var{e}, mpfr_rnd_t @var{rnd}) Set the value of @var{rop} from @m{@var{op} \times 2^e, @var{op} multiplied by two to the power @var{e}}, rounded toward the given direction @var{rnd}. Note that the input 0 is converted to +0. @@ -1288,7 +1288,7 @@ If @var{op} is NaN or an infinity, then the corresponding double precision value is returned, and @var{exp} is undefined. @end deftypefun -@deftypefun mp_exp_t mpfr_get_z_2exp (mpz_t @var{rop}, mpfr_t @var{op}) +@deftypefun mpfr_exp_t mpfr_get_z_2exp (mpz_t @var{rop}, mpfr_t @var{op}) Put the scaled significand of @var{op} (regarded as an integer, with the precision of @var{op}) into @var{rop}, and return the exponent @var{exp} (which may be outside the current exponent range) such that @var{op} @@ -1300,7 +1300,7 @@ exactly equals $rop \times 2^{\rm exp}$. @end tex If @var{op} is zero, the minimal exponent @code{emin} is returned. -If the exponent is not representable in the @code{mp_exp_t} type, the +If the exponent is not representable in the @code{mpfr_exp_t} type, the behavior is undefined. @end deftypefun @@ -1318,7 +1318,7 @@ The @emph{erange} flag is set if @var{op} is NaN or Inf, which do not exist in @code{mpf}. @end deftypefun -@deftypefun {char *} mpfr_get_str (char *@var{str}, mp_exp_t *@var{expptr}, int @var{b}, size_t @var{n}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) +@deftypefun {char *} mpfr_get_str (char *@var{str}, mpfr_exp_t *@var{expptr}, int @var{b}, size_t @var{n}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) Convert @var{op} to a string of digits in base @var{b}, with rounding in the direction @var{rnd}, where @var{n} is either zero (see below) or the number of significant digits; in the latter case, @var{n} must be greater @@ -1583,8 +1583,8 @@ or both arguments are NaN. But only floating-point numbers can be compared (you may need to do a conversion first). @end deftypefun -@deftypefun int mpfr_cmp_ui_2exp (mpfr_t @var{op1}, unsigned long int @var{op2}, mp_exp_t @var{e}) -@deftypefunx int mpfr_cmp_si_2exp (mpfr_t @var{op1}, long int @var{op2}, mp_exp_t @var{e}) +@deftypefun int mpfr_cmp_ui_2exp (mpfr_t @var{op1}, unsigned long int @var{op2}, mpfr_exp_t @var{e}) +@deftypefunx int mpfr_cmp_si_2exp (mpfr_t @var{op1}, long int @var{op2}, mpfr_exp_t @var{e}) Compare @var{op1} and @m{@var{op2} \times 2^e, @var{op2} multiplied by two to the power @var{e}}. Similar as above. @end deftypefun @@ -2403,7 +2403,7 @@ already an approximation to @var{n} bits: @end example @end deftypefun -@deftypefun int mpfr_can_round (mpfr_t @var{b}, mp_exp_t @var{err}, mpfr_rnd_t @var{rnd1}, mpfr_rnd_t @var{rnd2}, mpfr_prec_t @var{prec}) +@deftypefun int mpfr_can_round (mpfr_t @var{b}, mpfr_exp_t @var{err}, mpfr_rnd_t @var{rnd1}, mpfr_rnd_t @var{rnd2}, mpfr_prec_t @var{prec}) Assuming @var{b} is an approximation of an unknown number @var{x} in the direction @var{rnd1} with error at most two to the power E(b)-@var{err} where E(b) is the exponent of @var{b}, return a non-zero @@ -2508,13 +2508,13 @@ The second argument is a @code{gmp_randstate_t} structure which should be created using the GMP @code{gmp_randinit} function, see the GMP manual. @end deftypefun -@deftypefun mp_exp_t mpfr_get_exp (mpfr_t @var{x}) +@deftypefun mpfr_exp_t mpfr_get_exp (mpfr_t @var{x}) Get the exponent of @var{x}, assuming that @var{x} is a non-zero ordinary number and the significand is chosen in [1/2,1). The behavior for NaN, infinity or zero is undefined. @end deftypefun -@deftypefun int mpfr_set_exp (mpfr_t @var{x}, mp_exp_t @var{e}) +@deftypefun int mpfr_set_exp (mpfr_t @var{x}, mpfr_exp_t @var{e}) Set the exponent of @var{x} if @var{e} is in the current exponent range, and return 0 (even if @var{x} is not a non-zero ordinary number); otherwise, return a non-zero value. @@ -2608,8 +2608,8 @@ return zero otherwise. @cindex Exception related functions @section Exception Related Functions -@deftypefun mp_exp_t mpfr_get_emin (void) -@deftypefunx mp_exp_t mpfr_get_emax (void) +@deftypefun mpfr_exp_t mpfr_get_emin (void) +@deftypefunx mpfr_exp_t mpfr_get_emax (void) Return the (current) smallest and largest exponents allowed for a floating-point variable. The smallest positive value of a floating-point variable is @m{1/2 \times 2^{\rm emin}, one half times 2 raised to the @@ -2617,8 +2617,8 @@ smallest exponent} and the largest value has the form @m{(1 - \varepsilon) \times 2^{\rm emax}, (1 - epsilon) times 2 raised to the largest exponent}. @end deftypefun -@deftypefun int mpfr_set_emin (mp_exp_t @var{exp}) -@deftypefunx int mpfr_set_emax (mp_exp_t @var{exp}) +@deftypefun int mpfr_set_emin (mpfr_exp_t @var{exp}) +@deftypefunx int mpfr_set_emax (mpfr_exp_t @var{exp}) Set the smallest and largest exponents allowed for a floating-point variable. Return a non-zero value when @var{exp} is not in the range accepted by the implementation (in that case the smallest or largest exponent is not changed), @@ -2630,10 +2630,10 @@ behavior will be undefined, in the sense of the ISO C standard. @c It is also her/his responsibility to check that @m {emin <= emax}. @end deftypefun -@deftypefun mp_exp_t mpfr_get_emin_min (void) -@deftypefunx mp_exp_t mpfr_get_emin_max (void) -@deftypefunx mp_exp_t mpfr_get_emax_min (void) -@deftypefunx mp_exp_t mpfr_get_emax_max (void) +@deftypefun mpfr_exp_t mpfr_get_emin_min (void) +@deftypefunx mpfr_exp_t mpfr_get_emin_max (void) +@deftypefunx mpfr_exp_t mpfr_get_emax_min (void) +@deftypefunx mpfr_exp_t mpfr_get_emax_max (void) Return the minimum and maximum of the smallest and largest exponents allowed for @code{mpfr_set_emin} and @code{mpfr_set_emax}. These values are implementation dependent; it is possible to create a non @@ -2845,7 +2845,7 @@ Initialize a significand of precision @var{prec}. at least and be suitably aligned for an array of @code{mp_limb_t}. @end deftypefun -@deftypefun void mpfr_custom_init_set (mpfr_t @var{x}, int @var{kind}, mp_exp_t @var{exp}, mpfr_prec_t @var{prec}, void *@var{significand}) +@deftypefun void mpfr_custom_init_set (mpfr_t @var{x}, int @var{kind}, mpfr_exp_t @var{exp}, mpfr_prec_t @var{prec}, void *@var{significand}) Perform a dummy initialization of a @code{mpfr_t} and set it to: @itemize @item if @code{ABS(kind) == MPFR_NAN_KIND}, @var{x} is set to NaN; @@ -2878,7 +2878,7 @@ The behavior of this function for any @code{mpfr_t} not initialized with @code{mpfr_custom_init_set} is undefined. @end deftypefun -@deftypefun mp_exp_t mpfr_custom_get_exp (mpfr_t @var{x}) +@deftypefun mpfr_exp_t mpfr_custom_get_exp (mpfr_t @var{x}) Return the exponent of @var{x}, assuming that @var{x} is a non-zero ordinary number. The return value for NaN, Infinity or Zero is unspecified but does not produce any trap. @@ -38,10 +38,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., */ long -mpfr_mpn_exp (mp_limb_t *a, mp_exp_t *exp_r, int b, mp_exp_t e, size_t n) +mpfr_mpn_exp (mp_limb_t *a, mpfr_exp_t *exp_r, int b, mpfr_exp_t e, size_t n) { mp_limb_t *c, B; - mp_exp_t f, h; + mpfr_exp_t f, h; int i; unsigned long t; /* number of bits in e */ unsigned long bits; @@ -106,7 +106,7 @@ mpfr_mpn_exp (mp_limb_t *a, mp_exp_t *exp_r, int b, mp_exp_t e, size_t n) /* FIXME: Could f = 2*f + n * GMP_NUMB_BITS be used? */ f = 2*f; MPFR_SADD_OVERFLOW (f, f, n * GMP_NUMB_BITS, - mp_exp_t, mpfr_uexp_t, + mpfr_exp_t, mpfr_uexp_t, MPFR_EXP_MIN, MPFR_EXP_MAX, goto overflow, goto overflow); if ((c[2*n - 1] & MPFR_LIMB_HIGHBIT) == 0) @@ -125,7 +125,7 @@ mpfr_mpn_exp (mp_limb_t *a, mp_exp_t *exp_r, int b, mp_exp_t e, size_t n) (mpn_scan1 (c + 2 * n1, 0) < (n - 2 * n1) * GMP_NUMB_BITS)) error = i; - if (e & ((mp_exp_t) 1 << i)) + if (e & ((mpfr_exp_t) 1 << i)) { /* multiply A by B */ c[2 * n - 1] = mpn_mul_1 (c + n - 1, a, n, B); @@ -37,7 +37,7 @@ mpfr_mul3 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) { /* Old implementation */ int sign_product, cc, inexact; - mp_exp_t ax; + mpfr_exp_t ax; mp_limb_t *tmp; mp_limb_t b1; mpfr_prec_t bq, cq; @@ -136,7 +136,7 @@ mpfr_mul3 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) MPFR_TMP_FREE(marker); { - mp_exp_t ax2 = ax + (mp_exp_t) (b1 - 1 + cc); + mpfr_exp_t ax2 = ax + (mpfr_exp_t) (b1 - 1 + cc); if (MPFR_UNLIKELY( ax2 > __gmpfr_emax)) return mpfr_overflow (a, rnd_mode, sign_product); if (MPFR_UNLIKELY( ax2 < __gmpfr_emin)) @@ -146,7 +146,7 @@ mpfr_mul3 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) is < __gmpfr_emin - 1 or the exact result is a power of 2 (i.e. if both arguments are powers of 2), then round to zero. */ if (rnd_mode == MPFR_RNDN && - (ax + (mp_exp_t) b1 < __gmpfr_emin || + (ax + (mpfr_exp_t) b1 < __gmpfr_emin || (mpfr_powerof2_raw (b) && mpfr_powerof2_raw (c)))) rnd_mode = MPFR_RNDZ; return mpfr_underflow (a, rnd_mode, sign_product); @@ -206,7 +206,7 @@ int mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) { int sign, inexact; - mp_exp_t ax, ax2; + mpfr_exp_t ax, ax2; mp_limb_t *tmp; mp_limb_t b1; mpfr_prec_t bq, cq; @@ -488,7 +488,7 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) mpn_lshift (tmp, tmp, tn, 1); /* tn <= k, so no stack corruption */ } - ax2 = ax + (mp_exp_t) (b1 - 1); + ax2 = ax + (mpfr_exp_t) (b1 - 1); MPFR_RNDRAW (inexact, a, tmp, bq+cq, rnd_mode, sign, ax2++); MPFR_TMP_FREE (marker); MPFR_EXP (a) = ax2; /* Can't use MPFR_SET_EXP: Expo may be out of range */ @@ -502,7 +502,7 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) is < __gmpfr_emin - 1 or the exact result is a power of 2 (i.e. if both arguments are powers of 2), then round to zero. */ if (rnd_mode == MPFR_RNDN - && (ax + (mp_exp_t) b1 < __gmpfr_emin + && (ax + (mpfr_exp_t) b1 < __gmpfr_emin || (mpfr_powerof2_raw (b) && mpfr_powerof2_raw (c)))) rnd_mode = MPFR_RNDZ; return mpfr_underflow (a, rnd_mode, sign); @@ -34,7 +34,7 @@ mpfr_mul_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd_mode) if (MPFR_LIKELY( MPFR_IS_PURE_FP(y)) ) { - mp_exp_t exp = MPFR_GET_EXP (y); + mpfr_exp_t exp = MPFR_GET_EXP (y); if (MPFR_UNLIKELY( n > 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n || exp > __gmpfr_emax - n))) return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y)); @@ -50,7 +50,7 @@ mpfr_mul_2ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mpfr_rnd_t rnd_mod the first test useful so that the real test can't lead to an overflow. */ { - mp_exp_t exp = MPFR_GET_EXP (y); + mpfr_exp_t exp = MPFR_GET_EXP (y); if (MPFR_UNLIKELY( __gmpfr_emax < MPFR_EMIN_MIN + (long) n || exp > __gmpfr_emax - (long) n)) return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y)); @@ -48,7 +48,7 @@ mpfr_nexttozero (mpfr_ptr x) mpn_sub_1 (xp, xp, xn, MPFR_LIMB_ONE << sh); if (MPFR_UNLIKELY( MPFR_LIMB_MSB(xp[xn-1]) == 0) ) { /* was an exact power of two: not normalized any more */ - mp_exp_t exp = MPFR_EXP (x); + mpfr_exp_t exp = MPFR_EXP (x); if (MPFR_UNLIKELY(exp == __gmpfr_emin)) MPFR_SET_ZERO(x); else @@ -82,7 +82,7 @@ mpfr_nexttoinf (mpfr_ptr x) if (MPFR_UNLIKELY( mpn_add_1 (xp, xp, xn, MPFR_LIMB_ONE << sh)) ) /* got 1.0000... */ { - mp_exp_t exp = MPFR_EXP (x); + mpfr_exp_t exp = MPFR_EXP (x); if (MPFR_UNLIKELY(exp == __gmpfr_emax)) MPFR_SET_INF(x); else @@ -28,7 +28,7 @@ mpfr_out_str (FILE *stream, int base, size_t n_digits, mpfr_srcptr op, { char *s, *s0; size_t l; - mp_exp_t e; + mpfr_exp_t e; MPFR_ASSERTN (base >= 2 && base <= 62); @@ -34,7 +34,7 @@ mpfr_pow_is_exact (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode, int *inexact) { mpz_t a, c; - mp_exp_t d, b; + mpfr_exp_t d, b; unsigned long i; int res; @@ -111,7 +111,7 @@ mpfr_pow_is_exact (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, static int is_odd (mpfr_srcptr y) { - mp_exp_t expo; + mpfr_exp_t expo; mpfr_prec_t prec; mp_size_t yn; mp_limb_t *yp; @@ -167,7 +167,7 @@ mpfr_pow_general (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, /* Declaration of the size variable */ mpfr_prec_t Nz = MPFR_PREC(z); /* target precision */ mpfr_prec_t Nt; /* working precision */ - mp_exp_t err; /* error */ + mpfr_exp_t err; /* error */ MPFR_ZIV_DECL (ziv_loop); @@ -270,7 +270,7 @@ mpfr_pow_general (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, } k_non_zero = 1; - Ntmin = sizeof(mp_exp_t) * CHAR_BIT; + Ntmin = sizeof(mpfr_exp_t) * CHAR_BIT; if (Ntmin > Nt) { Nt = Ntmin; @@ -556,7 +556,7 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode) /* We must restore the flags. */ MPFR_SAVE_EXPO_MARK (expo); - mpfr_init2 (tmp, sizeof (mp_exp_t) * CHAR_BIT); + mpfr_init2 (tmp, sizeof (mpfr_exp_t) * CHAR_BIT); inex2 = mpfr_set_exp_t (tmp, MPFR_GET_EXP (x), MPFR_RNDN); MPFR_ASSERTN (inex2 == 0); if (MPFR_IS_NEG (y)) @@ -606,7 +606,7 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode) /* Special case (+/-2^b)^Y which could be exact. If x is negative, then necessarily y is a large integer. */ { - mp_exp_t b = MPFR_GET_EXP (x) - 1; + mpfr_exp_t b = MPFR_GET_EXP (x) - 1; MPFR_ASSERTN (b >= LONG_MIN && b <= LONG_MAX); /* FIXME... */ if (mpfr_cmp_si_2exp (x, MPFR_SIGN(x), b) == 0) @@ -646,7 +646,7 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode) that case y is a large integer. */ { mpfr_t t; - mp_exp_t err; + mpfr_exp_t err; /* We need an upper bound on the exponent of y * log(x). */ mpfr_init2 (t, 16); @@ -69,7 +69,7 @@ mpfr_pow_si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd) /* detect exact powers: x^(-n) is exact iff x is a power of 2 */ if (mpfr_cmp_si_2exp (x, MPFR_SIGN(x), MPFR_EXP(x) - 1) == 0) { - mp_exp_t expx = MPFR_EXP (x) - 1, expy; + mpfr_exp_t expx = MPFR_EXP (x) - 1, expy; MPFR_ASSERTD (n < 0); /* Warning: n * expx may overflow! * @@ -218,8 +218,8 @@ mpfr_pow_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t rnd) if (MPFR_UNLIKELY (mpfr_cmp_si_2exp (x, MPFR_SIGN (x), MPFR_EXP (x) - 1) == 0)) { - mp_exp_t expx = MPFR_EXP (x); /* warning: x and y may be the same - variable */ + mpfr_exp_t expx = MPFR_EXP (x); /* warning: x and y may be the same + variable */ MPFR_LOG_MSG (("x^n with x power of two\n", 0)); mpfr_set_si (y, mpz_odd_p (z) ? MPFR_INT_SIGN(x) : 1, rnd); diff --git a/print_raw.c b/print_raw.c index 214583ad9..99465554b 100644 --- a/print_raw.c +++ b/print_raw.c @@ -60,7 +60,7 @@ mpfr_fprint_binary (FILE *stream, mpfr_srcptr x) putc ((wd & t) == 0 ? '0' : '1', stream); if (--px == 0) { - mp_exp_t ex; + mpfr_exp_t ex; ex = MPFR_GET_EXP (x); MPFR_ASSERTN (ex >= LONG_MIN && ex <= LONG_MAX); @@ -56,7 +56,7 @@ static int mpfr_rem1 (mpfr_ptr rem, long *quo, mpfr_rnd_t rnd_q, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd) { - mp_exp_t ex, ey; + mpfr_exp_t ex, ey; int compare, inex, q_is_odd, sign, signx = MPFR_SIGN (x); mpz_t mx, my, r; @@ -29,7 +29,7 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) { int sign; int rnd_away; - mp_exp_t exp; + mpfr_exp_t exp; if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(u) )) { @@ -42,7 +42,7 @@ int mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) { mpz_t m; - mp_exp_t e, r, sh; + mpfr_exp_t e, r, sh; mpfr_prec_t n, size_m, tmp; int inexact, negative; MPFR_SAVE_EXPO_DECL (expo); @@ -127,7 +127,7 @@ mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) e = mpfr_get_z_2exp (m, x); /* x = m * 2^e */ if ((negative = MPFR_IS_NEG(x))) mpz_neg (m, m); - r = e % (mp_exp_t) k; + r = e % (mpfr_exp_t) k; if (r < 0) r += k; /* now r = e (mod k) with 0 <= e < r */ /* x = (m*2^r) * 2^(e-r) where e-r is a multiple of k */ @@ -139,10 +139,10 @@ mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) /* we now multiply m by 2^(r+k*sh) so that root(m,k) will give exactly n bits: we want k*(n-1)+1 <= size_m + k*sh + r <= k*n i.e. sh = floor ((kn-size_m-r)/k) */ - if ((mp_exp_t) size_m + r > k * (mp_exp_t) n) + if ((mpfr_exp_t) size_m + r > k * (mpfr_exp_t) n) sh = 0; /* we already have too many bits */ else - sh = (k * (mp_exp_t) n - (mp_exp_t) size_m - r) / k; + sh = (k * (mpfr_exp_t) n - (mpfr_exp_t) size_m - r) / k; sh = k * sh + r; if (sh >= 0) { @@ -165,7 +165,7 @@ mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) sh = tmp - n; if (sh > 0) /* we have to flush to 0 the last sh bits from m */ { - inexact = inexact || ((mp_exp_t) mpz_scan1 (m, 0) < sh); + inexact = inexact || ((mpfr_exp_t) mpz_scan1 (m, 0) < sh); mpz_fdiv_q_2exp (m, m, sh); e += k * sh; } @@ -185,7 +185,7 @@ mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) is not changed; or inexact=0, and inexact is set only when rnd_mode=MPFR_RNDN and bit (n+1) from m is 1 */ inexact += mpfr_set_z (y, m, MPFR_RNDN); - MPFR_SET_EXP (y, MPFR_GET_EXP (y) + e / (mp_exp_t) k); + MPFR_SET_EXP (y, MPFR_GET_EXP (y) + e / (mpfr_exp_t) k); if (negative) { diff --git a/round_near_x.c b/round_near_x.c index b103646ed..be8900f7c 100644 --- a/round_near_x.c +++ b/round_near_x.c @@ -163,13 +163,13 @@ mpfr_round_near_x (mpfr_ptr y, mpfr_srcptr v, mpfr_uexp_t err, int dir, MPFR_ASSERTD (dir == 0 || dir == 1); /* First check if we can round. The test is more restrictive than - necessary. Note that if err is not representable in an mp_exp_t, - then err > MPFR_PREC (v) and the conversion to mp_exp_t will not + necessary. Note that if err is not representable in an mpfr_exp_t, + then err > MPFR_PREC (v) and the conversion to mpfr_exp_t will not occur. */ if (!(err > MPFR_PREC (y) + 1 && (err > MPFR_PREC (v) || mpfr_round_p (MPFR_MANT (v), MPFR_LIMB_SIZE (v), - (mp_exp_t) err, + (mpfr_exp_t) err, MPFR_PREC (y) + (rnd == MPFR_RNDN))))) /* If we assume we can not round, return 0, and y is not modified */ return 0; @@ -25,9 +25,9 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., /* Check against mpfr_can_round ? */ #ifdef WANT_ASSERT # if WANT_ASSERT >= 2 -int mpfr_round_p_2 (mp_limb_t *, mp_size_t, mp_exp_t, mpfr_prec_t); +int mpfr_round_p_2 (mp_limb_t *, mp_size_t, mpfr_exp_t, mpfr_prec_t); int -mpfr_round_p (mp_limb_t *bp, mp_size_t bn, mp_exp_t err0, mpfr_prec_t prec) +mpfr_round_p (mp_limb_t *bp, mp_size_t bn, mpfr_exp_t err0, mpfr_prec_t prec) { int i1, i2; @@ -55,7 +55,7 @@ mpfr_round_p (mp_limb_t *bp, mp_size_t bn, mp_exp_t err0, mpfr_prec_t prec) * precision prec. */ int -mpfr_round_p (mp_limb_t *bp, mp_size_t bn, mp_exp_t err0, mpfr_prec_t prec) +mpfr_round_p (mp_limb_t *bp, mp_size_t bn, mpfr_exp_t err0, mpfr_prec_t prec) { mpfr_prec_t err; mp_size_t k, n; diff --git a/round_prec.c b/round_prec.c index 723213de8..4985edc37 100644 --- a/round_prec.c +++ b/round_prec.c @@ -88,7 +88,7 @@ mpfr_prec_round (mpfr_ptr x, mpfr_prec_t prec, mpfr_rnd_t rnd_mode) if (MPFR_UNLIKELY(carry)) { - mp_exp_t exp = MPFR_EXP (x); + mpfr_exp_t exp = MPFR_EXP (x); if (MPFR_UNLIKELY(exp == __gmpfr_emax)) (void) mpfr_overflow(x, rnd_mode, MPFR_SIGN(x)); @@ -118,7 +118,7 @@ mpfr_prec_round (mpfr_ptr x, mpfr_prec_t prec, mpfr_rnd_t rnd_mode) */ int -mpfr_can_round (mpfr_srcptr b, mp_exp_t err, mpfr_rnd_t rnd1, +mpfr_can_round (mpfr_srcptr b, mpfr_exp_t err, mpfr_rnd_t rnd1, mpfr_rnd_t rnd2, mpfr_prec_t prec) { if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(b))) @@ -129,7 +129,7 @@ mpfr_can_round (mpfr_srcptr b, mp_exp_t err, mpfr_rnd_t rnd1, } int -mpfr_can_round_raw (const mp_limb_t *bp, mp_size_t bn, int neg, mp_exp_t err0, +mpfr_can_round_raw (const mp_limb_t *bp, mp_size_t bn, int neg, mpfr_exp_t err0, mpfr_rnd_t rnd1, mpfr_rnd_t rnd2, mpfr_prec_t prec) { mpfr_prec_t err; @@ -242,7 +242,7 @@ mpfr_set_d (mpfr_ptr r, double d, mpfr_rnd_t rnd_mode) MPN_ZERO (tmpmant, k); /* don't use MPFR_SET_EXP here since the exponent may be out of range */ - MPFR_EXP(tmp) -= (mp_exp_t) (cnt + k * GMP_NUMB_BITS); + MPFR_EXP(tmp) -= (mpfr_exp_t) (cnt + k * GMP_NUMB_BITS); /* tmp is exact since PREC(tmp)=53 */ inexact = mpfr_set4 (r, tmp, rnd_mode, signd); @@ -23,7 +23,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-impl.h" int -mpfr_set_exp (mpfr_ptr x, mp_exp_t exponent) +mpfr_set_exp (mpfr_ptr x, mpfr_exp_t exponent) { if (exponent >= __gmpfr_emin && exponent <= __gmpfr_emax) { @@ -92,7 +92,7 @@ mpfr_set_f (mpfr_ptr y, mpf_srcptr x, mpfr_rnd_t rnd_mode) else { /* Do not use MPFR_SET_EXP as the exponent may be out of range. */ - MPFR_EXP (y) = EXP (x) * GMP_NUMB_BITS - (mp_exp_t) cnt + carry; + MPFR_EXP (y) = EXP (x) * GMP_NUMB_BITS - (mpfr_exp_t) cnt + carry; } return mpfr_check_range (y, inexact, rnd_mode); @@ -232,7 +232,7 @@ mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode) mpfr_t tmp; mp_limb_t tmpmant[MPFR_LIMBS_PER_LONG_DOUBLE]; mpfr_long_double_t x; - mp_exp_t exp; + mpfr_exp_t exp; int signd; MPFR_SAVE_EXPO_DECL (expo); @@ -303,7 +303,7 @@ mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode) MPN_ZERO (tmpmant, k); /* Set exponent */ - exp = (mp_exp_t) ((x.s.exph << 8) + x.s.expl); /* 15-bit unsigned int */ + exp = (mpfr_exp_t) ((x.s.exph << 8) + x.s.expl); /* 15-bit unsigned int */ if (MPFR_UNLIKELY (exp == 0)) exp -= 0x3FFD; else diff --git a/set_si_2exp.c b/set_si_2exp.c index 4529c5300..db8c4aca5 100644 --- a/set_si_2exp.c +++ b/set_si_2exp.c @@ -25,7 +25,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-impl.h" int -mpfr_set_si_2exp (mpfr_ptr x, long i, mp_exp_t e, mpfr_rnd_t rnd_mode) +mpfr_set_si_2exp (mpfr_ptr x, long i, mpfr_exp_t e, mpfr_rnd_t rnd_mode) { if (i == 0) { diff --git a/set_ui_2exp.c b/set_ui_2exp.c index e822e27df..c27c04fa6 100644 --- a/set_ui_2exp.c +++ b/set_ui_2exp.c @@ -25,7 +25,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-impl.h" int -mpfr_set_ui_2exp (mpfr_ptr x, unsigned long i, mp_exp_t e, mpfr_rnd_t rnd_mode) +mpfr_set_ui_2exp (mpfr_ptr x, unsigned long i, mpfr_exp_t e, mpfr_rnd_t rnd_mode) { MPFR_SET_POS (x); diff --git a/set_z_exp.c b/set_z_exp.c index 42dbf57f9..f3a45aa79 100644 --- a/set_z_exp.c +++ b/set_z_exp.c @@ -26,12 +26,12 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., /* set f to the integer z multiplied by 2^e */ int -mpfr_set_z_2exp (mpfr_ptr f, mpz_srcptr z, mp_exp_t e, mpfr_rnd_t rnd_mode) +mpfr_set_z_2exp (mpfr_ptr f, mpz_srcptr z, mpfr_exp_t e, mpfr_rnd_t rnd_mode) { mp_size_t fn, zn, dif, en; int k, sign_z, inex; mp_limb_t *fp, *zp; - mp_exp_t exp; + mpfr_exp_t exp; sign_z = mpz_sgn (z); if (MPFR_UNLIKELY (sign_z == 0)) /* ignore the exponent for 0 */ @@ -25,7 +25,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., /* Note: the flags are not cleared and the current sign is kept. */ void -mpfr_setmax (mpfr_ptr x, mp_exp_t e) +mpfr_setmax (mpfr_ptr x, mpfr_exp_t e) { mp_size_t xn, i; int sh; @@ -25,7 +25,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., /* Note: the flags are not cleared and the current sign is kept. */ void -mpfr_setmin (mpfr_ptr x, mp_exp_t e) +mpfr_setmin (mpfr_ptr x, mpfr_exp_t e) { mp_size_t xn; mp_limb_t *xp; @@ -38,7 +38,7 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { mpfr_t c, xr; mpfr_srcptr xx; - mp_exp_t expx, err; + mpfr_exp_t expx, err; mpfr_prec_t precy, m; int inexact, sign, reduce; MPFR_ZIV_DECL (loop); @@ -112,8 +112,9 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) mpfr_sub (c, c, xr, MPFR_RNDZ); else mpfr_add (c, c, xr, MPFR_RNDZ); - if (MPFR_IS_ZERO(xr) || MPFR_EXP(xr) < (mp_exp_t) 3 - (mp_exp_t) m - || MPFR_EXP(c) < (mp_exp_t) 3 - (mp_exp_t) m) + if (MPFR_IS_ZERO(xr) + || MPFR_EXP(xr) < (mpfr_exp_t) 3 - (mpfr_exp_t) m + || MPFR_EXP(c) < (mpfr_exp_t) 3 - (mpfr_exp_t) m) goto ziv_next; /* |xr - x - 2kPi| <= 2^(2-m), thus |sin(xr) - sin(x)| <= 2^(2-m) */ @@ -149,12 +150,12 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) plus 2^(2-m) if there was an argument reduction. Since EXP(c) <= 1, 3-m-EXP(c) >= 2-m, thus the error is at most 2^(3-m-EXP(c)) in case of argument reduction. */ - err = 2 * MPFR_GET_EXP (c) + (mp_exp_t) m - 3 - (reduce != 0); + err = 2 * MPFR_GET_EXP (c) + (mpfr_exp_t) m - 3 - (reduce != 0); if (MPFR_CAN_ROUND (c, err, precy, rnd_mode)) break; /* check for huge cancellation (Near 0) */ - if (err < (mp_exp_t) MPFR_PREC (y)) + if (err < (mpfr_exp_t) MPFR_PREC (y)) m += MPFR_PREC (y) - err; /* Check if near 1 */ if (MPFR_GET_EXP (c) == 1) @@ -35,7 +35,7 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mpfr_rnd_t rnd_mode) int neg, reduce; mpfr_t c, xr; mpfr_srcptr xx; - mp_exp_t err, expx; + mpfr_exp_t err, expx; int inexy, inexz; MPFR_ZIV_DECL (loop); MPFR_SAVE_EXPO_DECL (expo); @@ -152,8 +152,9 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mpfr_rnd_t rnd_mode) mpfr_sub (c, c, xr, MPFR_RNDZ); else mpfr_add (c, c, xr, MPFR_RNDZ); - if (MPFR_IS_ZERO(xr) || MPFR_EXP(xr) < (mp_exp_t) 3 - (mp_exp_t) m - || MPFR_EXP(c) < (mp_exp_t) 3 - (mp_exp_t) m) + if (MPFR_IS_ZERO(xr) + || MPFR_EXP(xr) < (mpfr_exp_t) 3 - (mpfr_exp_t) m + || MPFR_EXP(c) < (mpfr_exp_t) 3 - (mpfr_exp_t) m) goto next_step; xx = xr; } @@ -173,7 +174,7 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mpfr_rnd_t rnd_mode) if (reduce == 0) err = m; else - err = MPFR_GET_EXP (c) + (mp_exp_t) (m - 3); + err = MPFR_GET_EXP (c) + (mpfr_exp_t) (m - 3); if (!mpfr_can_round (c, err, MPFR_RNDN, MPFR_RNDZ, MPFR_PREC (z) + (rnd_mode == MPFR_RNDN))) goto next_step; @@ -196,12 +197,12 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mpfr_rnd_t rnd_mode) /* the absolute error on c is at most 2^(err-m), which we must put in the form 2^(EXP(c)-err). */ - err = MPFR_GET_EXP (c) + (mp_exp_t) m - err; + err = MPFR_GET_EXP (c) + (mpfr_exp_t) m - err; if (mpfr_can_round (c, err, MPFR_RNDN, MPFR_RNDZ, MPFR_PREC (y) + (rnd_mode == MPFR_RNDN))) break; /* check for huge cancellation */ - if (err < (mp_exp_t) MPFR_PREC (y)) + if (err < (mpfr_exp_t) MPFR_PREC (y)) m += MPFR_PREC (y) - err; /* Check if near 1 */ if (MPFR_GET_EXP (c) == 1 @@ -299,7 +300,7 @@ sin_bs_aux (mpz_t Q0, mpz_t S0, mpz_t C0, mpz_srcptr p, mpfr_prec_t r, } /* check that X=p/2^r <= 1/2 */ - MPFR_ASSERTN(mpz_sizeinbase (p, 2) - (mp_exp_t) r <= -1); + MPFR_ASSERTN(mpz_sizeinbase (p, 2) - (mpfr_exp_t) r <= -1); mpz_init (pp); @@ -569,7 +570,7 @@ mpfr_sincos_fast (mpfr_t s, mpfr_t c, mpfr_srcptr x, mpfr_rnd_t rnd) int inexs, inexc; mpfr_t x_red, ts, tc; mpfr_prec_t w; - mp_exp_t err, errs, errc; + mpfr_exp_t err, errs, errc; MPFR_ZIV_DECL (loop); MPFR_ASSERTN(s != c); @@ -65,7 +65,7 @@ mpfr_sinh (mpfr_ptr y, mpfr_srcptr xt, mpfr_rnd_t rnd_mode) { mpfr_t t, ti; - mp_exp_t d; + mpfr_exp_t d; mpfr_prec_t Nt; /* Precision of the intermediary variable */ long int err; /* Precision of error */ MPFR_ZIV_DECL (loop); diff --git a/sinh_cosh.c b/sinh_cosh.c index 31ba2c891..b6ed1abce 100644 --- a/sinh_cosh.c +++ b/sinh_cosh.c @@ -76,7 +76,7 @@ mpfr_sinh_cosh (mpfr_ptr sh, mpfr_ptr ch, mpfr_srcptr xt, mpfr_rnd_t rnd_mode) { mpfr_t s, c, ti; - mp_exp_t d; + mpfr_exp_t d; mpfr_prec_t N; /* Precision of the intermediary variables */ long int err; /* Precision of error */ MPFR_ZIV_DECL (loop); @@ -26,7 +26,7 @@ int mpfr_sqr (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode) { int cc, inexact; - mp_exp_t ax; + mpfr_exp_t ax; mp_limb_t *tmp; mp_limb_t b1; mpfr_prec_t bq; @@ -86,7 +86,7 @@ mpfr_sqr (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode) MPFR_TMP_FREE(marker); { - mp_exp_t ax2 = ax + (mp_exp_t) (b1 - 1 + cc); + mpfr_exp_t ax2 = ax + (mpfr_exp_t) (b1 - 1 + cc); if (MPFR_UNLIKELY( ax2 > __gmpfr_emax)) return mpfr_overflow (a, rnd_mode, MPFR_SIGN_POS); if (MPFR_UNLIKELY( ax2 < __gmpfr_emin)) @@ -96,7 +96,7 @@ mpfr_sqr (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode) is < __gmpfr_emin - 1 or the exact result is a power of 2 (i.e. if both arguments are powers of 2), then round to zero. */ if (rnd_mode == MPFR_RNDN && - (ax + (mp_exp_t) b1 < __gmpfr_emin || mpfr_powerof2_raw (b))) + (ax + (mpfr_exp_t) b1 < __gmpfr_emin || mpfr_powerof2_raw (b))) rnd_mode = MPFR_RNDZ; return mpfr_underflow (a, rnd_mode, MPFR_SIGN_POS); } @@ -41,7 +41,7 @@ mpfr_sqrt (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) int odd_exp; int sh; /* number of extra bits in rp[0] */ int inexact; /* return ternary flag */ - mp_exp_t expr; + mpfr_exp_t expr; MPFR_TMP_DECL(marker); MPFR_LOG_FUNC (("x[%#R]=%R rnd=%d", u, u, rnd_mode), diff --git a/stack_interface.c b/stack_interface.c index 1fcf65df3..1bcc91bb1 100644 --- a/stack_interface.c +++ b/stack_interface.c @@ -44,7 +44,7 @@ mpfr_custom_get_mantissa (mpfr_srcptr x) } #undef mpfr_custom_get_exp -mp_exp_t +mpfr_exp_t mpfr_custom_get_exp (mpfr_srcptr x) { return MPFR_EXP (x); @@ -59,12 +59,12 @@ mpfr_custom_move (mpfr_ptr x, void *new_position) #undef mpfr_custom_init_set void -mpfr_custom_init_set (mpfr_ptr x, int kind, mp_exp_t exp, +mpfr_custom_init_set (mpfr_ptr x, int kind, mpfr_exp_t exp, mpfr_prec_t prec, void *mantissa) { mpfr_kind_t t; int s; - mp_exp_t e; + mpfr_exp_t e; if (kind >= 0) { @@ -36,8 +36,8 @@ struct parsed_string { ending zeroes) */ size_t prec; /* length of mant (zero for +/-0) */ size_t alloc; /* allocation size of mantissa */ - mp_exp_t exp_base; /* number of digits before the point */ - mp_exp_t exp_bin; /* exponent in case base=2 or 16, and the pxxx + mpfr_exp_t exp_base; /* number of digits before the point */ + mpfr_exp_t exp_bin; /* exponent in case base=2 or 16, and the pxxx format is used (i.e., exponent is given in base 10) */ }; @@ -383,13 +383,13 @@ parse_string (mpfr_t x, struct parsed_string *pstr, { char *endptr[1]; /* the exponent digits are kept in ASCII */ - mp_exp_t read_exp = strtol (str + 1, endptr, 10); - mp_exp_t sum = 0; + mpfr_exp_t read_exp = strtol (str + 1, endptr, 10); + mpfr_exp_t sum = 0; if (endptr[0] != str+1) str = endptr[0]; MPFR_ASSERTN (read_exp == (long) read_exp); MPFR_SADD_OVERFLOW (sum, read_exp, pstr->exp_base, - mp_exp_t, mpfr_uexp_t, + mpfr_exp_t, mpfr_uexp_t, MPFR_EXP_MIN, MPFR_EXP_MAX, res = 2, res = 3); /* Since exp_base was positive, read_exp + exp_base can't @@ -402,7 +402,7 @@ parse_string (mpfr_t x, struct parsed_string *pstr, && (!isspace((unsigned char) str[1]))) { char *endptr[1]; - pstr->exp_bin = (mp_exp_t) strtol (str + 1, endptr, 10); + pstr->exp_bin = (mpfr_exp_t) strtol (str + 1, endptr, 10); if (endptr[0] != str+1) str = endptr[0]; } @@ -439,8 +439,8 @@ static int parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) { mpfr_prec_t prec; - mp_exp_t exp; - mp_exp_t ysize_bits; + mpfr_exp_t exp; + mpfr_exp_t ysize_bits; mp_limb_t *y, *result; int count, exact; size_t pstr_size; @@ -500,7 +500,7 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) pstr->mant, round it down */ if (pstr_size >= pstr->prec) pstr_size = pstr->prec; - MPFR_ASSERTD (pstr_size == (mp_exp_t) pstr_size); + MPFR_ASSERTD (pstr_size == (mpfr_exp_t) pstr_size); /* convert str into binary: note that pstr->mant is big endian, thus no offset is needed */ @@ -548,7 +548,7 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) { /* Base: 2, 4, 8, 16, 32 */ int pow2; - mp_exp_t tmp; + mpfr_exp_t tmp; count_leading_zeros (pow2, (mp_limb_t) pstr->base); pow2 = GMP_NUMB_BITS - pow2 - 1; /* base = 2^pow2 */ @@ -556,8 +556,8 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) /* exp += pow2 * (pstr->exp_base - pstr_size) + pstr->exp_bin with overflow checking and check that we can add/substract 2 to exp without overflow */ - MPFR_SADD_OVERFLOW (tmp, pstr->exp_base, -(mp_exp_t) pstr_size, - mp_exp_t, mpfr_uexp_t, + MPFR_SADD_OVERFLOW (tmp, pstr->exp_base, -(mpfr_exp_t) pstr_size, + mpfr_exp_t, mpfr_uexp_t, MPFR_EXP_MIN, MPFR_EXP_MAX, goto overflow, goto underflow); /* On some FreeBsd/Alpha, LONG_MIN/1 produced an exception @@ -570,21 +570,21 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) goto underflow; tmp *= pow2; MPFR_SADD_OVERFLOW (tmp, tmp, pstr->exp_bin, - mp_exp_t, mpfr_uexp_t, + mpfr_exp_t, mpfr_uexp_t, MPFR_EXP_MIN, MPFR_EXP_MAX, goto overflow, goto underflow); MPFR_SADD_OVERFLOW (exp, exp, tmp, - mp_exp_t, mpfr_uexp_t, + mpfr_exp_t, mpfr_uexp_t, MPFR_EXP_MIN+2, MPFR_EXP_MAX-2, goto overflow, goto underflow); result = y; err = 0; } /* case non-power-of-two-base, and pstr->exp_base > pstr_size */ - else if (pstr->exp_base > (mp_exp_t) pstr_size) + else if (pstr->exp_base > (mpfr_exp_t) pstr_size) { mp_limb_t *z; - mp_exp_t exp_z; + mpfr_exp_t exp_z; result = (mp_limb_t*) MPFR_TMP_ALLOC ((2*ysize+1)*BYTES_PER_MP_LIMB); @@ -616,11 +616,11 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) /* exp += exp_z + ysize_bits with overflow checking and check that we can add/substract 2 to exp without overflow */ MPFR_SADD_OVERFLOW (exp_z, exp_z, ysize_bits, - mp_exp_t, mpfr_uexp_t, + mpfr_exp_t, mpfr_uexp_t, MPFR_EXP_MIN, MPFR_EXP_MAX, goto overflow, goto underflow); MPFR_SADD_OVERFLOW (exp, exp, exp_z, - mp_exp_t, mpfr_uexp_t, + mpfr_exp_t, mpfr_uexp_t, MPFR_EXP_MIN+2, MPFR_EXP_MAX-2, goto overflow, goto underflow); @@ -640,10 +640,10 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) result += ysize; } /* case exp_base < pstr_size */ - else if (pstr->exp_base < (mp_exp_t) pstr_size) + else if (pstr->exp_base < (mpfr_exp_t) pstr_size) { mp_limb_t *z; - mp_exp_t exp_z; + mpfr_exp_t exp_z; result = (mp_limb_t*) MPFR_TMP_ALLOC ((3*ysize+1) * BYTES_PER_MP_LIMB); @@ -652,8 +652,8 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) MPN_ZERO (y, ysize); /* pstr_size - pstr->exp_base can overflow */ - MPFR_SADD_OVERFLOW (exp_z, (mp_exp_t) pstr_size, -pstr->exp_base, - mp_exp_t, mpfr_uexp_t, + MPFR_SADD_OVERFLOW (exp_z, (mpfr_exp_t) pstr_size, -pstr->exp_base, + mpfr_exp_t, mpfr_uexp_t, MPFR_EXP_MIN, MPFR_EXP_MAX, goto underflow, goto overflow); @@ -674,11 +674,11 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) /* exp -= exp_z + ysize_bits with overflow checking and check that we can add/substract 2 to exp without overflow */ MPFR_SADD_OVERFLOW (exp_z, exp_z, ysize_bits, - mp_exp_t, mpfr_uexp_t, + mpfr_exp_t, mpfr_uexp_t, MPFR_EXP_MIN, MPFR_EXP_MAX, goto underflow, goto overflow); MPFR_SADD_OVERFLOW (exp, exp, -exp_z, - mp_exp_t, mpfr_uexp_t, + mpfr_exp_t, mpfr_uexp_t, MPFR_EXP_MIN+2, MPFR_EXP_MAX-2, goto overflow, goto underflow); err += 2; @@ -751,7 +751,7 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) /* DO NOT USE MPFR_SET_EXP. The exp may be out of range! */ MPFR_SADD_OVERFLOW (exp, exp, ysize_bits, - mp_exp_t, mpfr_uexp_t, + mpfr_exp_t, mpfr_uexp_t, MPFR_EXP_MIN, MPFR_EXP_MAX, goto overflow, goto underflow); MPFR_EXP (x) = exp; @@ -85,7 +85,7 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) (rnd == MPFR_RNDN) + mpfr_power2_raw (b) but it is more expensive and not very useful */ if (MPFR_UNLIKELY (MPFR_GET_EXP (c) <= MPFR_GET_EXP (b) - - (mp_exp_t) MAX (MPFR_PREC (a), MPFR_PREC (b)) - 2)) + - (mpfr_exp_t) MAX (MPFR_PREC (a), MPFR_PREC (b)) - 2)) { /* Remember, we can't have an exact result! */ /* A.AAAAAAAAAAAAAAAAA @@ -498,7 +498,7 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) exponent range */ if (MPFR_LIKELY(cancel)) { - mp_exp_t exp_a; + mpfr_exp_t exp_a; cancel -= add_exp; /* still valid as unsigned long */ exp_a = MPFR_GET_EXP (b) - cancel; @@ -518,7 +518,7 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) /* in case cancel = 0, add_exp can still be 1, in case b is just below a power of two, c is very small, prec(a) < prec(b), and rnd=away or nearest */ - mp_exp_t exp_b; + mpfr_exp_t exp_b; exp_b = MPFR_GET_EXP (b); if (MPFR_UNLIKELY(add_exp && exp_b == __gmpfr_emax)) @@ -134,7 +134,7 @@ int mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) int mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) { - mp_exp_t bx,cx; + mpfr_exp_t bx,cx; mpfr_uexp_t d; mpfr_prec_t p, sh, cnt; mp_size_t n; @@ -191,7 +191,7 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) { /* Swap b and c and set sign */ mpfr_srcptr t; - mp_exp_t tx; + mpfr_exp_t tx; CGreater: MPFR_SET_OPPOSITE_SIGN(a,b); t = b; b = c; c = t; diff --git a/subnormal.c b/subnormal.c index d36fa426b..3e0bfae5e 100644 --- a/subnormal.c +++ b/subnormal.c @@ -45,7 +45,7 @@ mpfr_subnormalize (mpfr_ptr y, int old_inexact, mpfr_rnd_t rnd) mpfr_emin to mpfr_emin + MPFR_PREC(y) - 1 */ if (MPFR_LIKELY (MPFR_IS_SINGULAR (y) || (MPFR_GET_EXP (y) >= - __gmpfr_emin + (mp_exp_t) MPFR_PREC (y) - 1))) + __gmpfr_emin + (mpfr_exp_t) MPFR_PREC (y) - 1))) inexact = old_inexact; /* We have to emulate one bit rounding if EXP(y) = emin */ @@ -42,14 +42,14 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., */ static void heap_sort (mpfr_srcptr *const, unsigned long, mpfr_srcptr *); static void count_sort (mpfr_srcptr *const, unsigned long, mpfr_srcptr *, - mp_exp_t, mpfr_uexp_t); + mpfr_exp_t, mpfr_uexp_t); /* Either sort the tab in perm and returns 0 Or returns 1 for +INF, -1 for -INF and 2 for NAN */ int mpfr_sum_sort (mpfr_srcptr *const tab, unsigned long n, mpfr_srcptr *perm) { - mp_exp_t min, max; + mpfr_exp_t min, max; mpfr_uexp_t exp_num; unsigned long i; int sign_inf; @@ -95,7 +95,7 @@ mpfr_sum_sort (mpfr_srcptr *const tab, unsigned long n, mpfr_srcptr *perm) /* Performs a count sort of the entries */ static void count_sort (mpfr_srcptr *const tab, unsigned long n, - mpfr_srcptr *perm, mp_exp_t min, mpfr_uexp_t exp_num) + mpfr_srcptr *perm, mpfr_exp_t min, mpfr_uexp_t exp_num) { unsigned long *account; unsigned long target_rank, i; @@ -29,7 +29,7 @@ mpfr_swap (mpfr_ptr u, mpfr_ptr v) { mpfr_prec_t p1, p2; mpfr_sign_t s1, s2; - mp_exp_t e1, e2; + mpfr_exp_t e1, e2; mp_limb_t *m1, *m2; p1 = MPFR_PREC(u); @@ -68,7 +68,7 @@ mpfr_tanh (mpfr_ptr y, mpfr_srcptr xt , mpfr_rnd_t rnd_mode) { /* Declaration of the intermediary variable */ mpfr_t t, te; - mp_exp_t d; + mpfr_exp_t d; /* Declaration of the size variable */ mpfr_prec_t Ny = MPFR_PREC(y); /* target precision */ diff --git a/tests/mpfr-test.h b/tests/mpfr-test.h index 3c88ced10..c1f5dd6ad 100644 --- a/tests/mpfr-test.h +++ b/tests/mpfr-test.h @@ -72,7 +72,7 @@ int mpfr_set_machine_rnd_mode _MPFR_PROTO ((mpfr_rnd_t)); void mpfr_test_init _MPFR_PROTO ((void)); mp_limb_t randlimb _MPFR_PROTO ((void)); void randseed _MPFR_PROTO ((unsigned int)); -void mpfr_random2 _MPFR_PROTO ((mpfr_ptr, mp_size_t, mp_exp_t, gmp_randstate_t)); +void mpfr_random2 _MPFR_PROTO ((mpfr_ptr, mp_size_t, mpfr_exp_t, gmp_randstate_t)); int ulp _MPFR_PROTO ((double, double)); double dbl _MPFR_PROTO ((double, int)); double Ulp _MPFR_PROTO ((double)); @@ -81,12 +81,12 @@ void d_trace _MPFR_PROTO ((const char *, double)); void ld_trace _MPFR_PROTO ((const char *, long double)); FILE *src_fopen _MPFR_PROTO ((const char *, const char *)); -void set_emin _MPFR_PROTO ((mp_exp_t)); -void set_emax _MPFR_PROTO ((mp_exp_t)); -void tests_default_random _MPFR_PROTO ((mpfr_ptr, int, mp_exp_t, mp_exp_t)); +void set_emin _MPFR_PROTO ((mpfr_exp_t)); +void set_emax _MPFR_PROTO ((mpfr_exp_t)); +void tests_default_random _MPFR_PROTO ((mpfr_ptr, int, mpfr_exp_t, mpfr_exp_t)); void data_check _MPFR_PROTO ((char *, int (*) (FLIST), char *)); void bad_cases _MPFR_PROTO ((int (*)(FLIST), int (*)(FLIST), - char *, int, mp_exp_t, mp_exp_t, + char *, int, mpfr_exp_t, mpfr_exp_t, mpfr_prec_t, mpfr_prec_t, mpfr_prec_t, int)); int mpfr_cmp_str _MPFR_PROTO ((mpfr_srcptr x, const char *, int, mpfr_rnd_t)); @@ -149,7 +149,7 @@ mpfr_print_raw (mpfr_srcptr x) printf ((wd & t) == 0 ? "0" : "1"); if (--px == 0) { - mp_exp_t ex; + mpfr_exp_t ex; ex = MPFR_GET_EXP (x); MPFR_ASSERTN (ex >= LONG_MIN && ex <= LONG_MAX); diff --git a/tests/random2.c b/tests/random2.c index cc0cbdb37..b04dbbd4c 100644 --- a/tests/random2.c +++ b/tests/random2.c @@ -31,7 +31,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #endif void -mpfr_random2 (mpfr_ptr x, mp_size_t size, mp_exp_t exp, +mpfr_random2 (mpfr_ptr x, mp_size_t size, mpfr_exp_t exp, gmp_randstate_t rstate) { mp_size_t xn, k, ri; diff --git a/tests/tacos.c b/tests/tacos.c index 5f544897e..dd500ff4c 100644 --- a/tests/tacos.c +++ b/tests/tacos.c @@ -74,7 +74,7 @@ static void special_overflow (void) { mpfr_t x, y; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); diff --git a/tests/tadd.c b/tests/tadd.c index 983dacf70..9bfaf3c1d 100644 --- a/tests/tadd.c +++ b/tests/tadd.c @@ -677,7 +677,7 @@ check_1111 (void) for (n = 0; n < NUM; n++) { mpfr_prec_t prec_a, prec_b, prec_c; - mp_exp_t tb=0, tc, diff; + mpfr_exp_t tb=0, tc, diff; mpfr_t a, b, c, s; int m = 512; int sb, sc; diff --git a/tests/tadd1sp.c b/tests/tadd1sp.c index ba545e597..023091821 100644 --- a/tests/tadd1sp.c +++ b/tests/tadd1sp.c @@ -32,7 +32,7 @@ static void check_overflow (void) { mpfr_t x, y, z1, z2; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); diff --git a/tests/tasin.c b/tests/tasin.c index 9378d61e5..43cd6f6e6 100644 --- a/tests/tasin.c +++ b/tests/tasin.c @@ -171,7 +171,7 @@ static void special_overflow (void) { mpfr_t x, y; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); diff --git a/tests/tatan.c b/tests/tatan.c index 9f4b1e326..a03d30b3a 100644 --- a/tests/tatan.c +++ b/tests/tatan.c @@ -219,7 +219,7 @@ static void special_overflow (void) { mpfr_t x, y; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); @@ -428,7 +428,7 @@ static void smallvals_atan2 (void) { mpfr_t a, x, y; - mp_exp_t old_emin; + mpfr_exp_t old_emin; mpfr_inits (a, x, y, (mpfr_ptr) 0); mpfr_set_ui (y, 0, MPFR_RNDN); diff --git a/tests/tcan_round.c b/tests/tcan_round.c index 4809a120c..8287a7db0 100644 --- a/tests/tcan_round.c +++ b/tests/tcan_round.c @@ -33,7 +33,7 @@ check_round_p (void) mp_limb_t buf[MAX_LIMB_SIZE]; mp_size_t n, i; mpfr_prec_t p; - mp_exp_t err; + mpfr_exp_t err; int r1, r2; for (n = 2 ; n <= MAX_LIMB_SIZE ; n++) diff --git a/tests/tcos.c b/tests/tcos.c index 3eae3bb7a..445d85161 100644 --- a/tests/tcos.c +++ b/tests/tcos.c @@ -141,7 +141,7 @@ static void special_overflow (void) { mpfr_t x, y; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); @@ -166,7 +166,7 @@ overflowed_cos0 (void) { mpfr_t x, y; int emax, i, inex, rnd, err = 0; - mp_exp_t old_emax; + mpfr_exp_t old_emax; old_emax = mpfr_get_emax (); diff --git a/tests/tcosh.c b/tests/tcosh.c index b359b598d..03a2fcf71 100644 --- a/tests/tcosh.c +++ b/tests/tcosh.c @@ -141,7 +141,7 @@ special_overflow (void) 2. cosh(x) is not representable in the selected range of exp. 3. cosh(x) exp overflow even with the largest range of exp */ mpfr_t x, y; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); diff --git a/tests/tcot.c b/tests/tcot.c index d31fcb1e9..c2421898d 100644 --- a/tests/tcot.c +++ b/tests/tcot.c @@ -82,9 +82,9 @@ check_specials (void) } static void -two2emin (mp_exp_t e) +two2emin (mpfr_exp_t e) { - mp_exp_t old_emin, old_emax; + mpfr_exp_t old_emin, old_emax; mpfr_t x, y; int i, rnd; diff --git a/tests/tcoth.c b/tests/tcoth.c index 7495f4c4c..f2d18778e 100644 --- a/tests/tcoth.c +++ b/tests/tcoth.c @@ -136,7 +136,7 @@ underflowed_cothinf (void) { mpfr_t x, y; int i, inex, rnd, err = 0; - mp_exp_t old_emin; + mpfr_exp_t old_emin; old_emin = mpfr_get_emin (); diff --git a/tests/tdiv.c b/tests/tdiv.c index 4fbe3bed1..262f87900 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -630,7 +630,7 @@ static void check_nan (void) { mpfr_t a, d, q; - mp_exp_t emax, emin; + mpfr_exp_t emax, emin; int i; mpfr_init2 (a, 100L); @@ -855,7 +855,7 @@ test_20070603 (void) static void test_20070628 (void) { - mp_exp_t old_emax; + mpfr_exp_t old_emax; mpfr_t x, y; int inex, err = 0; diff --git a/tests/tests.c b/tests/tests.c index 7143777a5..588b0e928 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -94,7 +94,7 @@ set_fpu_prec (void) #endif -static mp_exp_t default_emin, default_emax; +static mpfr_exp_t default_emin, default_emax; static void tests_rand_start (void); static void tests_rand_end (void); @@ -465,7 +465,7 @@ src_fopen (const char *filename, const char *mode) } void -set_emin (mp_exp_t exponent) +set_emin (mpfr_exp_t exponent) { if (mpfr_set_emin (exponent)) { @@ -475,7 +475,7 @@ set_emin (mp_exp_t exponent) } void -set_emax (mp_exp_t exponent) +set_emax (mpfr_exp_t exponent) { if (mpfr_set_emax (exponent)) { @@ -489,7 +489,7 @@ set_emax (mp_exp_t exponent) If pos=0, all generated numbers are positive. */ void -tests_default_random (mpfr_ptr x, int pos, mp_exp_t emin, mp_exp_t emax) +tests_default_random (mpfr_ptr x, int pos, mpfr_exp_t emin, mpfr_exp_t emax) { MPFR_ASSERTN (emin <= emax); MPFR_ASSERTN (emin >= MPFR_EMIN_MIN); @@ -501,7 +501,7 @@ tests_default_random (mpfr_ptr x, int pos, mp_exp_t emin, mp_exp_t emax) mpfr_urandomb (x, RANDS); if (MPFR_IS_PURE_FP (x) && (emin >= 1 || (randlimb () & 1))) { - mp_exp_t e; + mpfr_exp_t e; e = MPFR_GET_EXP (x) + (emin + (long) (randlimb () % (emax - emin + 1))); /* Note: There should be no overflow here because both terms are @@ -791,14 +791,14 @@ data_check (char *f, int (*foo) (FLIST), char *name) */ void bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name, - int pos, mp_exp_t emin, mp_exp_t emax, + int pos, mpfr_exp_t emin, mpfr_exp_t emax, mpfr_prec_t pymin, mpfr_prec_t pymax, mpfr_prec_t psup, int n) { mpfr_t x, y, z; char *dbgenv; int i, dbg; - mp_exp_t old_emin, old_emax; + mpfr_exp_t old_emin, old_emax; old_emin = mpfr_get_emin (); old_emax = mpfr_get_emax (); diff --git a/tests/texceptions.c b/tests/texceptions.c index 8458f0ba7..9d168a0ce 100644 --- a/tests/texceptions.c +++ b/tests/texceptions.c @@ -68,7 +68,7 @@ check_default_rnd (void) static void check_emin_emax (void) { - mp_exp_t old_emin, old_emax; + mpfr_exp_t old_emin, old_emax; old_emin = mpfr_get_emin (); old_emax = mpfr_get_emax (); @@ -142,7 +142,7 @@ static void check_flags (void) { mpfr_t x; - mp_exp_t old_emin, old_emax; + mpfr_exp_t old_emin, old_emax; old_emin = mpfr_get_emin (); old_emax = mpfr_get_emax (); @@ -295,7 +295,7 @@ int main (int argc, char *argv[]) { mpfr_t x, y; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; tests_start_mpfr (); diff --git a/tests/texp.c b/tests/texp.c index dc75cad65..23f8a8117 100644 --- a/tests/texp.c +++ b/tests/texp.c @@ -222,7 +222,7 @@ static void check_special (void) { mpfr_t x, y, z; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); @@ -517,7 +517,7 @@ overflowed_exp0 (void) { mpfr_t x, y; int emax, i, inex, rnd, err = 0; - mp_exp_t old_emax; + mpfr_exp_t old_emax; old_emax = mpfr_get_emax (); @@ -594,7 +594,7 @@ overflowed_exp0 (void) static void bug20080731 (void) { - mp_exp_t emin; + mpfr_exp_t emin; mpfr_t x, y1, y2; mpfr_prec_t prec = 64; @@ -752,7 +752,7 @@ underflow_up (int extended_emin) * because mpfr_sub (r, x, r, MPFR_RNDU); yields a null value. This is * fixed in r5453 by going to next Ziv's iteration. */ - for (precx = sizeof(mp_exp_t) * CHAR_BIT + 1; precx <= 81; precx += 8) + for (precx = sizeof(mpfr_exp_t) * CHAR_BIT + 1; precx <= 81; precx += 8) { mpfr_init2 (x, precx); mpfr_log (x, minpos, MPFR_RNDD); /* |ulp| <= 1/2 */ @@ -787,7 +787,7 @@ underflow_up (int extended_emin) { mpfr_set_ui_2exp (t, 1, - precy, MPFR_RNDN); /* 2^(-p) */ mpfr_set_ui_2exp (t2, 1, 1 - 2 * precy, MPFR_RNDN); /* 2^(-2p+1) */ - precx = sizeof(mp_exp_t) * CHAR_BIT + 2 * precy + 8; + precx = sizeof(mpfr_exp_t) * CHAR_BIT + 2 * precy + 8; mpfr_init2 (x, precx); mpfr_init2 (y, precy); for (i = 0; i <= 1; i++) @@ -884,7 +884,7 @@ underflow_up (int extended_emin) * due to a double-rounding problem in mpfr_mul_2si when rescaling * the result. */ - mpfr_inits2 (sizeof(mp_exp_t) * CHAR_BIT + 64, x, t, (mpfr_ptr) 0); + mpfr_inits2 (sizeof(mpfr_exp_t) * CHAR_BIT + 64, x, t, (mpfr_ptr) 0); for (i = 0; i <= 1; i++) { mpfr_log (x, minpos, i ? MPFR_RNDU : MPFR_RNDD); @@ -937,7 +937,7 @@ underflow_up (int extended_emin) static void underflow (void) { - mp_exp_t emin; + mpfr_exp_t emin; underflow_up (0); diff --git a/tests/texp10.c b/tests/texp10.c index 01c635fac..3ab732f58 100644 --- a/tests/texp10.c +++ b/tests/texp10.c @@ -36,7 +36,7 @@ special_overflow (void) { mpfr_t x, y; int inex; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); @@ -71,7 +71,7 @@ emax_m_eps (void) mpfr_t x, y; int inex, ov; - mpfr_init2 (x, sizeof(mp_exp_t) * CHAR_BIT * 4); + mpfr_init2 (x, sizeof(mpfr_exp_t) * CHAR_BIT * 4); mpfr_init2 (y, 8); mpfr_set_si (x, mpfr_get_emax (), MPFR_RNDN); @@ -95,7 +95,7 @@ static void exp_range (void) { mpfr_t x; - mp_exp_t emin; + mpfr_exp_t emin; emin = mpfr_get_emin (); set_emin (3); @@ -119,7 +119,7 @@ overfl_exp10_0 (void) { mpfr_t x, y; int emax, i, inex, rnd, err = 0; - mp_exp_t old_emax; + mpfr_exp_t old_emax; old_emax = mpfr_get_emax (); @@ -196,7 +196,7 @@ int main (int argc, char *argv[]) { mpfr_t x, y; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; int inex, ov; tests_start_mpfr (); diff --git a/tests/texp2.c b/tests/texp2.c index 315a26540..79a7e519a 100644 --- a/tests/texp2.c +++ b/tests/texp2.c @@ -36,7 +36,7 @@ special_overflow (void) { mpfr_t x, y; int inex; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); @@ -71,7 +71,7 @@ emax_m_eps (void) mpfr_t x, y; int inex, ov; - mpfr_init2 (x, sizeof(mp_exp_t) * CHAR_BIT * 4); + mpfr_init2 (x, sizeof(mpfr_exp_t) * CHAR_BIT * 4); mpfr_init2 (y, 8); mpfr_set_si (x, mpfr_get_emax (), MPFR_RNDN); @@ -120,7 +120,7 @@ static void exp_range (void) { mpfr_t x; - mp_exp_t emin; + mpfr_exp_t emin; emin = mpfr_get_emin (); set_emin (3); @@ -144,7 +144,7 @@ overflowed_exp2_0 (void) { mpfr_t x, y; int emax, i, inex, rnd, err = 0; - mp_exp_t old_emax; + mpfr_exp_t old_emax; old_emax = mpfr_get_emax (); @@ -221,7 +221,7 @@ int main (int argc, char *argv[]) { mpfr_t x, y; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; tests_start_mpfr (); diff --git a/tests/tfactorial.c b/tests/tfactorial.c index 6763f95d3..98bec46db 100644 --- a/tests/tfactorial.c +++ b/tests/tfactorial.c @@ -122,7 +122,7 @@ overflowed_fac0 (void) { mpfr_t x, y; int inex, rnd, err = 0; - mp_exp_t old_emax; + mpfr_exp_t old_emax; old_emax = mpfr_get_emax (); @@ -235,7 +235,7 @@ main (int argc, char *argv[]) /* fact(n) ends with floor(n/2)+floor(n/4)+... zeros */ for (k=n/2, zeros=0; k; k >>= 1) zeros += k; - if (MPFR_EXP(y) <= (mp_exp_t) (prec + zeros)) + if (MPFR_EXP(y) <= (mpfr_exp_t) (prec + zeros)) /* result should be exact */ { if (inexact) diff --git a/tests/tfprintf.c b/tests/tfprintf.c index 3d639f13e..f6e2dd7e2 100644 --- a/tests/tfprintf.c +++ b/tests/tfprintf.c @@ -294,7 +294,7 @@ check_random (FILE *fout, int nb_tests) 'f', 'g' }; - mp_exp_t old_emin, old_emax; + mpfr_exp_t old_emin, old_emax; old_emin = mpfr_get_emin (); old_emax = mpfr_get_emax (); diff --git a/tests/tfrac.c b/tests/tfrac.c index fabe5c7c9..48e49449a 100644 --- a/tests/tfrac.c +++ b/tests/tfrac.c @@ -180,7 +180,7 @@ bug20090918 (void) int inexy, inexz; int r, i; char *s[] = { "61680.352935791015625", "61680.999999" }; - mp_exp_t emin; + mpfr_exp_t emin; emin = mpfr_get_emin (); mpfr_init2 (x, 32); diff --git a/tests/tgamma.c b/tests/tgamma.c index 8c07bc778..c724d0e71 100644 --- a/tests/tgamma.c +++ b/tests/tgamma.c @@ -197,7 +197,7 @@ static void special_overflow (void) { mpfr_t x, y; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; int inex; emin = mpfr_get_emin (); @@ -441,7 +441,7 @@ test20071231 (void) { mpfr_t x; int inex; - mp_exp_t emin; + mpfr_exp_t emin; emin = mpfr_get_emin (); mpfr_set_emin (-1000000); diff --git a/tests/tgeneric.c b/tests/tgeneric.c index 2f9804b62..60aeb16f2 100644 --- a/tests/tgeneric.c +++ b/tests/tgeneric.c @@ -122,7 +122,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N) int inexact, compare, compare2; unsigned int n; unsigned long ctrt = 0, ctrn = 0; - mp_exp_t old_emin, old_emax; + mpfr_exp_t old_emin, old_emax; old_emin = mpfr_get_emin (); old_emax = mpfr_get_emax (); diff --git a/tests/tget_f.c b/tests/tget_f.c index 5f17ca1b2..6f59022ad 100644 --- a/tests/tget_f.c +++ b/tests/tget_f.c @@ -270,7 +270,7 @@ main (void) mpf_t x; mpfr_t y, z; unsigned long i; - mp_exp_t e; + mpfr_exp_t e; int inex; tests_start_mpfr (); diff --git a/tests/tget_str.c b/tests/tget_str.c index 76072a807..86fea8707 100644 --- a/tests/tget_str.c +++ b/tests/tget_str.c @@ -29,7 +29,7 @@ check3 (char *d, mpfr_rnd_t rnd, char *res) { mpfr_t x; char *str; - mp_exp_t e; + mpfr_exp_t e; mpfr_init2 (x, 53); mpfr_set_str (x, d, 10, rnd); @@ -49,7 +49,7 @@ check_small (void) { mpfr_t x; char *s; - mp_exp_t e; + mpfr_exp_t e; mpfr_prec_t p; mpfr_init (x); @@ -989,7 +989,7 @@ check_large (void) '3', '7', '2', '2', '7', '5', '6', '2', '3', '1', '2', '1', '3', '1', '4', '2', '6', '9', '2', '3', '\0' }; - mp_exp_t e; + mpfr_exp_t e; mpfr_init2 (x, 3322); mpfr_set_str (x, xm, 10, MPFR_RNDN); @@ -1077,7 +1077,7 @@ check_special (int b, mpfr_prec_t p) mpfr_t x; int i, j; char s[MAX_DIGITS + 2], s2[MAX_DIGITS + 2], c; - mp_exp_t e; + mpfr_exp_t e; int r; size_t m; @@ -1156,7 +1156,7 @@ check_bug_base2k (void) */ mpfr_t xx, yy, zz; char *s; - mp_exp_t e; + mpfr_exp_t e; mpfr_init2 (xx, 107); mpfr_init2 (yy, 79); @@ -1181,7 +1181,7 @@ check_reduced_exprange (void) { mpfr_t x; char *s; - mp_exp_t emax, e; + mpfr_exp_t emax, e; emax = mpfr_get_emax (); mpfr_init2 (x, 8); @@ -1208,7 +1208,7 @@ main (int argc, char *argv[]) mpfr_t x; mpfr_rnd_t r; char s[MAX_DIGITS + 2]; - mp_exp_t e, f; + mpfr_exp_t e, f; size_t m; mpfr_prec_t p; int i; @@ -1230,7 +1230,7 @@ main (int argc, char *argv[]) { m = 2 + (randlimb () % (MAX_DIGITS - 1)); mpfr_urandomb (x, RANDS); - e = (mp_exp_t) (randlimb () % 21) - 10; + e = (mpfr_exp_t) (randlimb () % 21) - 10; mpfr_set_exp (x, (e == -10) ? mpfr_get_emin () : ((e == 10) ? mpfr_get_emax () : e)); b = 2 + (randlimb () % 35); diff --git a/tests/tget_z.c b/tests/tget_z.c index 050dd9a05..887d624be 100644 --- a/tests/tget_z.c +++ b/tests/tget_z.c @@ -31,7 +31,7 @@ check_diff (void) int inex; mpfr_t x; mpz_t z; - mp_exp_t emin; + mpfr_exp_t emin; mpz_init (z); mpfr_init2 (x, 2); diff --git a/tests/thypot.c b/tests/thypot.c index fcfa2097a..f93890f00 100644 --- a/tests/thypot.c +++ b/tests/thypot.c @@ -287,7 +287,7 @@ check_overflow (void) static void alltst (void) { - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; ext = 0; test_small (); diff --git a/tests/tinternals.c b/tests/tinternals.c index 577a5a924..ff3aae763 100644 --- a/tests/tinternals.c +++ b/tests/tinternals.c @@ -51,7 +51,7 @@ static void test_round_near_x (void) { mpfr_t x, y, z, eps; - mp_exp_t e; + mpfr_exp_t e; int failures = 0, mx, neg, err, dir, r, inex, inex2; char buffer[7], *p; diff --git a/tests/tlgamma.c b/tests/tlgamma.c index 13c67096a..b003e61a0 100644 --- a/tests/tlgamma.c +++ b/tests/tlgamma.c @@ -58,7 +58,7 @@ special (void) mpfr_t x, y; int inex; int sign; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; mpfr_init (x); mpfr_init (y); diff --git a/tests/tlog.c b/tests/tlog.c index b457e1277..8b0065295 100644 --- a/tests/tlog.c +++ b/tests/tlog.c @@ -179,7 +179,7 @@ special (void) { mpfr_t x, y; int inex; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); diff --git a/tests/tmodf.c b/tests/tmodf.c index 8c47370b5..92d1574f3 100644 --- a/tests/tmodf.c +++ b/tests/tmodf.c @@ -108,7 +108,7 @@ check_special_exprange (void) int inexact, ov; unsigned int eflags, gflags; mpfr_t xi, xf, x; - mp_exp_t emax; + mpfr_exp_t emax; emax = mpfr_get_emax (); mpfr_init2 (xi, 7); diff --git a/tests/tmul.c b/tests/tmul.c index 6689cda39..dbccf3ce2 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -280,7 +280,7 @@ static void check_max(void) { mpfr_t xx, yy, zz; - mp_exp_t emin; + mpfr_exp_t emin; mpfr_init2(xx, 4); mpfr_init2(yy, 4); diff --git a/tests/tmul_2exp.c b/tests/tmul_2exp.c index bbb2e1106..d72442a3d 100644 --- a/tests/tmul_2exp.c +++ b/tests/tmul_2exp.c @@ -46,10 +46,10 @@ test_mul (int i, int div, mpfr_ptr y, mpfr_srcptr x, } static void -underflow (mp_exp_t e) +underflow (mpfr_exp_t e) { mpfr_t x, y, z1, z2; - mp_exp_t emin; + mpfr_exp_t emin; int i, k; int prec; int rnd; diff --git a/tests/tmul_ui.c b/tests/tmul_ui.c index 6aca85ccb..433b077ec 100644 --- a/tests/tmul_ui.c +++ b/tests/tmul_ui.c @@ -86,7 +86,7 @@ main (int argc, char *argv[]) mpfr_t x, y; unsigned int xprec, yprec, i; mpfr_prec_t p; - mp_exp_t emax; + mpfr_exp_t emax; tests_start_mpfr (); diff --git a/tests/tpow.c b/tests/tpow.c index 982d741ac..787e99ab6 100644 --- a/tests/tpow.c +++ b/tests/tpow.c @@ -350,7 +350,7 @@ static void check_special_pow_si (void) { mpfr_t a, b; - mp_exp_t emin; + mpfr_exp_t emin; mpfr_init (a); mpfr_init (b); @@ -478,7 +478,7 @@ static void special (void) { mpfr_t x, y, z, t; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; int inex; mpfr_init2 (x, 53); @@ -773,7 +773,7 @@ underflows (void) int err = 0; int inexact; int i; - mp_exp_t emin; + mpfr_exp_t emin; mpfr_init2 (x, 64); mpfr_init2 (y, 64); @@ -931,7 +931,7 @@ static void overflows2 (void) { mpfr_t x, y, z; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; int e; /* x^y in reduced exponent range, where x = 2^b and y is not an integer @@ -981,7 +981,7 @@ overflows3 (void) if (MPFR_EMAX_MAX % 3 == 0) { mpfr_t x, y, z, t; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; unsigned int flags; int i; @@ -1085,7 +1085,7 @@ static void bug20071103 (void) { mpfr_t x, y, z; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); @@ -1111,7 +1111,7 @@ static void bug20071104 (void) { mpfr_t x, y, z; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; int inex; emin = mpfr_get_emin (); @@ -1153,7 +1153,7 @@ bug20071127 (void) { mpfr_t x, y, z; int i, tern; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); @@ -1188,7 +1188,7 @@ bug20071128 (void) { mpfr_t max_val, x, y, z; int i, tern; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); @@ -1341,13 +1341,13 @@ bug20080721 (void) static void bug20080820 (void) { - mp_exp_t emin; + mpfr_exp_t emin; mpfr_t x, y, z1, z2; emin = mpfr_get_emin (); mpfr_set_emin (MPFR_EMIN_MIN); mpfr_init2 (x, 80); - mpfr_init2 (y, sizeof (mp_exp_t) * CHAR_BIT + 32); + mpfr_init2 (y, sizeof (mpfr_exp_t) * CHAR_BIT + 32); mpfr_init2 (z1, 2); mpfr_init2 (z2, 80); mpfr_set_ui (x, 2, MPFR_RNDN); diff --git a/tests/tpow_all.c b/tests/tpow_all.c index f12bc24f0..162f0d59a 100644 --- a/tests/tpow_all.c +++ b/tests/tpow_all.c @@ -466,7 +466,7 @@ static void underflow_up1 (void) { mpfr_t delta, x, y, z, z0; - mp_exp_t n; + mpfr_exp_t n; int inex; int rnd; int i; @@ -551,7 +551,7 @@ static void underflow_up2 (void) { mpfr_t x, y, z, z0, eps; - mp_exp_t n; + mpfr_exp_t n; int inex; int rnd; @@ -608,7 +608,7 @@ underflow_up3 (void) int i; mpfr_init2 (x, 64); - mpfr_init2 (y, sizeof (mp_exp_t) * CHAR_BIT); + mpfr_init2 (y, sizeof (mpfr_exp_t) * CHAR_BIT); mpfr_init2 (z, 32); mpfr_init2 (z0, 2); @@ -744,7 +744,7 @@ overflow_inv (void) static void alltst (void) { - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; ext = 0; tst (); diff --git a/tests/tpow_z.c b/tests/tpow_z.c index 6f6baf50b..4efb06ba3 100644 --- a/tests/tpow_z.c +++ b/tests/tpow_z.c @@ -323,7 +323,7 @@ bug20080904 (void) { mpz_t exp; mpfr_t a, answer; - mp_exp_t emin_default; + mpfr_exp_t emin_default; mpz_init (exp); mpfr_init2 (a, 70); diff --git a/tests/tprintf.c b/tests/tprintf.c index 39bf42620..1e542cbc8 100644 --- a/tests/tprintf.c +++ b/tests/tprintf.c @@ -349,7 +349,7 @@ check_random (int nb_tests) 'f', 'g' }; - mp_exp_t old_emin, old_emax; + mpfr_exp_t old_emin, old_emax; old_emin = mpfr_get_emin (); old_emax = mpfr_get_emax (); diff --git a/tests/trandom.c b/tests/trandom.c index 72df33d68..433b83c7a 100644 --- a/tests/trandom.c +++ b/tests/trandom.c @@ -32,7 +32,7 @@ test_urandomb (long nbtests, mpfr_prec_t prec, int verbose) mpfr_t x; int *tab, size_tab, k, sh, xn; double d, av = 0, var = 0, chi2 = 0, th; - mp_exp_t emin; + mpfr_exp_t emin; size_tab = (nbtests >= 1000 ? nbtests / 50 : 20); tab = (int *) calloc (size_tab, sizeof(int)); diff --git a/tests/trint.c b/tests/trint.c index 19b12f42b..f223bc83c 100644 --- a/tests/trint.c +++ b/tests/trint.c @@ -32,7 +32,7 @@ static void special (void) { mpfr_t x, y; - mp_exp_t emax; + mpfr_exp_t emax; mpfr_init (x); mpfr_init (y); diff --git a/tests/tround_prec.c b/tests/tround_prec.c index e809dc02b..ecc214748 100644 --- a/tests/tround_prec.c +++ b/tests/tround_prec.c @@ -29,7 +29,7 @@ int main (void) { mpfr_t x; - mp_exp_t emax; + mpfr_exp_t emax; tests_start_mpfr (); diff --git a/tests/tsec.c b/tests/tsec.c index 23d807e17..91bf22788 100644 --- a/tests/tsec.c +++ b/tests/tsec.c @@ -86,7 +86,7 @@ overflowed_sec0 (void) { mpfr_t x, y; int emax, i, inex, rnd, err = 0; - mp_exp_t old_emax; + mpfr_exp_t old_emax; old_emax = mpfr_get_emax (); diff --git a/tests/tsech.c b/tests/tsech.c index 6f460f85e..d3b9d7b7b 100644 --- a/tests/tsech.c +++ b/tests/tsech.c @@ -103,7 +103,7 @@ overflowed_sech0 (void) { mpfr_t x, y; int emax, i, inex, rnd, err = 0; - mp_exp_t old_emax; + mpfr_exp_t old_emax; old_emax = mpfr_get_emax (); diff --git a/tests/tset.c b/tests/tset.c index 1b3060b04..154cd0e98 100644 --- a/tests/tset.c +++ b/tests/tset.c @@ -143,7 +143,7 @@ main (void) { mpfr_t x, y, z, u; int inexact; - mp_exp_t emax; + mpfr_exp_t emax; tests_start_mpfr (); diff --git a/tests/tset_exp.c b/tests/tset_exp.c index 09d5304ba..02239f051 100644 --- a/tests/tset_exp.c +++ b/tests/tset_exp.c @@ -30,7 +30,7 @@ main (int argc, char *argv[]) { mpfr_t x; int ret; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; tests_start_mpfr (); diff --git a/tests/tset_f.c b/tests/tset_f.c index 5988783ca..158eb61ee 100644 --- a/tests/tset_f.c +++ b/tests/tset_f.c @@ -31,7 +31,7 @@ main (void) { mpfr_t x, u; mpf_t y, z; - mp_exp_t emax; + mpfr_exp_t emax; unsigned long k, pr; int r, inexact; diff --git a/tests/tset_ld.c b/tests/tset_ld.c index 00ce34bfa..993061875 100644 --- a/tests/tset_ld.c +++ b/tests/tset_ld.c @@ -163,7 +163,7 @@ main (int argc, char *argv[]) long double d, e; mpfr_t x; int i; - mp_exp_t emax; + mpfr_exp_t emax; #ifdef WITH_FPU_CONTROL fpu_control_t cw; diff --git a/tests/tset_si.c b/tests/tset_si.c index 96510060a..5f0872e22 100644 --- a/tests/tset_si.c +++ b/tests/tset_si.c @@ -133,7 +133,7 @@ main (int argc, char *argv[]) unsigned long zl, dl; int inex; int r; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; int flag; tests_start_mpfr (); diff --git a/tests/tset_str.c b/tests/tset_str.c index 6109f663c..940c57dc1 100644 --- a/tests/tset_str.c +++ b/tests/tset_str.c @@ -45,7 +45,7 @@ static void check_underflow (void) { mpfr_t a; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; int res; mpfr_init (a); @@ -102,7 +102,7 @@ main (int argc, char *argv[]) mpfr_t x, y; unsigned long k, bd, nc, i; char *str, *str2; - mp_exp_t e; + mpfr_exp_t e; int base, logbase, prec, baseprec, ret, obase; tests_start_mpfr (); @@ -771,7 +771,7 @@ main (int argc, char *argv[]) for (crnd = 0; crnd < 3; crnd++) { char *str1; - mp_exp_t exp; + mpfr_exp_t exp; *(MPFR_MANT(x)) = check_limb[climb]; MPFR_EXP(x) = 0; diff --git a/tests/tset_z.c b/tests/tset_z.c index 422f73c38..ff0ffaa3b 100644 --- a/tests/tset_z.c +++ b/tests/tset_z.c @@ -78,7 +78,7 @@ check_large (void) { mpz_t z; mpfr_t x, y; - mp_exp_t emax, emin; + mpfr_exp_t emax, emin; mpz_init (z); mpfr_init2 (x, 160); diff --git a/tests/tset_z_exp.c b/tests/tset_z_exp.c index 6126378d9..c2e35c58a 100644 --- a/tests/tset_z_exp.c +++ b/tests/tset_z_exp.c @@ -26,10 +26,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-test.h" -static mp_exp_t +static mpfr_exp_t randexp (void) { - return (mp_exp_t) (randlimb () % (__gmpfr_emax - __gmpfr_emin)) + return (mpfr_exp_t) (randlimb () % (__gmpfr_emax - __gmpfr_emin)) + __gmpfr_emin; } @@ -39,7 +39,7 @@ check0 (void) mpz_t y; mpfr_t x; int inexact, r; - mp_exp_t e; + mpfr_exp_t e; /* Check for +0 */ mpfr_init (x); @@ -69,7 +69,7 @@ check (long i, mpfr_rnd_t rnd) { mpfr_t f; mpz_t z; - mp_exp_t e; + mpfr_exp_t e; mpfr_init2 (f, 8 * sizeof(long)); mpz_init (z); diff --git a/tests/tsin_cos.c b/tests/tsin_cos.c index 2fc45b3c2..364a30506 100644 --- a/tests/tsin_cos.c +++ b/tests/tsin_cos.c @@ -170,7 +170,7 @@ overflowed_sin_cos0 (void) { mpfr_t x, y, z; int emax, inex, rnd, err = 0; - mp_exp_t old_emax; + mpfr_exp_t old_emax; old_emax = mpfr_get_emax (); @@ -560,7 +560,7 @@ static void consistency (void) { mpfr_t x, s1, s2, c1, c2; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; mpfr_rnd_t rnd; unsigned int flags_sin, flags_cos, flags, flags_before, flags_ref; int inex_sin, is, inex_cos, ic, inex, inex_ref; diff --git a/tests/tsprintf.c b/tests/tsprintf.c index 8bb488445..f627bdb46 100644 --- a/tests/tsprintf.c +++ b/tests/tsprintf.c @@ -1046,12 +1046,12 @@ bug20081214 (void) * some C libraries behave differently on %a, but this is a bug. */ static void -check_emax_aux (mp_exp_t e) +check_emax_aux (mpfr_exp_t e) { mpfr_t x; char *s1, s2[256]; int i; - mp_exp_t emax; + mpfr_exp_t emax; MPFR_ASSERTN (e <= LONG_MAX); emax = mpfr_get_emax (); diff --git a/tests/tsqr.c b/tests/tsqr.c index b8107b377..980ac6c15 100644 --- a/tests/tsqr.c +++ b/tests/tsqr.c @@ -85,7 +85,7 @@ static void check_special (void) { mpfr_t x, y; - mp_exp_t emin; + mpfr_exp_t emin; mpfr_init (x); mpfr_init (y); diff --git a/tests/tstrtofr.c b/tests/tstrtofr.c index 0620a3724..517871980 100644 --- a/tests/tstrtofr.c +++ b/tests/tstrtofr.c @@ -257,7 +257,7 @@ main (void) int i, base; mpfr_t x; mpfr_prec_t p; - mp_exp_t e; + mpfr_exp_t e; mpfr_init (x); printf ("struct dymmy_test { \n" diff --git a/tests/tsub1sp.c b/tests/tsub1sp.c index dbb6339d5..1219d8a41 100644 --- a/tests/tsub1sp.c +++ b/tests/tsub1sp.c @@ -102,7 +102,7 @@ check_special (void) int r; mpfr_prec_t p; int i = -1, inexact1, inexact2; - mp_exp_t es; + mpfr_exp_t es; mpfr_inits (x, y, z, x2, (mpfr_ptr) 0); diff --git a/tests/tsubnormal.c b/tests/tsubnormal.c index 10d6a2ed2..9085a4690 100644 --- a/tests/tsubnormal.c +++ b/tests/tsubnormal.c @@ -55,7 +55,7 @@ check1 (void) { mpfr_t x; int i, j, k, s, old_inex; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); @@ -109,7 +109,7 @@ check2 (void) { mpfr_t x, y, z; int tern; - mp_exp_t emin; + mpfr_exp_t emin; emin = mpfr_get_emin (); @@ -146,7 +146,7 @@ check3 (void) { mpfr_t x, y, z; int tern; - mp_exp_t emin; + mpfr_exp_t emin; emin = mpfr_get_emin (); diff --git a/tests/tsum.c b/tests/tsum.c index 51c5ce936..05ebb9176 100644 --- a/tests/tsum.c +++ b/tests/tsum.c @@ -58,7 +58,7 @@ static mpfr_prec_t get_prec_max (mpfr_t *tab, unsigned long n, mpfr_prec_t f) { mpfr_prec_t res; - mp_exp_t min, max; + mpfr_exp_t min, max; unsigned long i; for (i = 0; MPFR_IS_ZERO (tab[i]); i++) diff --git a/tests/ttanh.c b/tests/ttanh.c index e199950d8..7733152d3 100644 --- a/tests/ttanh.c +++ b/tests/ttanh.c @@ -62,7 +62,7 @@ special_overflow (void) { mpfr_t x, y; int i; - mp_exp_t emin, emax; + mpfr_exp_t emin, emax; emin = mpfr_get_emin (); emax = mpfr_get_emax (); diff --git a/tests/tui_pow.c b/tests/tui_pow.c index 7fc8f7f69..a0d68987b 100644 --- a/tests/tui_pow.c +++ b/tests/tui_pow.c @@ -89,7 +89,7 @@ check1 (mpfr_ptr x, mpfr_prec_t prec, unsigned long nt, mpfr_rnd_t rnd) mpfr_t y, z, t; int inexact, compare, compare2; mpfr_prec_t yprec; - mp_exp_t err; + mpfr_exp_t err; yprec = prec + 10; diff --git a/tests/turandom.c b/tests/turandom.c index 519bd886b..21f4e0b4f 100644 --- a/tests/turandom.c +++ b/tests/turandom.c @@ -32,7 +32,7 @@ test_urandom (long nbtests, mpfr_prec_t prec, mpfr_rnd_t rnd, long bit_index, mpfr_t x; int *tab, size_tab, k, sh, xn; double d, av = 0, var = 0, chi2 = 0, th; - mp_exp_t emin; + mpfr_exp_t emin; mp_size_t limb_index = 0; mp_limb_t limb_mask = 0; long count = 0; diff --git a/ui_pow_ui.c b/ui_pow_ui.c index 43154fe51..528b04237 100644 --- a/ui_pow_ui.c +++ b/ui_pow_ui.c @@ -26,7 +26,7 @@ int mpfr_ui_pow_ui (mpfr_ptr x, unsigned long int y, unsigned long int n, mpfr_rnd_t rnd) { - mp_exp_t err; + mpfr_exp_t err; unsigned long m; mpfr_t res; mpfr_prec_t prec; @@ -44,8 +44,8 @@ mpfr_urandom (mpfr_ptr rop, gmp_randstate_t rstate, mpfr_rnd_t rnd_mode) mpfr_prec_t nbits; mp_size_t nlimbs; mp_size_t n; - mp_exp_t exp; - mp_exp_t emin; + mpfr_exp_t exp; + mpfr_exp_t emin; int cnt; int inex; diff --git a/urandomb.c b/urandomb.c index d59ca3cab..92763c02e 100644 --- a/urandomb.c +++ b/urandomb.c @@ -45,7 +45,7 @@ mpfr_urandomb (mpfr_ptr rop, gmp_randstate_t rstate) mpfr_prec_t nbits; mp_size_t nlimbs; mp_size_t k; /* number of high zero limbs */ - mp_exp_t exp; + mpfr_exp_t exp; int cnt; rp = MPFR_MANT (rop); diff --git a/vasprintf.c b/vasprintf.c index 18b859f52..fa632f967 100644 --- a/vasprintf.c +++ b/vasprintf.c @@ -84,7 +84,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #elif (__GMP_MP_SIZE_T_INT == 0) #define MPFR_EXP_FORMAT_SPEC "li" #else -#error "mp_exp_t size not supported" +#error "mpfr_exp_t size not supported" #endif /* Output for special values defined in the C99 standard */ @@ -818,11 +818,11 @@ next_base_power_p (mpfr_srcptr x, int base, mpfr_rnd_t rnd) Return +1 if x is rounded up to 10^f, return zero otherwise. If e is not NULL, *e is set to f. */ static int -round_to_10_power (mp_exp_t *e, mpfr_srcptr x, mpfr_prec_t p, mpfr_rnd_t r) +round_to_10_power (mpfr_exp_t *e, mpfr_srcptr x, mpfr_prec_t p, mpfr_rnd_t r) { mpfr_t f, u, v, y; mpfr_prec_t m; - mp_exp_t ex; + mpfr_exp_t ex; mpfr_uexp_t uexp; int roundup = -1; /* boolean (-1: not set) */ @@ -851,7 +851,7 @@ round_to_10_power (mp_exp_t *e, mpfr_srcptr x, mpfr_prec_t p, mpfr_rnd_t r) /* In most cases, the output exponent is f. */ if (e != NULL) - *e = (mp_exp_t)mpfr_get_si (f, MPFR_RNDD); + *e = (mpfr_exp_t)mpfr_get_si (f, MPFR_RNDD); if (r == MPFR_RNDZ || (MPFR_IS_POS (x) && r == MPFR_RNDD) @@ -866,7 +866,7 @@ round_to_10_power (mp_exp_t *e, mpfr_srcptr x, mpfr_prec_t p, mpfr_rnd_t r) { int cmp; int inex_u, inex_v, inex_w; - mp_exp_t exp_u, exp_v, exp_w; + mpfr_exp_t exp_u, exp_v, exp_w; m = MPFR_PREC (x); m += MPFR_INT_CEIL_LOG2 (m); @@ -938,7 +938,7 @@ round_to_10_power (mp_exp_t *e, mpfr_srcptr x, mpfr_prec_t p, mpfr_rnd_t r) if (mpfr_cmp (y, u) >= 0) { if (e != NULL) - *e = (mp_exp_t)mpfr_get_si (f, MPFR_RNDD) + 1; + *e = (mpfr_exp_t)mpfr_get_si (f, MPFR_RNDD) + 1; roundup = +1; break; @@ -967,7 +967,7 @@ regular_ab (struct number_parts *np, mpfr_srcptr p, int uppercase; int base; char *str; - mp_exp_t exp; + mpfr_exp_t exp; uppercase = spec.spec == 'A'; @@ -1174,7 +1174,7 @@ regular_eg (struct number_parts *np, mpfr_srcptr p, const struct printf_spec spec) { char *str; - mp_exp_t exp; + mpfr_exp_t exp; const int uppercase = spec.spec == 'E' || spec.spec == 'G'; const int spec_g = spec.spec == 'g' || spec.spec == 'G'; @@ -1293,7 +1293,7 @@ static int regular_fg (struct number_parts *np, mpfr_srcptr p, const struct printf_spec spec) { - mp_exp_t exp; + mpfr_exp_t exp; char * str; const int spec_g = (spec.spec == 'g' || spec.spec == 'G'); const int keep_trailing_zeros = spec_g && spec.alt; @@ -1358,7 +1358,7 @@ regular_fg (struct number_parts *np, mpfr_srcptr p, { /* compare |p| to y = 0.5*10^(-spec.prec) */ mpfr_t y; - mp_exp_t e = MAX (MPFR_PREC (p), 56); + mpfr_exp_t e = MAX (MPFR_PREC (p), 56); mpfr_init2 (y, e + 8); do { @@ -1735,7 +1735,7 @@ partition_number (struct number_parts *np, mpfr_srcptr p, where T is the threshold computed below and X is the exponent that would be displayed with style 'e' and precision T-1. */ int threshold; - mp_exp_t x; + mpfr_exp_t x; threshold = (spec.prec < 0) ? 6 : (spec.prec == 0) ? 1 : spec.prec; round_to_10_power (&x, p, threshold - 1, spec.rnd_mode); @@ -42,12 +42,12 @@ mpfr_y1 (mpfr_ptr res, mpfr_srcptr z, mpfr_rnd_t r) return e >= 0 the exponent difference between the maximal value of |s| during the for loop and the final value of |s|. */ -static mp_exp_t +static mpfr_exp_t mpfr_yn_s1 (mpfr_ptr s, mpfr_srcptr y, unsigned long n) { unsigned long k; mpz_t f; - mp_exp_t e, emax; + mpfr_exp_t e, emax; mpz_init_set_ui (f, 1); /* we compute n!*S1 = sum(a[k]*y^k,k=0..n) where a[k] = n!*(n-k)!/k!, @@ -81,13 +81,13 @@ mpfr_yn_s1 (mpfr_ptr s, mpfr_srcptr y, unsigned long n) k=2: 3/2+h(n+2) Returns e such that the error is bounded by 2^e ulp(s). */ -static mp_exp_t +static mpfr_exp_t mpfr_yn_s3 (mpfr_ptr s, mpfr_srcptr y, mpfr_srcptr c, unsigned long n) { unsigned long k, zz; mpfr_t t, u; mpz_t p, q; /* p/q will store h(k)+h(n+k) */ - mp_exp_t exps, expU; + mpfr_exp_t exps, expU; zz = mpfr_get_ui (y, MPFR_RNDU); /* y = z^2/4 */ MPFR_ASSERTN (zz < ULONG_MAX - 2); @@ -132,7 +132,7 @@ mpfr_yn_s3 (mpfr_ptr s, mpfr_srcptr y, mpfr_srcptr c, unsigned long n) exps = MPFR_EXP (s); if (exps > expU) expU = exps; - if (MPFR_EXP (u) + (mp_exp_t) MPFR_PREC (u) < MPFR_EXP (s) && + if (MPFR_EXP (u) + (mpfr_exp_t) MPFR_PREC (u) < MPFR_EXP (s) && zz / (2 * k) < k + n) break; } @@ -209,7 +209,7 @@ mpfr_yn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r) Note: we use both the main term in log(z) and the constant term, because otherwise the relative error would be only in 1/log(|log(z)|). */ - if (n == 0 && MPFR_EXP(z) < - (mp_exp_t) (MPFR_PREC(res) / 2)) + if (n == 0 && MPFR_EXP(z) < - (mpfr_exp_t) (MPFR_PREC(res) / 2)) { mpfr_t l, h, t, logz; mpfr_prec_t prec; @@ -265,11 +265,11 @@ mpfr_yn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r) /* small argument check for y1(z) = -2/Pi/z + O(log(z)): for 0 <= z <= 1, |y1(z) + 2/Pi/z| <= 0.25 */ - if (n == 1 && MPFR_EXP(z) + 1 < - (mp_exp_t) MPFR_PREC(res)) + if (n == 1 && MPFR_EXP(z) + 1 < - (mpfr_exp_t) MPFR_PREC(res)) { mpfr_t y; mpfr_prec_t prec; - mp_exp_t err1; + mpfr_exp_t err1; int ok; MPFR_BLOCK_DECL (flags); @@ -295,7 +295,7 @@ mpfr_yn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r) if (MPFR_EXP(y) + 2 >= MPFR_PREC(y)) /* ulp(y) >= 1/4 */ err1 = 3; else /* ulp(y) <= 1/8 */ - err1 = (mp_exp_t) MPFR_PREC(y) - MPFR_EXP(y) + 1; + err1 = (mpfr_exp_t) MPFR_PREC(y) - MPFR_EXP(y) + 1; ok = MPFR_CAN_ROUND (y, prec - err1, MPFR_PREC(res), r); if (ok) inex = mpfr_set (res, y, r); @@ -316,7 +316,7 @@ mpfr_yn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r) /* General case */ { mpfr_prec_t prec; - mp_exp_t err1, err2, err3; + mpfr_exp_t err1, err2, err3; mpfr_t y, s1, s2, s3; MPFR_ZIV_DECL (loop); @@ -166,12 +166,12 @@ mpfr_zeta_pos (mpfr_t z, mpfr_srcptr s, mpfr_rnd_t rnd_mode) The error is < 2^(-x+1) <= 2^(-2^(EXP(x)-1)+1) */ if (MPFR_GET_EXP (s) > 3) { - mp_exp_t err; + mpfr_exp_t err; err = MPFR_GET_EXP (s) - 1; - if (err > (mp_exp_t) (sizeof (mp_exp_t)*CHAR_BIT-2)) + if (err > (mpfr_exp_t) (sizeof (mpfr_exp_t)*CHAR_BIT-2)) err = MPFR_EMAX_MAX; else - err = ((mp_exp_t)1) << err; + err = ((mpfr_exp_t)1) << err; err = 1 - (-err+1); /* GET_EXP(one) - (-err+1) = err :) */ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (z, __gmpfr_one, err, 0, 1, rnd_mode, {}); @@ -201,7 +201,7 @@ mpfr_zeta_pos (mpfr_t z, mpfr_srcptr s, mpfr_rnd_t rnd_mode) { /* Principal loop: we compute, in z_pre, an approximation of Zeta(s), that we send to can_round */ - if (MPFR_GET_EXP (s1) <= -(mp_exp_t) ((mpfr_prec_t) (d-3)/2)) + if (MPFR_GET_EXP (s1) <= -(mpfr_exp_t) ((mpfr_prec_t) (d-3)/2)) /* Branch 1: when s-1 is very small, one uses the approximation Zeta(s)=1/(s-1)+gamma, where gamma is Euler's constant */ @@ -341,7 +341,7 @@ mpfr_zeta (mpfr_t z, mpfr_srcptr s, mpfr_rnd_t rnd_mode) Thus if |s| <= 1/4*ulp(1/2), we can deduce the correct rounding (the 1/4 covers the case where |zeta(s)| < 1/2 and rounding to nearest). A sufficient condition is that EXP(s) + 1 < -PREC(z). */ - if (MPFR_EXP(s) + 1 < - (mp_exp_t) MPFR_PREC(z)) + if (MPFR_EXP(s) + 1 < - (mpfr_exp_t) MPFR_PREC(z)) { int signs = MPFR_SIGN(s); mpfr_set_si_2exp (z, -1, -1, rnd_mode); /* -1/2 */ |