Rounding drops a cent when splitting evenly
When you split an amount that can’t be divided cleanly to two-decimal precision (e.g. $1 ÷ 3), each share is rounded down ($0.33), so the shares add up to less than the original amount ($0.99). That missing cent isn’t assigned to anyone, leaving the totals visibly off. While $0.01 won't ruin anyone, it still feels a bit weird. ;)
Proposal: Hand those leftover cents out deterministically but variably so one person isn’t always stuck: simplest rule → give the remainder to the payer of that specific expense.
Actually, the problem is even a bit bigger. I dug into it a little and noticed the following:
- The code for calculating shares is implemented in several different places — for example, in the expense form as well as in the CSV export. A unified implementation would be better.
- Depending on the number of group members, rounding errors become more severe and even absurd, as shown in the following example:
Situation: Group with 10 members, total expense of $30.05
In the expense form, the following is displayed. I would expect: 5 people charged $3.00 each, 5 people charged $3.01 each. Instead, everyone is charged $3.01:
Then I save the expense. When I check the balance view, it shows neither the (wrong) proposed solution nor the expected one, but the following:
The last person in the list is always automatically assigned the remaining difference — either charged or credited.
Intuitively, I would expect the approach used by Splitwise: the rounding error should be distributed evenly across the last few participants.