diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2001-10-15 14:08:57 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2001-10-15 14:08:57 +0000 |
commit | 9a885e9800fd6905cebbd85e3d9850f8d356db81 (patch) | |
tree | 65e21b2279d79dc93515a048dcab08ba0de6e941 /div_2exp.c | |
parent | 04bfaa6bd6c5e0aeb35672eda157b52a41ce58e5 (diff) | |
download | mpfr-9a885e9800fd6905cebbd85e3d9850f8d356db81.tar.gz |
implement inexact flag
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1255 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'div_2exp.c')
-rw-r--r-- | div_2exp.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/div_2exp.c b/div_2exp.c index e518f6518..0a400a002 100644 --- a/div_2exp.c +++ b/div_2exp.c @@ -25,7 +25,7 @@ MA 02111-1307, USA. */ #include "mpfr.h" #include "mpfr-impl.h" -void +int #if __STDC__ mpfr_div_2exp (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mp_rnd_t rnd_mode) #else @@ -36,9 +36,12 @@ mpfr_div_2exp (y, x, n, rnd_mode) mp_rnd_t rnd_mode; #endif { + int inexact = 0; + /* Important particular case */ - if (y != x) mpfr_set(y, x, rnd_mode); - MPFR_EXP(y) -= n; - return; + if (y != x) + inexact = mpfr_set (y, x, rnd_mode); + return ((MPFR_EXP(y) -= n) < __mpfr_emin) + ? mpfr_set_underflow (y, rnd_mode, MPFR_SIGN(y)) : inexact; } |