summaryrefslogtreecommitdiff
path: root/exceptions.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-04-23 20:00:42 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-04-23 20:00:42 +0000
commit55dce27825331d17d9551678b043dbbbba5345ed (patch)
treed91880efc3cb6723193007c84e93d153b1f4d7fe /exceptions.c
parent2e8f831311bfb69b69770d64e4573202d342a94b (diff)
downloadmpfr-55dce27825331d17d9551678b043dbbbba5345ed.tar.gz
Underflow semantics changed (not tested).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1910 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'exceptions.c')
-rw-r--r--exceptions.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/exceptions.c b/exceptions.c
index a8519992f..87341a4b0 100644
--- a/exceptions.c
+++ b/exceptions.c
@@ -167,14 +167,20 @@ mpfr_inexflag_p (void)
#undef mpfr_set_underflow
+/* Note: In the rounding to the nearest mode, mpfr_set_underflow
+ always rounds away from 0. In this rounding mode, you must call
+ mpfr_set_underflow with rnd_mode = GMP_RNDZ if the exact result
+ is <= 2^(emin-2) in absolute value. */
+
int
mpfr_set_underflow (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))
{
mp_size_t xn;
mp_limb_t *xp;