Make zero? sound with regards to NaN.

This commit is contained in:
Eric Dobson 2015-03-28 14:05:44 -07:00
parent 8c329d4ddf
commit e5ea1f4bb6
2 changed files with 7 additions and 2 deletions

View File

@ -889,12 +889,14 @@
;; numeric predicates
;; There are 25 values that answer true to zero?. They are either reals, or inexact complexes.
;; Note -RealZero contains NaN and zero? returns #f on it
[zero?
(cl->*
(-> -ExactNumber B : (-FS (-filter (-val 0) 0) (-not-filter (-val 0) 0)))
(-> -Real B : (-FS (-filter -RealZero 0) (-not-filter -RealZero 0)))
(-> -Real B : (-FS (-filter -RealZero 0)
(-not-filter (Un -Zero -InexactRealPosZero -InexactRealNegZero) 0)))
(-> N B : (-FS (-filter (Un -RealZero -InexactComplex -InexactImaginary) 0)
(-not-filter -RealZero 0))))]
(-not-filter (Un -Zero -InexactRealPosZero -InexactRealNegZero) 0))))]
[number? (make-pred-ty N)]
[integer? (asym-pred Univ B (-FS (-filter (Un -Int -Flonum -SingleFlonum) 0) ; inexact-integers exist...

View File

@ -3562,6 +3562,9 @@
(error "foo"))
#:extend-env ([foo-x (t:-> (-prefab 'foo -String) -String)])
#:msg #rx"expected: \\(Prefab foo.*given: \\(Prefab bar"]
[tc-e/t
(lambda: ([x : Real-Zero]) (or (zero? x) x))
(t:-> -RealZero (t:Un (-val #t) -InexactRealNan) : -true-filter)]
)
(test-suite