mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-20 22:29:16 +02:00
Fixing bug in subtraction of a ratio with a bignum numerator.
This commit is contained in:
parent
b8b821e75a
commit
297e8727cb
1 changed files with 2 additions and 0 deletions
2
bignum.c
2
bignum.c
|
@ -1212,6 +1212,8 @@ sexp sexp_sub (sexp ctx, sexp a, sexp b) {
|
||||||
/* ... FALLTHROUGH ... */
|
/* ... FALLTHROUGH ... */
|
||||||
case SEXP_NUM_RAT_RAT:
|
case SEXP_NUM_RAT_RAT:
|
||||||
tmp2 = sexp_make_ratio(ctx, sexp_ratio_numerator(b), sexp_ratio_denominator(b));
|
tmp2 = sexp_make_ratio(ctx, sexp_ratio_numerator(b), sexp_ratio_denominator(b));
|
||||||
|
if (sexp_bignump(sexp_ratio_numerator(tmp2)))
|
||||||
|
sexp_ratio_numerator(tmp2) = sexp_copy_bignum(ctx, NULL, sexp_ratio_numerator(tmp2), 0);
|
||||||
sexp_negate_exact(sexp_ratio_numerator(tmp2));
|
sexp_negate_exact(sexp_ratio_numerator(tmp2));
|
||||||
r = sexp_ratio_add(ctx, a, tmp2);
|
r = sexp_ratio_add(ctx, a, tmp2);
|
||||||
if (negatep) {
|
if (negatep) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue