fix: out-of-range double literals read as infinity, printed doubles round-trip - #113
Merged
Conversation
…f failing (#111) Wrap the Double.Parse call in MatchNumber's float branch in a try/catch (OverflowException) returning Double.NegativeInfinity or Double.PositiveInfinity per the leading sign. Catching only that type keeps FormatException on a malformed literal; underflow already returns zero without throwing, so nothing but overflow reaches the fallback. Applied to all three copies of MatchNumber: LispReader, EdnReader and nostrand's ArgumentReader, each in place because upstream keeps these readers independent.
#112) Change fp-str's binding from (str x) to (.ToString x "R" CultureInfo/InvariantCulture). "R" emits as many digits as Double.Parse needs to return the identical value; the default emits 15 significant digits and loses precision. The explicit culture replaces the ambient one, which could emit a comma decimal separator. fp-str backs both the Double and Single print methods.
skydread1
force-pushed
the
fix/reader-double-out-of-range
branch
from
July 30, 2026 03:30
c274afa to
ef75236
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #111, Closes #112
MatchNumbercatchesOverflowExceptionand saturates to an infinity from the leading sign, rather than failing the read. Applied inLispReader,EdnReaderand nostrand'sArgumentReader, which hold identical copies.fp-strformats with the"R"round-trip specifier andInvariantCultureinstead of(str x), so a printed double reads back as the same value.Clojure.dllandclojure.core_print.clj.dllin the committed deploy dirs.read-printsmoke suite covering both fixes on the AOT path.