summaryrefslogtreecommitdiff
path: root/exp2.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-12 13:20:50 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-12 13:20:50 +0000
commit10c4bdb6e6cb0a84720fc9d8c1f3bc91fceca204 (patch)
tree6baa65f5056f39be205b650528929a9405097799 /exp2.c
parent5d8fcc6938422553d0f4661ec601cac408062590 (diff)
downloadmpfr-10c4bdb6e6cb0a84720fc9d8c1f3bc91fceca204.tar.gz
improved test coverage
replaced mpfr_get_d1 by mpfr_get_si git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2685 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'exp2.c')
-rw-r--r--exp2.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/exp2.c b/exp2.c
index ef7934ecb..ac65e25a5 100644
--- a/exp2.c
+++ b/exp2.c
@@ -50,11 +50,11 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
MPFR_SET_POS(y);
MPFR_RET(0);
}
- /* 2^0 = 1 */
- else if (MPFR_IS_ZERO(x))
- return mpfr_set_ui (y, 1, rnd_mode);
- else
- MPFR_ASSERTN(0);
+ else /* 2^0 = 1 */
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(x));
+ return mpfr_set_ui (y, 1, rnd_mode);
+ }
}
/* Useless due to mpfr_set
MPFR_CLEAR_FLAGS(y);*/
@@ -74,16 +74,16 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
if (mpfr_integer_p (x)) /* we know that x >= 2^(emin-1) */
{
- double xd;
+ long xd;
MPFR_ASSERTN(MPFR_EMAX_MAX <= LONG_MAX);
if (mpfr_cmp_si_2exp (x, __gmpfr_emax, 0) > 0)
return mpfr_set_overflow (y, rnd_mode, 1);
- xd = mpfr_get_d1 (x);
+ xd = mpfr_get_si (x, GMP_RNDN);
mpfr_set_ui (y, 1, GMP_RNDZ);
- return mpfr_mul_2si (y, y, (long) xd, rnd_mode);
+ return mpfr_mul_2si (y, y, xd, rnd_mode);
}
/* General case */