Fix bitwise-and on negative numbers.

Found using random testing.
This commit is contained in:
Vincent St-Amour 2015-11-03 16:02:05 -06:00
parent 58e97f83ea
commit 89a06cfae6
2 changed files with 7 additions and 6 deletions

View File

@ -1377,16 +1377,16 @@
(-Int -Int . -> . -Int))]
[bitwise-and
(let ([mix-with-int
(let ([mix-with-nat
(lambda (t)
(list (->* (list t) t t) ; closed
(->* (list -Int t) t t) ; brings result down
(->* (list t -Int) t t)))])
(->* (list -Nat t) t t) ; brings result down
(->* (list t -Nat) t t)))])
(from-cases (-> -NegFixnum) ; no args -> -1
(map mix-with-int (list -Zero -Byte -Index -NonNegFixnum))
(map mix-with-nat (list -Zero -Byte -Index -NonNegFixnum))
;; closed on negatives, but not closed if we mix with positives
(map varop-1+ (list -NegFixnum -NonPosFixnum))
(map mix-with-int (list -Fixnum -Nat))
(map varop-1+ (list -NegFixnum -NonPosFixnum -Fixnum))
(map mix-with-nat (list -Nat))
(map varop-1+ (list -NegInt -NonPosInt))
(null -Int . ->* . -Int)))]
[bitwise-ior

View File

@ -454,6 +454,7 @@
(tc-e (expt (make-rectangular 3 -1.7976931348623157e+308) (flacos (real->double-flonum 59.316513f0))) (t:Un -Flonum -FloatComplex))
(tc-e (exact->inexact (ann 3 Number)) (t:Un -InexactReal -InexactComplex))
(tc-e (/ (round (exact-round -2.7393196f0)) (real->double-flonum (inexact->exact (real->single-flonum -0.0)))) -Real)
(tc-e (bitwise-and (exact-round 1.7976931348623157e+308) (exact-round -29)) -Int)
(tc-e (exact->inexact 3) -PosFlonum)
(tc-e (exact->inexact -3) -NegFlonum)
(tc-e (real->double-flonum 0.0) -FlonumPosZero)