Registered Member
|
Hi,
I just found this thread, and the problem I am having is the wrong value for the investment. Can anyone try the steps below to see if it is really a bug? 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). Does it happen with anyone else? Many thanks, Carlos |
Registered Member
|
Have you increased the price precision in the settings to match that price? The default is only 4 decimals.
Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
|
Registered Member
|
Yes, this is the second step. (2- Change the precision settings to 9 digits). Sorry if I was not clear. |
Registered Member
|
Hi Hei Ku,
Did you get the same problem when executing these steps? |
Registered Member
|
Yes, I can confirm. It is an overflow of the value that contains the numbers. If you reduce the fraction of the accountm it calculates the numbers correctly.
I have filed a bug. https://bugs.kde.org/show_bug.cgi?id=245214
Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
|
Registered Member
|
Many thanks,
I think this bug: https://bugs.kde.org/show_bug.cgi?id=243194 refers to the same problem. |
Registered Member
|
The bug cannot be fixed on time for the release. It requires to change a component very deep inside the application, which cannot be done at this point.
Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
|
Registered Member
|
Can you tell me which component is this?
I can try to sort it out. I started looking on the code, but still did not find where to change. |
Registered Member
|
The component is MyMoneyMoney, the main class where amounts are stored. It has to be ported libMP, to cope with high precision situations.
Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
|
KDE Developer
|
More precisely it needs to be ported to AlkValue which is already based on libgmp. This is something I have on my todo list for post 4.5.
ipwizard, proud to be a member of the KMyMoney forum since its beginning.
openSuSE Leap 15.4 64bit, KF5 |
Registered Member
|
I have given a quick look in this class, and started replacing the m_num and m_denom (signed64) fields with a m_val field (AlkValue), but had problems with the toDouble method, which is used by several other classes.
The AlkValue class does not provide a toDouble method, so I think that some work may be necessary to either implement this method based on AlkValue, or to eliminate the calls to toDouble from the other classes (avoiding potential overflows). Have you thought about a plan for this? Are you planning on port only the mymoneymoney class to AlkValue, and deal with the missing methods in this class? or to change the other classes that use the toDouble method to use AlkValue instead? Any help in pointing me in the right direction is appreciated. |
KDE Developer
|
That really depends from case to case. I want to spend all of my available time into the stable release first before I go and investigate the necessary steps.
If you want to go ahead and play with it, please feel free to do so. A good first step would be to document the cases where the toDouble() method is used. Please feel free to use the KDE community wiki pages at http://community.kde.org/KMyMoney to create a page for this information. In general, I was thinking to derive MyMoneyMoney from AlkValue, such that class MyMoneyMoney : public AlkValue {...}; Most of the methods should be directly available, others can be provided by MyMoneyMoney. Hope that gives enough information for the moment.
ipwizard, proud to be a member of the KMyMoney forum since its beginning.
openSuSE Leap 15.4 64bit, KF5 |
Registered Member
|
Thanks, this really shed some light.
I will play a little bit with it following the inheritance strategy, and will create a new page in the wiki to document what I do. |
Registered Member
|
I'd recommend you subscribe to our development mailing list. kmymoney-devel@kde.org
Also, patches are received via reviewboard.kde.org, for the time when you have some running code.
Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
|
Registered users: Bing [Bot], daret, Google [Bot], Sogou [Bot]