summaryrefslogtreecommitdiff
path: root/exp2.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-02-01 21:35:34 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-02-01 21:35:34 +0000
commit6e879c6f3361346ede165d0733a26e9145cccf69 (patch)
treeba27f0eb5a934b1be7da19ed5937cb8f7b076608 /exp2.c
parentd2a8d03f413280358567c13baa9b2e1f6e3349bf (diff)
downloadmpfr-6e879c6f3361346ede165d0733a26e9145cccf69.tar.gz
Misc bug fixes and code clean-up.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1678 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'exp2.c')
-rw-r--r--exp2.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/exp2.c b/exp2.c
index 3768778f5..8370510a1 100644
--- a/exp2.c
+++ b/exp2.c
@@ -1,6 +1,6 @@
/* mpfr_exp2 -- power of 2 function 2^y
-Copyright (C) 2001 Free Software Foundation.
+Copyright (C) 2001-2002 Free Software Foundation.
This file is part of the MPFR Library.
@@ -37,35 +37,30 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
if (MPFR_IS_NAN(x))
{
- MPFR_SET_NAN(y);
- return 1;
+ MPFR_SET_NAN(y);
+ MPFR_RET_NAN;
}
MPFR_CLEAR_NAN(y);
if (MPFR_IS_INF(x))
{
- if (MPFR_SIGN(x) < 0)
+ if (MPFR_SIGN(x) > 0)
{
- MPFR_SET_ZERO(y);
- if (MPFR_SIGN(y) < 0)
- MPFR_CHANGE_SIGN(y);
- return 0;
+ MPFR_SET_INF(y);
}
else
{
- MPFR_SET_INF(y);
- if(MPFR_SIGN(y) < 0)
- MPFR_CHANGE_SIGN(y);
- return 0;
+ MPFR_CLEAR_INF(y);
+ MPFR_SET_ZERO(y);
}
+ MPFR_SET_POS(y);
+ MPFR_RET(0);
}
/* 2^0 = 1 */
- if(mpfr_cmp_ui(x,0)==0)
- {
- return mpfr_set_ui(y,1,rnd_mode);
- }
+ if (MPFR_IS_ZERO(x))
+ return mpfr_set_ui (y, 1, rnd_mode);
/* General case */
{