Rounding error after stock split

Thomas Baumgart thb at net-bembel.de
Fri Dec 8 12:12:48 GMT 2023


Janis,

On Dienstag, 5. Dezember 2023 18:05:50 CET Janis via KMyMoney wrote:

> Hi all,
> 
> I have an issue with an 1/2 stock split where the resulting balance/quantity 
> seems to be rounded to two digits rather then the precision defined for the 
> security. Searching a bit I found https://bugs.kde.org/show_bug.cgi?id=445472 
> with looked related in first place but might as well not be.

Thanks for reporting. In fact, it seems related but it is not since the code
base between those two versions (5.1.2 and the one you use) has been completely
rewritten.

> I took the demo file from said bug to reproduce the issue with the AppImage 
> build from 72421dc1f9065fa31636f71b2ec86e0ae6552d3f (please find it attached). 
> In the MethProfits ledger you can see a 1/2 split of 15.12340 shares (configured 
> with fractions 1/100000) resulting in 30.2500 shares.
> 
> Might as well be that I'm missing something obvious as I never did that before 
> - would be very happy to learn about that as well. :)

No, you don't miss anything. You just get bitten by a bug and I stepped on it :)
In the end, the fix was easy:

  https://invent.kde.org/office/kmymoney/-/commit/0ff957d658ae7ee81223c36d3850cbbae60394ca

-- 

Regards

Thomas Baumgart

-------------------------------------------------------------
Knowledge is of two kinds. We know a subject ourselves, or we know where
we can find information upon it. — Samuel Johnson (Boswell's Life of Johnson)
-------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 868 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney/attachments/20231208/9e5fff03/attachment.sig>


More information about the KMyMoney mailing list