split-pro icon indicating copy to clipboard operation
split-pro copied to clipboard

Exact split incorrect calculation

Open ammaraffan opened this issue 1 year ago • 2 comments

Total bill 78.30.

Tried to split it 48.70 + 29.60, but the moment I wrote 48.70, it said the balance was 29.5999999994.

When I typed that the second person is 29.60, it said the remaining is -1.4210xxxx

image

image

image

ammaraffan avatar Sep 29 '24 06:09 ammaraffan

ah that's bad, will work on it

KMKoushik avatar Sep 29 '24 06:09 KMKoushik

I don't know if Javascript allows that, but I'd just use fixed-point numbers with 3 decimal digits...

livingsilver94 avatar Sep 30 '24 10:09 livingsilver94

Just a +1 from my side, looking into migrating to Split Pro vom Splitwise and running into the same issue. Floats cannot represent the exact fractions needed for monetary values.

ict avatar Oct 12 '24 10:10 ict

My issue is similar but just about not the same, when adding a , to the amount it no longer counts towards the total balance This is on a selfhosted docker instance installed two days ago. image

chiel1112 avatar Oct 22 '24 04:10 chiel1112

There is a PR open for this issue: https://github.com/oss-apps/split-pro/pull/135

alexanderwassbjer avatar Oct 27 '24 11:10 alexanderwassbjer