-
I feel that condition should use a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is intentional to better detect errors near the boundary. I have seen a lot of instances where people use numbers inappropriately, so I error on the side of caution. This obviously cannot help in all cases (since IEEE 754 could have corrupted the value anywhere along the way), but consider: > Number.MAX_SAFE_INTEGER + 2 - 1 === Number.MAX_SAFE_INTEGER
true
// This would mean with the above change this would succeed, when I want it to fail:
// BigNumber.from(Number.MAX_SAFE_INTEGER + 2 - 1) I would ideally lower the threshold a lot further, but there is always going to be cases of undetectable corruption, so this seemed like a fair compromise... Does that make sense? |
Beta Was this translation helpful? Give feedback.
This is intentional to better detect errors near the boundary. I have seen a lot of instances where people use numbers inappropriately, so I error on the side of caution.
This obviously cannot help in all cases (since IEEE 754 could have corrupted the value anywhere along the way), but consider:
I would ideally lower the threshold a lot further, but there is always going to be cases of undetectable corruption, so this seemed like a fair compromise...
Does that make sense?