summaryrefslogtreecommitdiff
path: root/frac.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2003-10-28 16:31:13 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2003-10-28 16:31:13 +0000
commit117edf14c822a22cdd9c25689aeadc904a1a30d1 (patch)
treee39bd61cefc24cc6cfbc5b2b956e4fb36015d111 /frac.c
parent734c0a144b04e2cae4e67b394010e3f6e3cadecc (diff)
downloadmpfr-117edf14c822a22cdd9c25689aeadc904a1a30d1.tar.gz
Use of MPFR_UNLIKELY and MPFR_IS_SINGULAR for fast detection of special values (Nan, Inf or Zero).
Start to encapsulate the sign to be independant of the reprensation (Must be 1 or -1). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2525 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'frac.c')
-rw-r--r--frac.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/frac.c b/frac.c
index fd4e99a7f..45833ecbe 100644
--- a/frac.c
+++ b/frac.c
@@ -36,13 +36,13 @@ mpfr_frac (mpfr_ptr r, mpfr_srcptr u, mp_rnd_t rnd_mode)
mpfr_t tmp;
mpfr_ptr t;
- if (MPFR_IS_NAN(u))
+ /* Special cases */
+ if (MPFR_UNLIKELY(MPFR_IS_NAN(u)))
{
MPFR_SET_NAN(r);
MPFR_RET_NAN;
}
-
- if (MPFR_IS_INF(u) || mpfr_integer_p (u))
+ else if (MPFR_UNLIKELY(MPFR_IS_INF(u) || mpfr_integer_p (u)))
{
MPFR_CLEAR_FLAGS(r);
MPFR_SET_SAME_SIGN(r, u);