Bug 445472

Summary: Stock split transactions can cause rounding problems
Product: [Applications] kmymoney Reporter: Thomas Baumgart <tbaumgart>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 5.1.2   
Target Milestone: ---   
Platform: unspecified   
OS: All   
Latest Commit: Version Fixed In: 5.1.3
Sentry Crash Report:

Description Thomas Baumgart 2021-11-14 12:08:52 UTC
SUMMARY
The balance after a stock split transaction was not rounded accurately to the precision defined for the security causing the balance to deviate.

STEPS TO REPRODUCE
1. Open the demo file attached to bug 445458
2. Open the ledger for account named "Methprofits"

OBSERVED RESULT
Investment value displayed below the ledger shows -0.01$

EXPECTED RESULT
Investment value displayed below the ledger shows 0.00$ just like the balance column of the last transaction
Comment 1 Thomas Baumgart 2021-11-14 12:23:22 UTC
Git commit 20b07baa8a999ca606cbf86019f2aa2470da547d by Thomas Baumgart.
Committed on 14/11/2021 at 12:22.
Pushed by tbaumgart into branch '5.1'.

Prevent fractions during stock split operations

Always round to the account fraction of the investment's security when
performing a stock split.
FIXED-IN: 5.1.3

M  +4    -0    kmymoney/mymoney/mymoneyenums.h
M  +6    -0    kmymoney/mymoney/mymoneyfile.cpp
M  +8    -0    kmymoney/mymoney/mymoneyfile.h
M  +11   -1    kmymoney/mymoney/storage/mymoneystoragemgr.cpp
M  +3    -0    kmymoney/mymoney/storage/mymoneystoragemgr.h
M  +52   -17   kmymoney/mymoney/storage/mymoneystoragemgr_p.h
M  +6    -2    kmymoney/views/kgloballedgerview_p.h

https://invent.kde.org/office/kmymoney/commit/20b07baa8a999ca606cbf86019f2aa2470da547d