News for hackers. Stuff that matters.
Re:Be careful with JS numbers by ars on Sunday January 13, 2013 @08:42PM (#5052848)
If you don't have decimal types, then use fixed point. Or in simpler terms store cents (as integers) not dollars (as floats).

Then add a decimal point when you display.

If you are dealing with stocks or interest I suggest storing tenths, or hundreds of a cent to avoid rounding errors.

Re:Be careful with JS numbers by brazzy on Monday January 14, 2013 @03:41AM (#5053838)
Shitty when your language doesn't have integers then, eh?
Re:Be careful with JS numbers by ars on Monday January 14, 2013 @04:19AM (#5053916)
Javascript floats (all 64 bit floats actually) can store exact integers to 53 bits.

Which is enough for even the united states national budget, let alone more prosaic uses.