summaryrefslogtreecommitdiff
path: root/exp3.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2003-05-22 21:39:40 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2003-05-22 21:39:40 +0000
commit44b4dd94bb98c8d9e7850ae401232bd1b2ea3028 (patch)
tree9670f0ef8017d42ad2a2062dc08c63c022e450c8 /exp3.c
parent2f3cb289a102043a22bd32c5950db37199fb3fd2 (diff)
downloadmpfr-44b4dd94bb98c8d9e7850ae401232bd1b2ea3028.tar.gz
Macros MPFR_EXP_INVALID (invalid exponent value) and MPFR_EXP_CHECK
added. Code update to use MPFR_GET_EXP and MPFR_SET_EXP instead of MPFR_EXP to allow more bug detection related to special values. Macros MPFR_SET_NAN, MPFR_SET_INF, MPFR_SET_ZERO and MPFR_INIT set the exponent of the number to MPFR_EXP_INVALID if MPFR_EXP_CHECK is defined. Compile with -DMPFR_EXP_CHECK and make check to see the potential problems; currently, 40 of 76 tests fail. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2301 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'exp3.c')
-rw-r--r--exp3.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/exp3.c b/exp3.c
index d5ae0836a..9b791e92c 100644
--- a/exp3.c
+++ b/exp3.c
@@ -107,7 +107,7 @@ mpfr_exp_rational (mpfr_ptr y, mpz_srcptr p, int r, int m)
mpz_tdiv_q(S[0], S[0], P[0]);
mpfr_set_z(y,S[0], GMP_RNDD);
- MPFR_EXP(y) += expo;
+ MPFR_SET_EXP (y, MPFR_GET_EXP (y) + expo);
mpfr_div_2ui(y, y, r*(i-1),GMP_RNDN);
for (i=0;i<=m;i++) { mpz_clear(P[i]); mpz_clear(S[i]); mpz_clear(ptoj[i]); }
@@ -143,7 +143,7 @@ mpfr_exp3 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
if (prec_x < 0) prec_x = 0;
logn = __gmpfr_ceil_log2 ((double) prec_x + MPFR_PREC(y));
if (logn < 2) logn = 2;
- ttt = MPFR_EXP(x);
+ ttt = MPFR_GET_EXP (x);
mpfr_init2(x_copy,MPFR_PREC(x));
mpfr_set(x_copy,x,GMP_RNDD);
/* we shift to get a number less than 1 */
@@ -151,7 +151,7 @@ mpfr_exp3 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
shift_x = ttt;
mpfr_div_2ui(x_copy, x, ttt, GMP_RNDN);
- ttt = MPFR_EXP(x_copy);
+ ttt = MPFR_GET_EXP (x_copy);
}
realprec = MPFR_PREC(y)+logn;
mpz_init (uk);