diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-12-18 15:51:00 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-12-18 15:51:00 +0000 |
commit | 3d18cb6f46f5709e50d654e9f75ecef45f3e54f9 (patch) | |
tree | 196e725c272f5da0a5843506a28f091ae820e65d /exp3.c | |
parent | ad2d81a684559a531d015273bbd23750cf9ad279 (diff) | |
download | mpfr-3d18cb6f46f5709e50d654e9f75ecef45f3e54f9.tar.gz |
Merged the feature-block branch to the trunk:
* New MPFR_BLOCK* macros (see mpfr-impl.h) and mpfrlint check to test
exception flags in a more reliable way and detect possible problems
with mpfrlint.
* Improved the generic tests (tests/tgeneric.c): for the second
function call, sometimes set all the flags since risk of failures
are known when some flags are already set.
* Modified code to use these new MPFR_BLOCK* macros. This fixed bugs
related to exceptions (where flags are set before the call); in
particular, tcot and ty1 failed with the improved generic tests.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5115 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'exp3.c')
-rw-r--r-- | exp3.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -201,6 +201,8 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) MPFR_ZIV_INIT (ziv_loop, realprec); for (;;) { + MPFR_BLOCK_DECL (flags); + k = MPFR_INT_CEIL_LOG2 (Prec) - MPFR_LOG2_BITS_PER_MP_LIMB; /* now we have to extract */ @@ -240,11 +242,11 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) (*__gmp_free_func) (P, 3*(k+2)*sizeof(mpz_t)); (*__gmp_free_func) (mult, 2*(k+2)*sizeof(mp_prec_t)); - mpfr_clear_flags (); - for (loop = 0; loop < shift_x; loop++) - mpfr_mul (tmp, tmp, tmp, GMP_RNDD); + MPFR_BLOCK (flags, + for (loop = 0; loop < shift_x; loop++) + mpfr_mul (tmp, tmp, tmp, GMP_RNDD)); - if (MPFR_UNLIKELY (mpfr_overflow_p ())) + if (MPFR_OVERFLOW (flags)) { /* We hack to set a FP number outside the valid range so that mpfr_check_range properly generates an overflow */ @@ -253,7 +255,7 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) inexact = 1; break; } - else if (MPFR_UNLIKELY (mpfr_underflow_p ())) + else if (MPFR_UNDERFLOW (flags)) { inexact = mpfr_underflow (y, rnd_mode, 1); MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_INEXACT |