We're updating the issue view to help you get more done. 

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

Description

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

1 (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 https://groups.google.com/d/topic/clojure-dev/LeJpOhHxESs/discussion and https://github.com/edn-format/edn/issues/2), 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 ##Inf, ##-Inf, ##+Inf, and ##NaN.

Patch: clj-1074-8.patch

Environment

None

Status

Assignee

Unassigned

Reporter

Colin Jones

Labels

Approval

Ok

Patch

Code and Test

Fix versions

Affects versions

Release 1.4

Priority

Major