Closed zhaiyb closed 4 years ago
There is no JavaScript number 420517031.05749343 in the same way as there is no JavaScript number 9.99999999999999999999999999999999.
Open a console in your browser and type in any number literal, and then press Enter to see the JavaScript number that results
>> 420517031.05749343
420517031.05749345
>> 9.99999999999999999999999999999999
10
Due to the limited precision of JavaScript numbers (64 bits), if you are passing a number literal with more than 15 significant digits to the BigNumber constructor, then you must pass it as a string to ensure it results in the expected value.
BigNumber("420517031.05749343").toString() === "420517031.05749343" // true
BigNumber(420517031.05749343).toString() === "420517031.05749345" 420517031.05749346 has the same problem