Sums don't add up correctly

Hi all,

I’m having a very small calculation problem and I’m just trying to work out what is going on.

When I total my values in a spreadsheet I get the correct answer, but PP is out by one cent.

I’ve messed around with the figures to try to create a minimal use case, and here it is (note the values do not make sense, I am just trying to come up with figures that reproduce the problem).

Here you can see that all figures in the “amount” column are even, yet the “Realized Capital Gains” figure has an odd number of cents (.35) - it is not possible to add even numbers together to get an odd number. The value should be .34 not .35.

Somewhere it is gaining one cent and although it’s only a tiny amount, it makes me wonder if there are other larger calculation errors as well.

If I delete one of the transactions, then the value comes out correct again. Could it be a rounding error somewhere?

I have attached the XML file used for the above screenshot if it is useful.

test.xml (144.9 KB)

Does anyone know what is happening here, and whether it can be fixed so my figures balance?

This is for sure a rounding topic.

You export what you see, so you should change your formatting to 4 or 5 digits for calculated quotes, when the last Penny should count.

Wouldn’t use the word error when rounding is in the game. Given the high number of users, it is very unlikely that you will find an error in an elementary calculation. Not saying PP is error free, but for this particular calculation you are 100% save I’d say.

IIRC PP is calculating with 8 decimal places internally.

2 Likes

If you hover over the number you see the detail of the calculation.

147714.38 * 18.574/20.547 - 995.04 = 132341.14562..
147714.38 * 1/20.547 - 1000 = 6189.097919..
147714.38 * 1/20.547 - 1000 = 6189.097919..

2 Likes