mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
fix comparison of negative bignums (issue #541)
This commit is contained in:
parent
104811942f
commit
bbcb571ba5
2 changed files with 7 additions and 1 deletions
3
bignum.c
3
bignum.c
|
@ -146,7 +146,8 @@ sexp_sint_t sexp_bignum_compare_abs (sexp a, sexp b) {
|
|||
sexp_sint_t sexp_bignum_compare (sexp a, sexp b) {
|
||||
if (sexp_bignum_sign(a) != sexp_bignum_sign(b))
|
||||
return sexp_bignum_sign(a);
|
||||
return sexp_bignum_compare_abs(a, b);
|
||||
sexp_sint_t cmp = sexp_bignum_compare_abs(a, b);
|
||||
return sexp_bignum_sign(a) < 0 ? -cmp : cmp;
|
||||
}
|
||||
|
||||
sexp sexp_bignum_normalize (sexp a) {
|
||||
|
|
|
@ -272,6 +272,11 @@
|
|||
(+ 115792089237316195423570985008687907853099843482180094807725896704197245534208
|
||||
115792089237316195423570985008687907853099843482180094807725896704197245534208))
|
||||
|
||||
(let ((smallest-s64 -9223372036854775808)
|
||||
(small-bignum -100000000000000000000000000))
|
||||
(test-assert (> smallest-s64 small-bignum))
|
||||
(test-assert (< small-bignum smallest-s64)))
|
||||
|
||||
(test #f (< +nan.0 +nan.0))
|
||||
(test #f (<= +nan.0 +nan.0))
|
||||
(test #f (= +nan.0 +nan.0))
|
||||
|
|
Loading…
Add table
Reference in a new issue