wnumb
wnumb copied to clipboard
numbers with more then 16 digits cause some strange roundings
var moneyWithDecimalMarks = wNumb({ thousand: ''', });
1234567890123456: 1'234'567'890'123'456 12345678901234567: 12'345'678'901'234'568 123456789012345678: 123'456'789'012'345'680 1234567890123456789: 1'234'567'890'123'456'800
The first one is still correct but adding more numbers results in strange effects.
1234567890123456
is smaller than Number.MAX_SAFE_INTEGER
, the other examples are larger. There's not a lot that can be done about this, I'm afraid.
the limit is not documented afaict and the returned result is wrong. Instead of returning the wrong result shouldn't it return "false" just like when it cannot parse it?
That would probably be a good idea. The limit is a limitation of the language, not the library. I'll add it to the docs.