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 | a6043f2d22e376360264317d140406d85c1f3649 (patch) | |
tree | 196e725c272f5da0a5843506a28f091ae820e65d /expm1.c | |
parent | bf7ddd19d8dd01f52acc4b5cec744b4a3df96771 (diff) | |
download | mpfr-a6043f2d22e376360264317d140406d85c1f3649.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 'expm1.c')
-rw-r--r-- | expm1.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -124,16 +124,17 @@ mpfr_expm1 (mpfr_ptr y, mpfr_srcptr x , mp_rnd_t rnd_mode) MPFR_ZIV_INIT (loop, Nt); for (;;) { - mpfr_clear_flags (); + MPFR_BLOCK_DECL (flags); + /* exp(x) may overflow and underflow */ - mpfr_exp (t, x, GMP_RNDN); /* exp(x)*/ - if (MPFR_UNLIKELY (mpfr_overflow_p ())) + MPFR_BLOCK (flags, mpfr_exp (t, x, GMP_RNDN)); + if (MPFR_OVERFLOW (flags)) { inexact = mpfr_overflow (y, rnd_mode, MPFR_SIGN_POS); MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_OVERFLOW); break; } - else if (MPFR_UNLIKELY (mpfr_underflow_p ())) + else if (MPFR_UNDERFLOW (flags)) { inexact = mpfr_set_si (y, -1, rnd_mode); MPFR_ASSERTD (inexact == 0); |