Closed Sotatek-ThangNguyen2 closed 1 year ago
This is normal. Your number is way beyond Number.MAX_SAFE_INTEGER
.
Use toString
instead of toNumber
.
Incidentally, JavaScript numbers also exhibit binary floating-point rounding artefacts, which is why we need libraries like bignumber.js
in the first place.
@shuckster thanks
I have a issue with toNumber() function. I try with BigNumber version: "bignumber.js": "9.1.1",
https://codesandbox.io/s/bignumber-js-forked-sewfsh?file=/src/index.js:0-780
999999999999998400000000000000000000 - 30000000000000000000
Expect Result: 999999999999998370000000000000000000 With toNumber(), same it Rounding Up result: 9.999999999999984e+35 (from 37 -> 40)