-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ecmascript): Fix the ranges for
SmallInteger
Since `SmallInteger` represents numbers in two's complement, the minimum value for that type is -2^55, rather than -2^55 + 1, even though its maximum value is 2^55 - 1. This is because there are as many negative numbers representable in the type as non-negative numbers, but the non-negative numbers include zero. This patch updates `SmallInteger::MIN_BIGINT` to reflect this. This patch also updates `SmallInteger::{MIN,MAX}_NUMBER` to remove the division by 2, to make them truly reflect Javascript's `Number.{MIN,MAX}_SAFE_INTEGER`. It also changes the ranges in `SmallInteger::from_i64_unchecked` and in the `TryFrom<i64>` impl to use `{MIN,MAX}_BIGINT`, rather than `{MIN,MAX}_NUMBER`.
- Loading branch information
1 parent
4eeb0f1
commit 6c55f51
Showing
1 changed file
with
24 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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