Reduce safe integer range to exclude +/- 2^53 and match JavaScript safe-integer bounds #1240
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.
As noted in #1217 (comment) and discussed in #1238.
Although 2^53 is representable (there is a bit-pattern for a IEEE-754 double precision float which represents this value), it is not safe because as @CertainLach pointed out, it is ambiguous/not distinguishable from 2^53+1 which is not representable and would be rounded down.
This also switches from a StaticError to a RuntimeError when encounting a non-integer-safe value since these values are runtime constructs not parse time (static).
@CertainLach if you have time to review, I'd appreciate it.
Fixes #1238.