News for hackers. Stuff that matters.
Re:Ask HN: How to handle financial calculations precisely? by boredpudding on Wednesday January 25, 2023 @03:50PM (#34523987)
Might just be me, but I always use integers. In calculations with multiplication, I always round immediately to integers again.

I save financial data in cents (or whatever the lowest is), and only show it as a formatted number in templates. Stripe and other payment providers seem to do the same.

Re:Ask HN: How to handle financial calculations precisely? by fedeb95 on Wednesday January 25, 2023 @04:02PM (#34524140)
How do you handle divisions? Do you have any sources for what payment providers do? Genuinely interested.