Read/print round-trip for +/-Infinity and NaN


  • Type: Defect Defect
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: Release 1.4
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test
  • Approval:


A few float-related forms (namely, Double/POSITIVE_INFINITY, Double/NEGATIVE_INFINITY, Double/NaN) are not eval-able after a round-trip via

(read-string (binding [*print-dup* true] (pr-str f))

The two options I see are to provide print-method implementations for these and their Float cousins, or to make Infinity, -Infinity, +Infinity, and NaN readable values. Since it sounds like edn may want to provide a spec for these values (see and, I think making these values directly readable as already printed is preferable. Something like Double/POSITIVE_INFINITY seems too low-level from edn's perspective, as it would refer to a Java class and constant.

I'm attaching a patch implementing reader support for Infinity, -Infinity, +Infinity, and NaN.


Andy Fingerhut made changes -
Field Original Value New Value
Attachment clj-1074-read-infinity-and-nan-patch-v2.txt [ 12006 ]
Nicola Mometto made changes -
Andy Fingerhut made changes -
Attachment clj-1074-read-infinity-and-nan-patch-v2.txt [ 12006 ]
Alex Miller made changes -
Labels patch print reader
Alex Miller made changes -
Approval Triaged [ 10120 ]
Stuart Halloway made changes -
Priority Minor [ 4 ] Major [ 3 ]
Alex Miller made changes -
Priority Major [ 3 ] Minor [ 4 ]


Vote (6)
Watch (5)


  • Created: