Commit 88e19779 authored by Stefan Krah's avatar Stefan Krah

1) Replace long-winded abort() construct by assert().

2) Remove micro optimization (inline checking for NaN before calling
   mpd_qcheck_nans()) that probably has no benefit in this case.
parent a26ad5a0
......@@ -5713,14 +5713,15 @@ void
mpd_qnext_minus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx,
uint32_t *status)
{
mpd_context_t workctx; /* function context */
mpd_context_t workctx;
MPD_NEW_CONST(tiny,MPD_POS,mpd_etiny(ctx)-1,1,1,1,1);
if (mpd_isspecial(a)) {
if (mpd_qcheck_nan(result, a, ctx, status)) {
return;
}
if (mpd_isinfinite(a)) {
assert(mpd_isinfinite(a));
if (mpd_isnegative(a)) {
mpd_qcopy(result, a, status);
return;
......@@ -5731,13 +5732,10 @@ mpd_qnext_minus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx,
if (mpd_isnan(result)) {
return;
}
result->exp = ctx->emax - ctx->prec + 1;
result->exp = mpd_etop(ctx);
return;
}
}
/* debug */
abort(); /* GCOV_NOT_REACHED */
}
mpd_workcontext(&workctx, ctx);
workctx.round = MPD_ROUND_FLOOR;
......@@ -5769,7 +5767,8 @@ mpd_qnext_plus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx,
if (mpd_qcheck_nan(result, a, ctx, status)) {
return;
}
if (mpd_isinfinite(a)) {
assert(mpd_isinfinite(a));
if (mpd_ispositive(a)) {
mpd_qcopy(result, a, status);
}
......@@ -5784,7 +5783,6 @@ mpd_qnext_plus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx,
}
return;
}
}
mpd_workcontext(&workctx, ctx);
workctx.round = MPD_ROUND_CEILING;
......@@ -5814,8 +5812,7 @@ mpd_qnext_toward(mpd_t *result, const mpd_t *a, const mpd_t *b,
{
int c;
if (mpd_isnan(a) || mpd_isnan(b)) {
if (mpd_qcheck_nans(result, a, b, ctx, status))
if (mpd_qcheck_nans(result, a, b, ctx, status)) {
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment