4 ms·
In my world, we keep a running total of the rounded prorated amounts, and then the last item (n) becomes (total - total up to n-1) to make sure amounts match. I
by ianmcgowan 6y ago
In my world, we keep a running total of the rounded prorated amounts, and then the last item (n) becomes (total - total up to n-1) to make sure amounts match. It can still be a problem if the last value is very small however.
- breischl 6y agoYeah, that's another way to do it. Another way to look at that is you're doing the proration on the final amount, and then distributing the rounding difference across the line items. Which is nice because you get the right total, though it can look weird when line items for the exact same thing are off by a penny from each other.