Bug 211052 - Too many decimal digits shown, showing floating point errors
Summary: Too many decimal digits shown, showing floating point errors
Status: RESOLVED DUPLICATE of bug 167986
Alias: None
Product: krunner
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Unspecified
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-19 09:40 UTC by Marco Poletti
Modified: 2009-12-27 00:46 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Poletti 2009-10-19 09:40:16 UTC
Version:            (using KDE 4.3.1)
Installed from:    SuSE RPMs

Floating-point calculation always have some slight error caused by the precision of the binary representation of the number.
KRunner shows too much decimal digits, thus showing to the user these slight errors.
I think 6 decimal places or so are sufficient, allowing enough precision for most application and hiding small internal errors.
If you really want to keep this number of decimal places, you should use a higher-precision floating-point type, like «long double» instead of «double» or so.

Steps to reproduce:

Enter 190.12 - 186.69 =

Expected result:

= 3.43

Actual result:

= 3.430000000000007
Comment 1 Marco Poletti 2009-12-07 16:25:50 UTC
Still an issue in 4.4 beta 1.
Comment 2 Pino Toscano 2009-12-27 00:46:11 UTC

*** This bug has been marked as a duplicate of bug 167986 ***