diff options
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; } |