Bug 245214

Summary: A price precision of 9 and a fraction of 1000000 overflow the amount variable
Product: [Applications] kmymoney Reporter: Alvaro Soliverez <asoliverez>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal CC: nicolas.degand, onet.cristian
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Alvaro Soliverez 2010-07-20 11:55:34 UTC
Version:           unspecified (using KDE 4.4.4) 
OS:                Linux

1- Create a new kmymoney file without any account.
2- Change the precision settings to 9 digits.
3- Create a new current account with 20,000.00 of opening balance.
3- Create a new investment account without an associated brokerage account.
4- Create a new investment (mutual fund), with fraction = 1000000 and Price entry = "price per share". (do not use Finance quote)
5- Manually update the price for the newly created investment using the following values:
date: 2010-07-08
price: 3,948476925

5- In the ledger view, buy shares for the new investment selecting the only existent account, and with the following values:
date: 2010-07-08
Shares: 5065.244239
Price/share: 3.948476925

The total should be 20,000.00 (5065.244239 x 3.948476925 = 19,999.9999972), but instead it shows: 1,553.255923 (1,553.26).

Anyway, finish the insertion of the transaction, and check the home view.
The investment has a balance of 1,553.26.

However, if you go to the reports view, and open the "Investment holding by account" report, the total amount is correct (20,000.00).

6- Now edit the transaction in the ledger view, and change the ammount of shares to 506,244239.
The total value is now correctly calculated (1,998.893696).

7- Reducing the fraction also results in the value being calculated correctly.


Reproducible: Always




OS: Linux (x86_64) release 2.6.34-ARCH
Compiler: gcc
Comment 1 Cristian OneČ› 2010-07-20 11:59:19 UTC
*** Bug 243194 has been marked as a duplicate of this bug. ***
Comment 2 Thomas Baumgart 2010-07-21 08:46:41 UTC
This should be fixed once we use the Alkimia implementation of the value object which is based on libgmp. Won't happen before the next stable release though.
Comment 3 Thomas Baumgart 2011-03-06 19:52:18 UTC
Fixed with the integration of libalkimia.
Comment 4 Cristian OneČ› 2011-05-05 23:03:15 UTC
*** Bug 261825 has been marked as a duplicate of this bug. ***