News for hackers. Stuff that matters.
Re:Money.js is a tiny (1kb) JavaScript currency conversion l... by RodgerTheGreat on Friday October 14, 2011 @10:48AM (#3111368)
If I had to do accurate calculations from scratch, I would probably used fixed-point or arbitrary-precision math, talk to an accountant about industry standards and carefully cover my edge-cases for rounding and the like. More practically I would try to use a well-established library. I can't recommend anything specifically.

It's not impossible to do accurate calculations in JS, but my main point is that since the only built-in way to do math is floating point it's a bit of a minefield to go with a naive solution.

Re:Money.js is a tiny (1kb) JavaScript currency conversion l... by josscrowcroft on Friday October 14, 2011 @10:57AM (#3111409)
Fair play. I definitely wouldn't feel good recommending money.js for any application where people live and die by the 8th point of precision on an exchange rate, if you know what I mean - but it's a solid solution for estimates, price conversions and most enterprise software - provided that appropriate disclaimers are given (i.e. "converted prices for informational purposes only") - everyone should cover their arses.

I agree with you though, that there will be the 1% of cases where something a lot more reliable is needed, but I imagine that's when you call in the CS heavyweights.