News for hackers. Stuff that matters.
Re:No Abstractions: our API design principle by endofreach on Thursday April 25, 2024 @05:28PM (#40163262)
You should never use floats for dinero. And it has nothing to do with JS, though i find it funny that you mention JS.
Re:No Abstractions: our API design principle by xxgreg on Thursday April 25, 2024 @06:00PM (#40163602)
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...