summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2001-11-28 16:54:20 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2001-11-28 16:54:20 +0000
commita0386d7b05a6b0e1a277682e37989ea18232d131 (patch)
treebff14e70d6205a799e0b24011e5b994d362c8470
parent76e993369fac6bc17a4c91eb5f953d9a900a465e (diff)
downloadmpfr-a0386d7b05a6b0e1a277682e37989ea18232d131.tar.gz
Particular cases fixed.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1583 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--asin.c10
-rw-r--r--atan.c7
2 files changed, 10 insertions, 7 deletions
diff --git a/asin.c b/asin.c
index 27d15af2e..95fd59a1c 100644
--- a/asin.c
+++ b/asin.c
@@ -43,10 +43,10 @@ mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mp_rnd_t rnd_mode)
int compared;
/* Trivial cases */
- if (MPFR_IS_NAN(x))
+ if (MPFR_IS_NAN(x) || MPFR_IS_INF(x))
{
MPFR_SET_NAN(asin);
- return 1;
+ MPFR_RET_NAN;
}
/* Set x_p=|x| */
@@ -54,7 +54,7 @@ mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mp_rnd_t rnd_mode)
mpfr_init2 (xp, MPFR_PREC(x));
mpfr_set (xp, x, rnd_mode);
if (signe == -1)
- MPFR_CHANGE_SIGN(xp);
+ MPFR_CHANGE_SIGN(xp);
compared = mpfr_cmp_ui (xp, 1);
@@ -62,7 +62,7 @@ mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
MPFR_SET_NAN(asin);
mpfr_clear(xp);
- return 1;
+ MPFR_RET_NAN;
}
if (compared == 0) /* x = 1 or x = -1 */
@@ -82,7 +82,7 @@ mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mp_rnd_t rnd_mode)
return 1; /* inexact */
}
- if (!MPFR_NOTZERO(x)) /* x = 0 */
+ if (MPFR_IS_ZERO(x)) /* x = 0 */
{
mpfr_set_ui (asin, 0, GMP_RNDN);
mpfr_clear(xp);
diff --git a/atan.c b/atan.c
index 1c26c46e8..5d844f887 100644
--- a/atan.c
+++ b/atan.c
@@ -87,11 +87,12 @@ mpfr_atan (mpfr_ptr arctangent, mpfr_srcptr x, mp_rnd_t rnd_mode)
if (MPFR_IS_NAN(x))
{
MPFR_SET_NAN(arctangent);
- return 1;
+ MPFR_RET_NAN;
}
if (MPFR_IS_INF(x))
{
+ MPFR_CLEAR_FLAGS(arctangent);
if (MPFR_SIGN(x) > 0) /* arctan(+inf) = Pi/2 */
mpfr_const_pi (arctangent, rnd_mode);
else /* arctan(-inf) = -Pi/2 */
@@ -106,7 +107,9 @@ mpfr_atan (mpfr_ptr arctangent, mpfr_srcptr x, mp_rnd_t rnd_mode)
return 1; /* inexact */
}
- if (!MPFR_NOTZERO(x))
+ MPFR_CLEAR_FLAGS(arctangent);
+
+ if (MPFR_IS_ZERO(x))
{
mpfr_set_ui(arctangent, 0, GMP_RNDN);
return 0; /* exact result */