Created attachment 107126 [details] Split editor showing offset of one cent Gee Backhaus reported: I am having to consider tax (VAT) for the first time in Kmymoney and have found a rounding error. I followed the excellent instructions in your pdf manual and they work like a dream until there's a number that it is unable to resolve. *Example*: I am entering the gross amount of 17.07 and the associated tax amount is 20%. On a calculator 17.07 gives 14.225 + 2.845 In Kmymoney 17.07 gives 14.22 + 2.84 (automatically as shown in the attached). So, Kmymoney appears to round each value down and leave me with a discrepancy - which I am also unable to override manually. This is on 4.7.2 but is also in current git master.
The problem stems from the internal calculation of the tax part. It is always calculated by subtracting the net value from the gross value. The problem is, that it does not adjust the net value to the rounded one before doing the subtraction. This in fact leaves the tax part as 2.855 in your example which is then rounded again. It should round 14.225 to 14.22 and then doing the subtraction to 17.07-14.22 which results in 2.85 and everyone is happy. Hey, you found a bug! And a rather old one: it lives there for more than 10 years now. Congrats.
Git commit eb7e02dd0fc840fa44d5ad1d514060d9637468f7 by Thomas Baumgart. Committed on 07/08/2017 at 18:15. Pushed by tbaumgart into branch 'master'. Fix VAT assignment rounding problems Rounding problems led to non-balanced transactions. This change avoids such a situation. FIXED-IN: 5.0 CCMAIL: geebackhouse@gmail.com M +3 -3 kmymoney/mymoney/mymoneyfile.cpp https://commits.kde.org/kmymoney/eb7e02dd0fc840fa44d5ad1d514060d9637468f7
Git commit 3bfcf56a8e2ba1fd5a8fba6b235d0ceb94ca3c8c by Ralf Habacker, on behalf of Thomas Baumgart. Committed on 08/08/2017 at 07:02. Pushed by habacker into branch '4.8'. Fix VAT assignment rounding problems Rounding problems led to non-balanced transactions. This change avoids such a situation. FIXED-IN: 5.0 CCMAIL: geebackhouse@gmail.com (cherry picked from commit eb7e02dd0fc840fa44d5ad1d514060d9637468f7) M +3 -3 kmymoney/mymoney/mymoneyfile.cpp https://commits.kde.org/kmymoney/3bfcf56a8e2ba1fd5a8fba6b235d0ceb94ca3c8c