diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-11-27 14:04:51 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-11-27 14:04:51 +0000 |
commit | 7f6ebb2eaa8a24d44ab7b93940fdbf190b95257c (patch) | |
tree | f0077e4ba73108ac08b27e89ada3e50d73cc05a1 | |
parent | 500815181028aafe88750cf308aa57959b9333ee (diff) | |
download | mpfr-7f6ebb2eaa8a24d44ab7b93940fdbf190b95257c.tar.gz |
Updated atan2.c and cosh.c.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/feature-block@5029 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | atan2.c | 9 | ||||
-rw-r--r-- | cosh.c | 7 |
2 files changed, 10 insertions, 6 deletions
@@ -170,8 +170,11 @@ mpfr_atan2 (mpfr_ptr dest, mpfr_srcptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) /* use atan2(y,x) = atan(y/x) */ for (;;) { - mpfr_clear_flags (); - if (mpfr_div (tmp, y, x, GMP_RNDN) == 0) + int div_inex; + MPFR_BLOCK_DECL (flags); + + MPFR_BLOCK (flags, div_inex = mpfr_div (tmp, y, x, GMP_RNDN)); + if (div_inex == 0) { /* Result is exact. */ inexact = mpfr_atan (dest, tmp, rnd_mode); @@ -182,7 +185,7 @@ mpfr_atan2 (mpfr_ptr dest, mpfr_srcptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) /* If the division underflowed, since |atan(z)/z| < 1, we have an underflow. */ - if (MPFR_UNLIKELY (mpfr_underflow_p ())) + if (MPFR_UNDERFLOW (flags)) { int sign; @@ -87,12 +87,13 @@ mpfr_cosh (mpfr_ptr y, mpfr_srcptr xt , mp_rnd_t rnd_mode) MPFR_ZIV_INIT (loop, Nt); for (;;) { + MPFR_BLOCK_DECL (flags); + /* Compute cosh */ - mpfr_clear_flags (); - mpfr_exp (te, x, GMP_RNDD); /* exp(x) */ + MPFR_BLOCK (flags, mpfr_exp (te, x, GMP_RNDD)); /* exp(x) */ /* exp can overflow (but not underflow since x>0) */ /* BUG/TODO/FIXME: exp can overflow but cosh may be representable! */ - if (MPFR_UNLIKELY (mpfr_overflow_p ())) + if (MPFR_OVERFLOW (flags)) { inexact = mpfr_overflow (y, rnd_mode, MPFR_SIGN_POS); MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_OVERFLOW); |