Fix in sexp_bignum_quot_rem when the numerator and divisor are equal.

Fixes issue #269.
This commit is contained in:
Alex Shinn 2015-06-15 23:31:46 +09:00
parent dfc5ca6913
commit 4fc7181c2c

View file

@ -512,7 +512,7 @@ sexp sexp_bignum_quot_rem (sexp ctx, sexp *rem, sexp a, sexp b) {
sexp_bignum_sign(b1) = 1; sexp_bignum_sign(b1) = 1;
q = SEXP_ZERO; q = SEXP_ZERO;
x = sexp_make_bignum(ctx, sexp_bignum_length(a)); x = sexp_make_bignum(ctx, sexp_bignum_length(a));
while (sexp_bignum_compare_abs(a1, b1) > 0) { /* a1, b1 at least 2 bigits */ while (sexp_bignum_compare_abs(a1, b1) >= 0) { /* a1, b1 at least 2 bigits */
/* guess divisor x */ /* guess divisor x */
alen = sexp_bignum_hi(a1); alen = sexp_bignum_hi(a1);
sexp_bignum_data(x)[off] = 0; sexp_bignum_data(x)[off] = 0;