summaryrefslogtreecommitdiff
path: root/strtofr.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-09-21 12:42:37 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-09-21 12:42:37 +0000
commit4beb1c57e8068248bca510a3a418affde4a14b19 (patch)
tree81ae252ec15a56d940381f18d767f32dbc716fe3 /strtofr.c
parent4321457550636d508bf623a6ae1704ce7b1bac9a (diff)
downloadmpfr-4beb1c57e8068248bca510a3a418affde4a14b19.tar.gz
Fix a bug in FreeBsd 5.20 / Alpha / Gcc 3.3.3.
Not a MPFR bug, but add some code to avoid it. Reference: http://www.freebsd.org/cgi/query-pr.cgi?pr=72024 git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2982 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'strtofr.c')
-rw-r--r--strtofr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/strtofr.c b/strtofr.c
index b38554782..3210aad17 100644
--- a/strtofr.c
+++ b/strtofr.c
@@ -490,9 +490,11 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mp_rnd_t rnd)
mp_exp_t, mp_exp_unsigned_t,
MPFR_EXP_MIN, MPFR_EXP_MAX,
goto overflow, goto underflow);
- if (tmp > 0 && MPFR_EXP_MAX/pow2 <= tmp)
+ /* On some FreeBsd/Alpha, LONG_MIN/1 produces an exception
+ so we check for this before doing the division */
+ if (tmp > 0 && pow2 != 1 && MPFR_EXP_MAX/pow2 <= tmp)
goto overflow;
- else if (tmp < 0 && MPFR_EXP_MIN/pow2 >= tmp)
+ else if (tmp < 0 && pow2 != 1 && MPFR_EXP_MIN/pow2 >= tmp)
goto underflow;
tmp *= pow2;
MPFR_SADD_OVERFLOW (tmp, tmp, pstr->exp_bin,