NEW TICKET#40 · Payments
Split a payment so the cents add up
Lena Fischer · Finance & Ops
Opened today
“When a client pays part of an invoice, we split the payment across its lines in proportion to each line's total, so the accounts show what was paid for. The shares are in whole cents and must add up to exactly the payment. Right now each share is rounded on its own: $1.00 over three equal lines records 99 cents. Fix it this way: round every share down, then give the cents left over, one each, to the lines with the biggest fraction left over; on a tie, the earlier line first.”
YOUR PLAN
- 1Watch an example2 min
- 2Warm-up 11 min
- 3Warm-up 21 min
- 4Fix the ticket26 min
BY THE END YOU CAN
- See how rounding each part loses or invents cents
- Round down, then hand out what's left
- Sort indexes by a computed value