| Summary: | Rounding errors in investment purchases | ||
|---|---|---|---|
| Product: | [Applications] kmymoney | Reporter: | mark.smolarz |
| Component: | general | Assignee: | KMyMoney Devel Mailing List <kmymoney-devel> |
| Status: | NEEDSINFO WAITINGFORINFO | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 5.1.3 | ||
| Target Milestone: | --- | ||
| Platform: | openSUSE | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: |
Screenshot – correctly rounded total, incorrect entry
Screenshot - Incorrect rounding x.885 Screenshot - Correct rounding x.775 Incorrect Rounding on Appimage (5.2.1-c9efa7a) Rounding of x.8855 on Appimage (5.2.1-c9efa7a) Setting the rounding option on the investment |
||
|
Description
mark.smolarz
2025-12-28 16:03:42 UTC
Created attachment 188040 [details]
Screenshot - Incorrect rounding x.885
Created attachment 188041 [details]
Screenshot - Correct rounding x.775
Does the problem still exist on a newer version? You can simply try by using an AppImage from https://kmymoney.org/appimage.html Created attachment 188078 [details]
Incorrect Rounding on Appimage (5.2.1-c9efa7a)
The same problem exists here too. The numbers are rounded incorrectly and even my input is overwritten. Previously, entries with 3 or 4 decimal places were still saved and displayed again when edited. The correct value was still saved, but here only the rounded value seems to be saved. Created attachment 188079 [details]
Rounding of x.8855 on Appimage (5.2.1-c9efa7a)
Created attachment 188111 [details] Setting the rounding option on the investment It looks like your rounding option is set to RoundRound which causes the behavior you encounter (see attached screenshot). I have not found a respective section on rounding in the KMyMoney documentation, but the different settings are very well explained in the comment of the source code at https://invent.kde.org/office/alkimia/-/blob/master/src/alkvalue.h.in?ref_type=heads#L30-L78. Regarding the modification of the value entry in 5.2.1+ it has to be noted, that keeping the original value caused other (rounding) problems down the line. There are (closed) bug entries about it, which I did not find on first glance. If you want to keep the original detail, you may want to switch to the price per share entry method. That allows to control the number of digits using the price precision of the investment. It seems that some rounding options were not yet available in this version. Only Round, Ceil, Floor and Truncate are offered. From the wording, “Round” was the option I was looking for, because the other two options rounded up or down completely. However, “RoundHalfUp” would probably be the best option here. I'll probably have to wait until the new version is available for me. |