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.
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.