spliit icon indicating copy to clipboard operation
spliit copied to clipboard

Unclear why sum of amounts fails when converting currencies

Open Petersmit27 opened this issue 4 months ago • 1 comments

Problem

This occurs when splitting an expense that is not in the group's main currency, and using the uneven - by amount split option.

If you enter the original currency (as I expect most users would), it often leads to some rounding and a few missing cents in the total.

Paid amount

Image

Split amounts

Image

Solution

To the user, it's probably unclear that the error occurs because the converted total is not correct. It would be good to let the user know that (if they are converting the amounts) the converted total should be correct and what the remaining amount is.

This could also become even more useful if there's a button/link that automatically divides the remainder among everyone. This button would only show up if the amount is small enough, less than 25 of the currency's minor units for example.

Implementation

There is already a const detail in the code which is currently unused. This could be adapted (using the translation feature) to guide the user in fixing the error.

Petersmit27 avatar Sep 13 '25 17:09 Petersmit27

Hi @Petersmit27,

My hypothesis is that this is a rounding issue caused by converting and rounding each individual “By amount” entry before checking the sum. To minimize this, I’d suggest:

  • Convert and round the total once to the group currency.
  • Distribute that converted total using the “Uneven – By shares” method, treating the original per-person amounts as weights.
  • Allocate any remaining cent(s) deterministically so the shares sum exactly to the converted total.

One challenge is that we don’t yet have a single, reusable function that does this distribution consistently. I addressed that in PR #462 for a similar rounding problem by introducing centralized calculation and remainder allocation. If you have time to review #462, we could likely land a clean, elegant solution that we can reuse here as well. I’m happy to adjust the PR or help wire it into the “Uneven – By amount” flow.

Uli-Z avatar Nov 18 '25 19:11 Uli-Z