currency.js icon indicating copy to clipboard operation
currency.js copied to clipboard

Handle max/min integer values

Open scurker opened this issue 10 years ago • 2 comments
trafficstars

Currently, currency.js does not handle integer values beyond the max/min possible int values. So for whatever reason if you're performing calculations in that range you could have some overflow errors.

The maximum possible value should be 253 - 1 or 9,007,199,254,740,991. There should probably be some tests around this, and the library could potentially throw an error if that number overflows. There's some additional functions available as part of the ES6 harmony draft that might be available to be used.

scurker avatar Dec 27 '14 05:12 scurker

I wouldn't worry about this one -- if people use numbers that big they are in for all kinds of problems -- this is not your problem -- not worth the effort or complexity -- just say that "behaviour is undefined" in these circumstances ;)

nickperkinslondon avatar Mar 28 '18 16:03 nickperkinslondon

Could use bigint internally to get around this problem.

gamedevsam avatar Feb 01 '21 04:02 gamedevsam