summaryrefslogtreecommitdiff
path: root/exceptions.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2003-09-14 08:52:44 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2003-09-14 08:52:44 +0000
commitd71cf99ec93271eb23df466b55240249324359a3 (patch)
tree60bee55bbd7e58e4e1a143e2d55ffc0e51c4f88c /exceptions.c
parent203303e1040010476364808f97e613dddd5af003 (diff)
downloadmpfr-d71cf99ec93271eb23df466b55240249324359a3.tar.gz
Fixed mpfr_set_overflow, added tests for mpfr_set_underflow
and mpfr_set_overflow, and reverted exp.c. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2411 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'exceptions.c')
-rw-r--r--exceptions.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/exceptions.c b/exceptions.c
index db62a01ee..ca3172a00 100644
--- a/exceptions.c
+++ b/exceptions.c
@@ -218,16 +218,17 @@ mpfr_set_overflow (mpfr_ptr x, mp_rnd_t rnd_mode, int sign)
int inex;
MPFR_CLEAR_FLAGS(x);
- if ((rnd_mode == GMP_RNDU && sign < 0)
- || (rnd_mode == GMP_RNDD && sign > 0))
+ if (rnd_mode == GMP_RNDN
+ || (rnd_mode == GMP_RNDU && sign > 0)
+ || (rnd_mode == GMP_RNDD && sign < 0))
{
- mpfr_setmax (x, __gmpfr_emax);
- inex = -1;
+ MPFR_SET_INF(x);
+ inex = 1;
}
else
{
- MPFR_SET_INF(x);
- inex = 1;
+ mpfr_setmax (x, __gmpfr_emax);
+ inex = -1;
}
if (MPFR_SIGN(x) != sign)
MPFR_CHANGE_SIGN(x);