Discussion Javascript

bignumber.js

bignumber.js is a Javascript library which handles mathematical operations between big numbers (numbers which exceeds the range of current primitive number data types)
In Javascript float operation is not absolutely accurate. For example, the result of 0.2 * 0.3 is 0.0599999999…, instead of 0.6.
This is acceptable for normal mathematical operations but in crypto space, it’s not allowed as coin units are divided into very small fractional numbers like 10^(-18)
We can avoid such issues using bignumber.js when we calculate crypto amounts.

https://www.npmjs.com/package/big-number

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *