Improve type of exact? and exact->inexact.
Adapted from a pull request by Eric Dobson. original commit: 0bc60a77c86499186fdf8087621191183104b10f
This commit is contained in:
parent
e68c287705
commit
02ad4095fa
|
@ -215,6 +215,7 @@
|
|||
(tc-e (min (ann 3 Fixnum) (ann 3 Fixnum)) -Fixnum)
|
||||
(tc-e (min (ann -2 Negative-Fixnum) (ann 3 Fixnum)) -NegFixnum)
|
||||
(tc-e (min (ann 3 Fixnum) (ann -2 Negative-Fixnum)) -NegFixnum)
|
||||
(tc-e (exact->inexact (ann 3 Number)) (t:Un -InexactReal -InexactComplex))
|
||||
|
||||
[tc-e/t (lambda: () 3) (t:-> -PosByte : -true-lfilter)]
|
||||
[tc-e/t (lambda: ([x : Number]) 3) (t:-> N -PosByte : -true-lfilter)]
|
||||
|
|
|
@ -697,8 +697,11 @@
|
|||
[complex? (make-pred-ty N)]
|
||||
;; `rational?' includes all Reals, except infinities and NaN.
|
||||
[rational? (asym-pred Univ B (-FS (-filter -Real 0) (-not-filter -Rat 0)))]
|
||||
[exact? (asym-pred N B (-FS -top (-not-filter -Rat 0)))]
|
||||
[inexact? (asym-pred N B (-FS -top (-not-filter (Un -InexactReal -FloatComplex) 0)))]
|
||||
[exact? (asym-pred N B (-FS -top (-not-filter -ExactNumber 0)))]
|
||||
;; `inexact?' can't be a predicate for `(Un -InexactReal -InexactComplex)' because it
|
||||
;; returns #t on things like 0+1.2i, which are not -InexactComplex (`real-part' of it
|
||||
;; is exact 0)
|
||||
[inexact? (asym-pred N B (-FS -top (-not-filter (Un -InexactReal -InexactComplex) 0)))]
|
||||
[fixnum? (make-pred-ty -Fixnum)]
|
||||
[index? (make-pred-ty -Index)]
|
||||
[positive? (cl->* (-> -Byte B : (-FS (-filter -PosByte 0) (-filter -Zero 0)))
|
||||
|
@ -1501,7 +1504,7 @@
|
|||
(-FloatComplex . -> . -FloatComplex)
|
||||
(-SingleFlonumComplex . -> . -SingleFlonumComplex)
|
||||
(-InexactComplex . -> . -InexactComplex)
|
||||
(N . -> . N))]
|
||||
(N . -> . (Un -InexactReal -InexactComplex)))]
|
||||
[inexact->exact
|
||||
(from-cases (map unop all-rat-types)
|
||||
(-RealZero . -> . -Zero)
|
||||
|
|
Loading…
Reference in New Issue
Block a user