Bug 188617

Summary: Substraction gives erroneous result
Product: [Plasma] krunner Reporter: Hervé Fache <herve>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: dominik.tritscher
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Hervé Fache 2009-04-01 21:14:35 UTC
Version:            (using KDE 4.2.1)
OS:                Linux
Installed from:    Ubuntu Packages

I type Alt-F2 to start krunner. Then I type my calculation: '=66.02 -25.37'
It gives me the following result: '40.64999999999999'

Same if I type '66.02 - 25.37 ='
Comment 1 Hervé Fache 2009-04-03 09:43:57 UTC
This is also the case in:
Version:            (using KDE 4.2.2)
OS:                Linux
Installed from:    Ubuntu Packages
Comment 2 Fábio Firmo 2009-04-03 23:03:19 UTC
This is a expected rounding error, due the hardware representation of real numbers. The result is the same in the python interpreter, for example.

This report can be closed, I think. A more sophisticated calculator engine can be requested by a wish.
Comment 3 Dominik Tritscher 2009-04-03 23:10:38 UTC

*** This bug has been marked as a duplicate of bug 167986 ***
Comment 4 Hervé Fache 2009-04-04 16:21:01 UTC
Fábio, rounding errors are for divisions. This is a substraction and no rounding is necessary.

This is a bug, and a big one, as can be seen in the examples in https://bugs.kde.org/show_bug.cgi?id=167986 (the original bug of which mine is a duplicate).