A few float-related forms (namely, Double/POSITIVE_INFINITY, Double/NEGATIVE_INFINITY, Double/NaN) are not eval-able after a round-trip via
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
New patch fixes printing for ##NaN, modifies the exception handling in the readers slightly, and adds some more printing tests.
Did a perf check on number printing with this:
Results:
Dropping a new patch that doesn't put a conditional in the Number case and instead adds a print-method for Double. Updated #s:
That seems tolerable.
-7 patch adds print support and tests for float infinity and nan.
-8 patch makes the double symbol reader tests more precise by checking value, not just type