You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here, s is potentially an unsafe integer when square rooting numbers larger than Number.MAX_SAFE_INTEGER^2
A safer op might be:
r = new Big(s + '');
Please close if no fix is needed, but I wanted to point this out. I am throwing if the Big.js constructor is passed an unsafe integer.
Would be great if big.js had a toggle option to throw in this scenario. As it currently stands, precision can be accidentally lost when doing Big(Number.MAX_SAFE_INTEGER + 1) - I appreciate a string can be passed in this occasion but as a developer, it is easy to accidentally pass an unsafe int and miss it.
The text was updated successfully, but these errors were encountered:
It doesn't matter if s is an unsafe integer, and turning it into a string is not necessary - that happens anyway in the Big constructor.
Regarding whether to have an option to throw on unsafe integers generally, that is not something I want to add to this library. It is available in bignumber.js I think.
big.js line 780:
Here, s is potentially an unsafe integer when square rooting numbers larger than Number.MAX_SAFE_INTEGER^2
A safer op might be:
Please close if no fix is needed, but I wanted to point this out. I am throwing if the Big.js constructor is passed an unsafe integer.
Would be great if big.js had a toggle option to throw in this scenario. As it currently stands, precision can be accidentally lost when doing Big(Number.MAX_SAFE_INTEGER + 1) - I appreciate a string can be passed in this occasion but as a developer, it is easy to accidentally pass an unsafe int and miss it.
The text was updated successfully, but these errors were encountered: