summaryrefslogtreecommitdiff
path: root/mul.c
diff options
context:
space:
mode:
Diffstat (limited to 'mul.c')
-rw-r--r--mul.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/mul.c b/mul.c
index bf89576c5..4de579cae 100644
--- a/mul.c
+++ b/mul.c
@@ -46,26 +46,30 @@ mpfr_mul(a, b, c, rnd_mode)
TMP_DECL(marker);
/* deal with NaN and zero */
- if (MPFR_IS_NAN(b) || MPFR_IS_NAN(c)) { MPFR_SET_NAN(a); return; }
+ if (MPFR_IS_NAN(b) || MPFR_IS_NAN(c))
+ { MPFR_CLEAR_FLAGS(a); MPFR_SET_NAN(a); return; }
if (MPFR_IS_INF(b))
{
- if (!MPFR_NOTZERO(c)) { MPFR_SET_NAN(a); return; }
+ if (!MPFR_NOTZERO(c)) { MPFR_CLEAR_FLAGS(a); MPFR_SET_NAN(a); return; }
else
{
if (MPFR_SIGN(a) != MPFR_SIGN(b) * MPFR_SIGN(c)) MPFR_CHANGE_SIGN(a);
+ MPFR_CLEAR_FLAGS(a);
MPFR_SET_INF(a); return;
}
}
else if (MPFR_IS_INF(c))
{
- if (!MPFR_NOTZERO(b)) { MPFR_SET_NAN(a); return; }
+ if (!MPFR_NOTZERO(b)) { MPFR_CLEAR_FLAGS(a); MPFR_SET_NAN(a); return; }
else
{
if (MPFR_SIGN(a) != MPFR_SIGN(b) * MPFR_SIGN(c)) MPFR_CHANGE_SIGN(a);
- MPFR_SET_INF(a); return;
+ MPFR_CLEAR_FLAGS(a); MPFR_SET_INF(a); return;
}
}
- if (!MPFR_NOTZERO(b) || !MPFR_NOTZERO(c)) { MPFR_SET_ZERO(a); return; }
+
+ if (!MPFR_NOTZERO(b) || !MPFR_NOTZERO(c))
+ { MPFR_CLEAR_FLAGS(a); MPFR_SET_ZERO(a); return; }
sign_product = MPFR_SIGN(b) * MPFR_SIGN(c);