Hacker News new | ask | show | jobs
by endofreach 780 days ago
You should never use floats for dinero. And it has nothing to do with JS, though i find it funny that you mention JS.
1 comments

Don't use floats if you're trying to represent an exact value, i.e. someones bank account. But in financial modelling you're generally dealing in probabilistic "expected values", it's common and fine to use floats.

Having said that, half the world seems to run on Excel spreadsheets, which are full of money values, and Excel is basically all floats (with some funky precision logic to make it deterministic - would be curious to know more).

https://stackoverflow.com/questions/2815407/can-someone-conf...