News for hackers. Stuff that matters.
Re:64-Bit Bank Balances ‘Ought to Be Enough for Anybody’? by rbatiati on Tuesday September 19, 2023 @09:32AM (#37569717)
Rounding monetary values is a complex, opinionated and business-defined operation. Sometimes it's even orthogonal to the datatype used.

Things get out of hand when you need to round multiple different things that have to sum up at the end.

For example:

- Items in an invoice are rounded and summed. (eg. $1.1234 * 5.678kg)

- Payments of an invoice can be paid in multiple installments, with interests that are also rounded (eg. 1.77% per month).

- The value paid of interest *per item* must match the total value paid of interest in all installments of all invoices in the same period.

There are no comments on this comment yet.