summaryrefslogtreecommitdiff
path: root/expm1.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2007-12-18 15:51:00 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2007-12-18 15:51:00 +0000
commita6043f2d22e376360264317d140406d85c1f3649 (patch)
tree196e725c272f5da0a5843506a28f091ae820e65d /expm1.c
parentbf7ddd19d8dd01f52acc4b5cec744b4a3df96771 (diff)
downloadmpfr-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.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/expm1.c b/expm1.c
index b04908ddf..75e15d89c 100644
--- a/expm1.c
+++ b/expm1.c
@@ -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);