Fix handling of numeric values that can't be perfectly represented as floats#6
Open
ViaCelestia wants to merge 2 commits intodryruby:developfrom
Open
Fix handling of numeric values that can't be perfectly represented as floats#6ViaCelestia wants to merge 2 commits intodryruby:developfrom
ViaCelestia wants to merge 2 commits intodryruby:developfrom
Conversation
File.exists? went away in ruby 3.2
This covers all of the test cases that were originally marked as "Outside Ruby Range" and includes some additional tests from the RFC8785 spec
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.
Some values (like 66.6) can't be perfectly represented in floating-point, similar to how in decimal, 2/3 is represented as 0.333333333 ad infinitum. For these values, formatting them with
%.15Ecan instead show how the value gets rounded by the floating-point representation, like"%.15E" % 66.6yielding6.659999999999999E+01rather than the expected6.66E+01. Without a forced precision, Ruby can recognize that it should just produce"66.6"so this version just uses#to_sand then does the rest of the calculations necessary to be able to mirror ECMA-262 that the RFC cites