summaryrefslogtreecommitdiff
path: root/set_d.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-16 17:12:45 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-16 17:12:45 +0000
commit5094d98158eff8a199b86a34bc1a00a8308fbfe9 (patch)
treeaa0d778d07058b4827cc375c5f7dda96d62623b2 /set_d.c
parent8b524829df9b1eb43cd0ef29a378face7e97e17f (diff)
downloadmpfr-5094d98158eff8a199b86a34bc1a00a8308fbfe9.tar.gz
deal with overflow/underflow in mpfr_div
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2734 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'set_d.c')
-rw-r--r--set_d.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/set_d.c b/set_d.c
index 4db207a2d..713326cdc 100644
--- a/set_d.c
+++ b/set_d.c
@@ -206,6 +206,8 @@ mpfr_set_d (mpfr_ptr r, double d, mp_rnd_t rnd_mode)
/* now d is neither 0, nor NaN nor Inf */
+ mpfr_save_emin_emax ();
+
/* warning: don't use tmp=r here, even if SIZE(r) >= MPFR_LIMBS_PER_DOUBLE,
since PREC(r) may be different from PREC(tmp), and then both variables
would have same precision in the mpfr_set4 call below. */
@@ -253,5 +255,7 @@ mpfr_set_d (mpfr_ptr r, double d, mp_rnd_t rnd_mode)
/* tmp is exact since PREC(tmp)=53 */
inexact = mpfr_set4 (r, tmp, rnd_mode, signd);
+ mpfr_restore_emin_emax ();
+
return mpfr_check_range (r, inexact, rnd_mode);
}