summaryrefslogtreecommitdiff
path: root/asinh.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 /asinh.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 'asinh.c')
-rw-r--r--asinh.c54
1 files changed, 24 insertions, 30 deletions
diff --git a/asinh.c b/asinh.c
index a4ab317af..ac6de2595 100644
--- a/asinh.c
+++ b/asinh.c
@@ -1,6 +1,6 @@
/* mpfr_asinh -- Inverse Hyperbolic Sinus of Unsigned Integer Number
-Copyright (C) 2001 Free Software Foundation.
+Copyright (C) 2001-2002 Free Software Foundation.
This file is part of the MPFR Library.
@@ -29,51 +29,45 @@ MA 02111-1307, USA. */
asinh= ln(x+sqrt(x^2+1))
*/
int
-mpfr_asinh (mpfr_ptr y, mpfr_srcptr xt , mp_rnd_t rnd_mode)
+mpfr_asinh (mpfr_ptr y, mpfr_srcptr xt, mp_rnd_t rnd_mode)
{
- int inexact =0;
+ int inexact;
mpfr_t x;
int flag_neg=0;
+ mp_prec_t Nx;
- mp_prec_t Nx=MPFR_PREC(xt); /* Precision of input variable */
- mpfr_init2(x,Nx);
- mpfr_set(x,xt,GMP_RNDN);
-
- if (MPFR_SIGN(x) < 0)
- {
- MPFR_CHANGE_SIGN(x);
- flag_neg=1;
- }
-
- if (MPFR_IS_NAN(x))
+ if (MPFR_IS_NAN(xt))
{
MPFR_SET_NAN(y);
- mpfr_clear(x);
- return 1;
+ MPFR_RET_NAN;
}
+
MPFR_CLEAR_NAN(y);
-
- if (MPFR_IS_INF(x))
+ if (MPFR_IS_INF(xt))
{
MPFR_SET_INF(y);
- MPFR_SET_SAME_SIGN(y,x);
- if(flag_neg)
- MPFR_CHANGE_SIGN(y);
- mpfr_clear(x);
- return 1;
+ MPFR_SET_SAME_SIGN(y, xt);
+ MPFR_RET(0);
}
MPFR_CLEAR_INF(y);
- if(!MPFR_NOTZERO(x))
+ if (MPFR_IS_ZERO(xt))
{
MPFR_SET_ZERO(y); /* asinh(0) = 0 */
- MPFR_SET_SAME_SIGN(y,x);
- if(flag_neg)
- MPFR_CHANGE_SIGN(y);
- mpfr_clear(x);
- return 0;
+ MPFR_SET_SAME_SIGN(y, xt);
+ MPFR_RET(0);
+ }
+
+ Nx = MPFR_PREC(xt); /* Precision of input variable */
+ mpfr_init2(x, Nx);
+ mpfr_set(x, xt, GMP_RNDN);
+
+ if (MPFR_SIGN(x) < 0)
+ {
+ MPFR_CHANGE_SIGN(x);
+ flag_neg=1;
}
/* General case */
@@ -132,5 +126,5 @@ mpfr_asinh (mpfr_ptr y, mpfr_srcptr xt , mp_rnd_t rnd_mode)
mpfr_clear(te);
}
mpfr_clear(x);
- return inexact;
+ MPFR_RET(inexact);
}