Fix GetString precision loss for large int64 values#150
Merged
pimbrouwers merged 1 commit intofalcoframework:masterfrom Feb 6, 2026
Merged
Conversation
Prevent integers with more than 15 significant digits from being parsed as floats, which would lose precision. Such values now remain as strings, preserving the original value while still allowing GetInt64 to parse them correctly. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Member
|
Really nice to meet you Michael. Thank you very much for this excellent contribution. I really appreciate it. I am very happy to merge this and will definitely do so to mark the contribution. It also points to something broader. Reviewing my work here with fresh eyes and more experience. I'm not pleased with the test coverage, I don't even need to run code coverage to know it's subpar. For example, the string utilities should be directly tested despite being part of the non-public API. I am going to change this in short order and I mention it partly because in the next little while, the surface of your contribution may change. But the essence will be there, and I didn't want there to be any animus. Does that make sense? |
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.
Summary
GetStringnow correctly returns the original string value for large integers instead of converting to scientific notationProblem
GetStringwas converting large integer route values (likeInt64.MaxValue) to scientific notation, causing precision loss:Root Cause
The
IsFloatpattern was parsing all numeric-looking strings as float64 values. For integers with more than ~15 significant digits, this caused precision loss since float64 only has 15-16 digits of precision.Solution
Modified the
IsFloatpattern to not match integer strings with more than 15 significant digits. Such values now remain asRString, preserving the original value exactly.This doesn't break
GetInt64because it already handlesRStringvalues by parsing them directly viaStringParser.parseInt64.Test plan
Int64.MaxValue🤖 Generated with Claude Code.
I (the human, Michael) couldn't find any place in the contribution docs that was against this, I hope it's ok. (also: want to be transparent about our slow demise as working software devs)