Bug 343029 - Share * Prices/share is incorrectly rounded when adding investment transactions
Summary: Share * Prices/share is incorrectly rounded when adding investment transactions
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-19 01:38 UTC by zyzzyvette
Modified: 2018-03-28 08:00 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.0.0


Attachments
Rundungsfehler im Depotverrechnungkonto (3.26 KB, image/png)
2017-01-02 18:10 UTC, Fred
Details
is zero positive or negative? (2.73 KB, image/png)
2017-01-02 18:11 UTC, Fred
Details
adding a cent an nothing changes... (24.22 KB, image/png)
2017-01-12 18:36 UTC, Fred
Details

Note You need to log in before you can comment on or make changes to this bug.
Description zyzzyvette 2015-01-19 01:38:01 UTC
When I go to add my investment transactions ("buy shares") and enter in the shares and price per share, the resulting total is off by a few cents.

Reproducible: Always

Steps to Reproduce:
1. Start adding a new "Buy Shares" transaction to an investment account.
2. Under "Shares", enter "77.1010". 
3. Under "Price/share", enter "12.97".

Actual Results:  
Total is $999.98.

Expected Results:  
Rounded total should be $1000.00. 

No matter how I fiddle with the # shares, it seems that it can't end up with any total between $999.98 and $1000.11. E.g., try entering 77.1050 vs 77.10500000000001 shares.
Comment 1 allan 2015-01-19 12:35:37 UTC
I already replied to this a little earlier, so I don't know where that went to.  So, try again

You have to edit each share/investment involved, then at the bottom, click Price entry.  Select Total for all shares.

Then, when you edit/enter a transaction, enter the quantity as before, but for the price, enter the total amount.  When you accept the edit, the price will have been calculated for you.
Comment 2 Fred 2017-01-02 18:10:02 UTC
Created attachment 103146 [details]
Rundungsfehler im Depotverrechnungkonto

No Solution yet. You see the Account and this should not happen, not a penny (cent). Seems the differences come from share transactions and forgotten to round up before putting them into normal account?
Comment 3 Fred 2017-01-02 18:11:47 UTC
Created attachment 103147 [details]
is zero positive or negative?
Comment 4 Fred 2017-01-12 18:34:46 UTC
Again strange roundings - as the picture shows, investments are truncated and not rounded, however I use to give a cent extra on "misc". do it in this example an nothing happens to the sum - although there is this cent extra to calculate
Comment 5 Fred 2017-01-12 18:36:01 UTC
Created attachment 103376 [details]
adding a cent an nothing changes...
Comment 6 Fred 2017-01-30 12:30:28 UTC
still unconfirmed... What do you need? in My case it sums up to 9ct difference. 

Next month it will probably be more than 10ct - and I will need to re-correct a lot of historical bookings. Please take a look soon or let me know what you need.
Comment 7 Jack 2017-01-30 16:21:53 UTC
I thought this was addressed in a different bug, but I can't find it now.  I'll have to do more searching later.  However, I think the real issue right now is that all developer time is aimed at completing the migration to KDE Frameworks, so this will probably not be looked at in detail until that is complete, unless it turns out to be fairly easy to fix.
Comment 8 NSLW 2017-02-01 19:51:56 UTC
(In reply to Fred from comment #6)
> still unconfirmed... What do you need? in My case it sums up to 9ct
> difference. 
> 
> Next month it will probably be more than 10ct - and I will need to
> re-correct a lot of historical bookings. Please take a look soon or let me
> know what you need.

It might be fixed in master branch. What version of KMM do you use?
Comment 9 kde 2017-04-27 16:44:49 UTC
I have the same problem as the OP (Version 4.7.2 Using KDE Development Platform 4.14.18). My original problem started when one time my broker bought/sold shares at slightly different times resulting in an average share price that was probably an irrational number. My "fix" for this was to change the precision settings to 10 digits which allowed me to enter a more "precise" figure for the share price. This enabled me to get the result I wanted.

However later on some entries triggered this bug. So far using allan's workaround in comment 1 has fixed this problem. Is this bug caused by using floats instead of BCDs?