fixing bug in mixed fixnum/flonum subtraction

This commit is contained in:
Alex Shinn 2011-06-30 09:17:47 +09:00
parent 9c9271e625
commit 4c7ca3edb2
2 changed files with 3 additions and 1 deletions

View file

@ -554,7 +554,7 @@ sexp sexp_sub (sexp ctx, sexp a, sexp b) {
r = sexp_bignum_normalize(r); r = sexp_bignum_normalize(r);
break; break;
case SEXP_NUM_FLO_FIX: case SEXP_NUM_FLO_FIX:
r = sexp_make_flonum(ctx, sexp_fixnum_to_double(b)+sexp_flonum_value(a)); r = sexp_make_flonum(ctx, sexp_flonum_value(a) - sexp_fixnum_to_double(b));
break; break;
case SEXP_NUM_FLO_FLO: case SEXP_NUM_FLO_FLO:
r = sexp_fp_sub(ctx, a, b); r = sexp_fp_sub(ctx, a, b);

View file

@ -205,6 +205,8 @@
(test -3 (- 3)) (test -3 (- 3))
(test -1.0 (- 3.0 4))
(test 7 (abs -7)) (test 7 (abs -7))
(test 1 (modulo 13 4)) (test 1 (modulo 13 4))