papandreou / inter

A JavaScript locale library based on information extracted from the Unicode CLDR database
BSD 3-Clause "New" or "Revised" License
21 stars 5 forks source link

Math float issue arises when formatting certain numbers #10

Open ragulka opened 10 years ago

ragulka commented 10 years ago

Trying to format a number like 123456789201921 reveals the underlying issue with float-precision math that JS has. The result is something like 123,456,789,201,920.992 while it should be 123,456,789,201,921.

I stumbled upon this while working on my own fork of Numeral-JS. The issue can probably only be solved if using a specialized library like Big.js

Of course, this is probably an edge case, but perhaps it is something to be considered.

papandreou commented 8 years ago

Sorry for the radio silence on this one. If you're still interested in finding a solution, what would you propose? To add support for formatting Big.js instances -- or maybe even strings?