diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-10-06 14:44:18 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-10-06 14:44:18 +0000 |
commit | a927fbd495443d0d69179d79ef842f148dbf57b6 (patch) | |
tree | 829cfeaabf0d1e52e6fc7dd2d973f983f1aab987 /asin.c | |
parent | cd9cf505966fd9e1c8f52ce2eec144e3d3822f6f (diff) | |
download | mpfr-a927fbd495443d0d69179d79ef842f148dbf57b6.tar.gz |
inexact flag should now be correct for directed rounding
fixed a bug for mpfr_atan(-Inf) [gave +Pi/2 instead of -Pi/2]
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2478 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'asin.c')
-rw-r--r-- | asin.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -40,7 +40,8 @@ mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mp_rnd_t rnd_mode) int good = 0; int realprec; int estimated_delta; - int compared; + int compared; + int inexact; /* Trivial cases */ if (MPFR_IS_NAN(x) || MPFR_IS_INF(x)) @@ -68,25 +69,25 @@ mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mp_rnd_t rnd_mode) if (compared == 0) /* x = 1 or x = -1 */ { if (signe > 0) /* asin(+1) = Pi/2 */ - mpfr_const_pi (asin, rnd_mode); + inexact = mpfr_const_pi (asin, rnd_mode); else /* asin(-1) = -Pi/2 */ { if (rnd_mode == GMP_RNDU) rnd_mode = GMP_RNDD; else if (rnd_mode == GMP_RNDD) rnd_mode = GMP_RNDU; - mpfr_const_pi (asin, rnd_mode); + inexact = -mpfr_const_pi (asin, rnd_mode); mpfr_neg (asin, asin, rnd_mode); } MPFR_SET_EXP (asin, MPFR_GET_EXP (asin) - 1); mpfr_clear (xp); - return 1; /* inexact */ + return inexact; } if (MPFR_IS_ZERO(x)) /* x = 0 */ { mpfr_set_ui (asin, 0, GMP_RNDN); - mpfr_clear(xp); + mpfr_clear (xp); return 0; /* exact result */ } @@ -152,7 +153,7 @@ mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mp_rnd_t rnd_mode) #endif if (mpfr_can_round (arcs, realprec, GMP_RNDN, rnd_mode, MPFR_PREC(asin))) { - mpfr_set (asin, arcs, rnd_mode); + inexact = mpfr_set (asin, arcs, rnd_mode); #ifdef DEBUG printf("asin ="); mpfr_out_str (stdout, 2, prec_asin, asin, GMP_RNDN); @@ -173,7 +174,7 @@ mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mp_rnd_t rnd_mode) mpfr_clear (xp); - return 1; /* inexact result */ + return inexact; } |