diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-05-06 12:37:21 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-05-06 12:37:21 +0000 |
commit | 192543932ca7ce494da0f1956475996bdd09e107 (patch) | |
tree | f18814d29b14a45058def73e1f97a2dcba103d9f /atan.c | |
parent | 4a3ec96bc477f258f2fab8bac31a7ec5059b09ce (diff) | |
download | mpfr-192543932ca7ce494da0f1956475996bdd09e107.tar.gz |
Fix overflow and add corresponding tests.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2908 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'atan.c')
-rw-r--r-- | atan.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -142,6 +142,8 @@ mpfr_atan (mpfr_ptr arctangent, mpfr_srcptr x, mp_rnd_t rnd_mode) else supplement = 2 - MPFR_GET_EXP (xp); + mpfr_save_emin_emax (); + prec_x = __gmpfr_ceil_log2 ((double) MPFR_PREC(x) / BITS_PER_MP_LIMB); logn = __gmpfr_ceil_log2 ((double) prec_x); if (logn < 2) @@ -256,5 +258,6 @@ mpfr_atan (mpfr_ptr arctangent, mpfr_srcptr x, mp_rnd_t rnd_mode) mpz_clear (ukz); mpz_clear (square); - return inexact; + mpfr_restore_emin_emax (); + return mpfr_check_range (arctgt, inexact, rnd_mode); } |