Well there is a bit limit to what numbers Javascript can handle (until we get BigInt64
or if you use a library like decimal.js
). So since it cannot handle more decimals it just truncates at a point. If you would make a bigger number you would see less decimals. If this then leads to the number being "exacly" 9999999999999.99 in your case javascript will correctly show it as 9999999999999.99 and not 9999999999999.99999 since we only have Number and not float, decimal, int, etc.
parseFloat(9999999999999.99999);
// 9999999999999.99
parseFloat(9999999999999.9999);
// 9999999999999.99
parseFloat(9999999999999.999);
// 9999999999999.998
parseFloat(9999999999999.99);
// 9999999999999.99
Edit: actually it seem to round and not drop.
I hope that explains things.