Skip to content

Commit

Permalink
fix bug in mul_1x1
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrik-johansson committed Apr 18, 2014
1 parent 0244fe0 commit 7c6b3fb
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions fmpr/mul_1x1.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ _fmpr_mul_1x1(fmpr_t z, mp_limb_t u, const fmpz_t xexp, mp_limb_t v,
the error bound must be multiplied by two */
ret -= (trail == prec);
}

if (!negative)
fmpz_set_ui(fmpr_manref(z), lo);
else
fmpz_neg_ui(fmpr_manref(z), lo);
}
else
{
Expand Down Expand Up @@ -94,6 +99,11 @@ _fmpr_mul_1x1(fmpr_t z, mp_limb_t u, const fmpz_t xexp, mp_limb_t v,
/* special case: if the mantissa overflowed to the next power of two,
the error bound must be multiplied by two */
ret -= (FLINT_BITS + trail == prec);

if (!negative)
fmpz_set_ui(fmpr_manref(z), hi);
else
fmpz_neg_ui(fmpr_manref(z), hi);
}
else
{
Expand All @@ -110,15 +120,22 @@ _fmpr_mul_1x1(fmpr_t z, mp_limb_t u, const fmpz_t xexp, mp_limb_t v,
/* special case: if the mantissa overflowed to the next power of two,
the error bound must be multiplied by two */
ret -= (trail == prec);

if (!negative)
fmpz_set_uiui(fmpr_manref(z), hi, lo);
else
fmpz_neg_uiui(fmpr_manref(z), hi, lo);
}
}
else
{
if (!negative)
fmpz_set_uiui(fmpr_manref(z), hi, lo);
else
fmpz_neg_uiui(fmpr_manref(z), hi, lo);
}
}

if (!negative)
fmpz_set_uiui(fmpr_manref(z), hi, lo);
else
fmpz_neg_uiui(fmpr_manref(z), hi, lo);

fmpz_add2_fmpz_si_inline(fmpr_expref(z), xexp, yexp, shift);
return ret;
}
Expand Down

0 comments on commit 7c6b3fb

Please sign in to comment.