feat: ##Inf/##-Inf/##NaN literals, infinite?/NaN?, fix intval? for infinity
The reader now reads the symbolic float values ##Inf, ##-Inf and ##NaN. Added infinite? and NaN? predicates. Fixed intval? to exclude infinity (floor(inf)=inf but inf isn't integer-valued), so float?/double? are true for ##Inf and int?/pos-int?/nat-int?/neg-int? are false for it. This unblocked many number-test files whose forms previously failed to READ (##Inf/##NaN literals), so clojure-test-suite jumped from 2241 to 2539 assertions and pass 1719 -> 1955. Baseline raised to 1900. NaN_qmark now runs. float?/double? on integer-valued doubles (1.0) remain false: Janet represents an integer and an integer-valued double identically, so they're inherently indistinguishable — documented in the README Numbers section. spec: numbers/floats-&-symbolic-values (15 cases). jpm test green. Closes jolt-fy8 (fixable parts; int-vs-float ambiguity is a documented divergence).
This commit is contained in:
parent
09532dac05
commit
03652dce5d
6 changed files with 41 additions and 5 deletions
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
# Baseline: assertions Jolt currently passes across the suite. Raise as Jolt
|
||||
# improves so a regression (previously-passing assertion breaking) is caught.
|
||||
(def baseline-pass 1650)
|
||||
(def baseline-pass 1900)
|
||||
# A file is "clean" when it ran with zero failures AND zero errors.
|
||||
(def baseline-clean-files 22)
|
||||
# Per-file wall-clock budget (seconds). Normal files finish in well under 1s;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,27 @@
|
|||
["nat-int? neg" "false" "(nat-int? -1)"]
|
||||
["ratio? false" "false" "(ratio? 5)"])
|
||||
|
||||
# Symbolic float values and float/double predicates. NOTE: Janet represents
|
||||
# integers and integer-valued doubles identically, so (float? 1.0) is false
|
||||
# (1.0 is indistinguishable from 1) — a documented divergence. Fractional and
|
||||
# non-finite values ARE recognized as floats.
|
||||
(defspec "numbers / floats & symbolic values"
|
||||
["read ##Inf" "true" "(= ##Inf (/ 1.0 0.0))"]
|
||||
["read ##-Inf" "true" "(< ##-Inf 0)"]
|
||||
["##NaN not= itself" "true" "(not (== ##NaN ##NaN))"]
|
||||
["float? fractional" "true" "(float? 1.5)"]
|
||||
["double? fractional" "true" "(double? 0.25)"]
|
||||
["float? integer" "false" "(float? 3)"]
|
||||
["float? ##Inf" "true" "(float? ##Inf)"]
|
||||
["double? ##NaN" "true" "(double? ##NaN)"]
|
||||
["infinite? ##Inf" "true" "(infinite? ##Inf)"]
|
||||
["infinite? ##-Inf" "true" "(infinite? ##-Inf)"]
|
||||
["infinite? finite" "false" "(infinite? 1.5)"]
|
||||
["NaN? ##NaN" "true" "(NaN? ##NaN)"]
|
||||
["NaN? number" "false" "(NaN? 1.0)"]
|
||||
["int? ##Inf false" "false" "(int? ##Inf)"]
|
||||
["pos-int? ##Inf" "false" "(pos-int? ##Inf)"])
|
||||
|
||||
(defspec "numbers / bit-ops & math"
|
||||
["bit-and" "4" "(bit-and 12 6)"]
|
||||
["bit-or" "14" "(bit-or 12 6)"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue