Funny how the Javascript (not Meteor) issue with decimals comes up again… The simple solution is not to use decimals/floats for monetary calculations, like discussed before on this forum:
So one thing we can conclude: Do not use floats for money in any programming language. The calculations are incorrect and if you have a currency with more then 2 decimals you have a problem. A friend of mine worked at a bank startup and he confirmed that floats are never used there to represent money.
@tab00 has a point that JavaScript doesn’t solve this issue in the language itself, like Java and .NET do, with BigInt or similar. So it would be great to see this some day.
In the mean time I do…
And of course what @pandawhisperer sad:
pandawhisperer:
That’s a JavaScript issue. Not something that Meteor can or should fix. It’s an old and well-documented issue, and there are solutions available. In Meteor specifically, you can use the 3stack:bignumber package.
1 Like