summaryrefslogtreecommitdiff
path: root/rint.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2003-11-04 13:15:26 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2003-11-04 13:15:26 +0000
commitabfa7f839fabfe6a797057128abff86d598076d9 (patch)
tree478f997f6445673a3f535f08caf32f9e7075ea33 /rint.c
parent342b90d25ebeab276e971826f3a1c8ffbb8f98a6 (diff)
downloadmpfr-abfa7f839fabfe6a797057128abff86d598076d9.tar.gz
+ Remove MPFR_CLEAR_NAN and MPFR_CLEAR_INF. Only use MPFR_CLEAR_FLAGS.
MPFR_SET_INF, MPFR_SET_ZERO and MPFR_SET_ZERO must clear the flags before setting them. + Add a new test in tacosh.c : check Inf / Nan flags. + Use MPFR_IS_SINGULAR in all the remaining files. + Fix the use of MPFR_CLEAR_FLAGS. + mpfr-impl.h auto include gmp.h, gmp-impl.h, mpfr.h and limits.h. + Rename _PROTO to _MPFR_PROTO, and remove _GMP_PROTO. + Add MPFR_INT_SIGN macro. + Encapsulate a few more the sign. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2529 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'rint.c')
-rw-r--r--rint.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/rint.c b/rint.c
index d08007aad..97877f8dc 100644
--- a/rint.c
+++ b/rint.c
@@ -36,30 +36,29 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mp_rnd_t rnd_mode)
int rnd_away;
mp_exp_t exp;
- if (MPFR_IS_NAN(u))
+ if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(u) ))
{
- MPFR_SET_NAN(r);
- MPFR_RET_NAN;
+ if (MPFR_IS_NAN(u))
+ {
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+ }
+ MPFR_SET_SAME_SIGN(r, u);
+ if (MPFR_IS_INF(u))
+ {
+ MPFR_SET_INF(r);
+ MPFR_RET(0); /* infinity is exact */
+ }
+ if (MPFR_IS_ZERO(u))
+ {
+ MPFR_SET_ZERO(r);
+ MPFR_RET(0); /* zero is exact */
+ }
+ MPFR_ASSERTN(1);
}
-
- MPFR_CLEAR_NAN(r);
MPFR_SET_SAME_SIGN(r, u);
-
- if (MPFR_IS_INF(u))
- {
- MPFR_SET_INF(r);
- MPFR_RET(0); /* infinity is exact */
- }
-
- MPFR_CLEAR_INF(r);
-
- if (MPFR_IS_ZERO(u))
- {
- MPFR_SET_ZERO(r);
- MPFR_RET(0); /* zero is exact */
- }
-
- sign = MPFR_SIGN(u);
+
+ sign = MPFR_INT_SIGN(u);
exp = MPFR_GET_EXP (u);
rnd_away =