JVM parity: unchecked-char -> char, pr of infinities -> ##Inf
Allowlist review found three addressable divergences: - unchecked-char returned a number; the JVM returns a char. - the readable printer (pr-str, coll elements, the -e/REPL printer) rendered infinities as Infinity/inf; Clojure's readable form is ##Inf/##-Inf/##NaN (str/print still gives Infinity). So (pr-str ##Inf) => ##Inf, (str [##Inf]) => [##Inf], (str ##Inf) => Infinity. Corpus 2695->2698; allowlist 43->40 (drop the 3 now-passing entries). Re-minted.
This commit is contained in:
parent
518683ccd6
commit
4d1ec44676
5 changed files with 19 additions and 20 deletions
|
|
@ -1072,12 +1072,11 @@
|
|||
(defn to-array-2d [coll] (to-array (map to-array coll)))
|
||||
|
||||
;; Masking integer coercions (not aliases): byte/short wrap to their width.
|
||||
;; unchecked-char keeps jolt's historical NUMBER result (Clojure returns a
|
||||
;; char) — the char wrapper is a different value type here. int handles chars,
|
||||
;; so (unchecked-byte \a) works as on the JVM.
|
||||
;; unchecked-byte/short truncate to a number; unchecked-char returns a char (as on
|
||||
;; the JVM). int handles chars, so (unchecked-byte \a) works.
|
||||
(defn unchecked-byte [x] (bit-and (int x) 0xff))
|
||||
(defn unchecked-short [x] (bit-and (int x) 0xffff))
|
||||
(defn unchecked-char [x] (bit-and (int x) 0xffff))
|
||||
(defn unchecked-char [x] (char (bit-and (int x) 0xffff)))
|
||||
(defn unchecked-float [x] (double x))
|
||||
(defn unchecked-double [x] (double x))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue