diff options
Diffstat (limited to 'log10.c')
-rw-r--r-- | log10.c | 64 |
1 files changed, 32 insertions, 32 deletions
@@ -36,42 +36,42 @@ mpfr_log10 (mpfr_ptr r, mpfr_srcptr a, mp_rnd_t rnd_mode) int inexact = 0; /* If a is NaN, the result is NaN */ - if (MPFR_IS_NAN(a)) + if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(a) )) { - MPFR_SET_NAN(r); - MPFR_RET_NAN; - } - - MPFR_CLEAR_NAN(r); - - /* check for infinity before zero */ - if (MPFR_IS_INF(a)) - { - if (MPFR_SIGN(a) < 0) /* log10(-Inf) = NaN */ - { - MPFR_SET_NAN(r); - MPFR_RET_NAN; - } - else /* log10(+Inf) = +Inf */ - { - MPFR_SET_INF(r); - MPFR_SET_POS(r); - MPFR_RET(0); /* exact */ - } - } - - /* Now we can clear the flags without damage even if r == a */ - MPFR_CLEAR_INF(r); - - if (MPFR_IS_ZERO(a)) - { - MPFR_SET_INF(r); - MPFR_SET_NEG(r); - MPFR_RET(0); /* log10(0) is an exact -infinity */ + if (MPFR_IS_NAN(a)) + { + MPFR_SET_NAN(r); + MPFR_RET_NAN; + } + MPFR_CLEAR_NAN(r); + /* check for infinity before zero */ + if (MPFR_IS_INF(a)) + { + if (MPFR_IS_NEG(a)) + /* log10(-Inf) = NaN */ + { + MPFR_SET_NAN(r); + MPFR_RET_NAN; + } + else /* log10(+Inf) = +Inf */ + { + MPFR_SET_INF(r); + MPFR_SET_POS(r); + MPFR_RET(0); /* exact */ + } + } + /* Now we can clear the flags without damage even if r == a */ + MPFR_CLEAR_INF(r); + if (MPFR_IS_ZERO(a)) + { + MPFR_SET_INF(r); + MPFR_SET_NEG(r); + MPFR_RET(0); /* log10(0) is an exact -infinity */ + } } /* If a is negative, the result is NaN */ - if (MPFR_SIGN(a) < 0) + if (MPFR_UNLIKELY( MPFR_IS_NEG(a) )) { MPFR_SET_NAN(r); MPFR_RET_NAN; |