Fix issues handling high-precision numbers#3004
Merged
Conversation
Contributor
|
This pull request does not contain a staged changelog entry. To create one, use the Make sure that the description is appropriate for a changelog entry and that the proper feature type is used. See |
7e2ac5d to
842595d
Compare
sugmanue
approved these changes
Mar 18, 2026
Contributor
Author
|
Need to fix an issue where values over double max/under double min that aren't literal Infinities are translated to infinity when parsed to a Double, but would be valid BigDecimals. Edit: This is complete |
842595d to
cfc979a
Compare
JordonPhillips
requested changes
Mar 19, 2026
| if (doubleValue.isInfinite() || doubleValue.isNaN()) { | ||
| // Doubles parse values outside their range, but set their values | ||
| // to infinity. See if we got a real infinity or just a big value. | ||
| try { |
Contributor
There was a problem hiding this comment.
Why not check the string? Also, can this entire logic block be put into NumberUtils? Otherwise it's being repeated thrice.
cfc979a to
2cfc643
Compare
2cfc643 to
9bdcfc5
Compare
sugmanue
approved these changes
Mar 19, 2026
The Double.isFinite method was incorrectly used to detect if a value would fit in a double. The method handles this properly, but it's not actually what we want - we want to know if the value will be accurately represented by a double. To resolve this, a NumberUtils class is added with a method that validates precision compatibility. Tests are added for this and all call sites to ensure the behavior remains consistent.
9bdcfc5 to
6f80ddb
Compare
JordonPhillips
approved these changes
Mar 20, 2026
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.
The Double.isFinite method was incorrectly used to detect if a value would fit in a double. The method handles this properly, but it's not actually what we want - we want to know if the value will be accurately represented by a double.
To resolve this, a NumberUtils class is added with a method that validates precision compatibility. Tests are added for this and all call sites to ensure the behavior remains consistent.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.