Fix type of - to not be wrong on negative fixnums

Rolling this forward because the math library is no longer dependent on
the broken behavior. Also nothing in the main repo seems to depend on
this.

original commit: 0a81627eca8233edca95368938c739a9d268407f
This commit is contained in:
Eric Dobson 2014-02-26 20:33:18 -08:00
parent a97fe80bbd
commit 7cd4da639f
2 changed files with 10 additions and 2 deletions

View File

@ -656,6 +656,13 @@
(-> -Zero neg pos)
(-> -Zero non-pos non-neg)))
;; Used because (- min-fixnum) > max-fixnum
(define (half-negation-pattern pos neg non-neg non-pos)
(list (-> pos neg)
(-> non-neg non-pos)
(-> -Zero pos neg)
(-> -Zero non-neg non-pos)))
(define abs-cases ; used both for abs and magnitude
(list
(map unop (list -Zero -One -PosByte -Byte -PosIndex -Index -PosFixnum -NonNegFixnum))
@ -1181,7 +1188,7 @@
[- (from-cases
(binop -Zero)
(negation-pattern -PosFixnum -NegFixnum -NonNegFixnum -NonPosFixnum)
(half-negation-pattern -PosFixnum -NegFixnum -NonNegFixnum -NonPosFixnum)
(negation-pattern -PosInt -NegInt -Nat -NonPosInt)
(negation-pattern -PosRat -NegRat -NonNegRat -NonPosRat)
(negation-pattern -PosFlonum -NegFlonum -NonNegFlonum -NonPosFlonum)

View File

@ -242,7 +242,8 @@
(tc-e (+ 3 4) -PosIndex)
(tc-e (- 1) -NegFixnum)
(tc-e (- 1073741823) -NegFixnum)
(tc-e (- -4) -PosFixnum)
(tc-e (- -4) -PosInt)
(tc-e (- (ann -5 Nonpositive-Fixnum)) -Nat)
(tc-e/t 1152921504606846975 -PosInt)
(tc-e/t -1152921504606846975 -NegInt)
(tc-e (- 3253463567262345623) -NegInt)