summaryrefslogtreecommitdiff
path: root/atan.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-05-06 12:37:21 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-05-06 12:37:21 +0000
commit192543932ca7ce494da0f1956475996bdd09e107 (patch)
treef18814d29b14a45058def73e1f97a2dcba103d9f /atan.c
parent4a3ec96bc477f258f2fab8bac31a7ec5059b09ce (diff)
downloadmpfr-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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/atan.c b/atan.c
index 3e5b44fe1..ecb2bdf71 100644
--- a/atan.c
+++ b/atan.c
@@ -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);
}