Summary: | Fuel consumption conversion incorrect | ||
---|---|---|---|
Product: | [Frameworks and Libraries] frameworks-kunitconversion | Reporter: | Radek Novacek <rad.n> |
Component: | general | Assignee: | John Layt <jlayt> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | kde, kdelibs-bugs, madcatx, mark_p._sanders, nate, simonandric5 |
Priority: | NOR | ||
Version: | 5.32.0 | ||
Target Milestone: | --- | ||
Platform: | Fedora RPMs | ||
OS: | Linux | ||
Latest Commit: | https://commits.kde.org/kunitconversion/bc7495095baa7a70e756c4d2044de2197d1a4e3b | Version Fixed In: | 5.58 |
Sentry Crash Report: | |||
Attachments: | Screenshot from KRunner |
Description
Radek Novacek
2017-04-19 14:50:57 UTC
Created attachment 105098 [details]
Screenshot from KRunner
I doubt KUnitConversion handles reciprocals, so either the units should get removed, or some major rework is needed. *** Bug 387959 has been marked as a duplicate of this bug. *** It seems KUnitConversion cannot handle an inverse fraction. n mpg = 253 / n l/100km The code tries to do "something" in that direction by overriding toDefault()/fromDefault() but that clearly breaks in one or other form (either mpg→l/100km or, if you fix that, mpg→mpgi and mpg→km/l) For those interested, please review the following patch https://phabricator.kde.org/D20284 Git commit bc7495095baa7a70e756c4d2044de2197d1a4e3b by Albert Astals Cid, on behalf of Michal Malý. Committed on 14/04/2019 at 15:59. Pushed by aacid into branch 'master'. Fix l/100 km to MPG conversion Summary: Previous code (probably) worked only for l/100 km -> MPG but not the other way around. Fix this by using reciprocal conversion when necessary. Output: 38.7 MPG -> 6.077 l/100 km; 16.455 km/l; 46.482 MPGI 16.455 km/l -> 6.077 l/100 km; 38.7 MPG 46.48 MPGI -> 6.077 l/100 km Seems good to me. Reviewers: broulik, #frameworks, aacid Subscribers: apol, aacid, meven, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D20284 M +20 -0 autotests/convertertest.cpp M +23 -9 src/fuel_efficiency.cpp https://commits.kde.org/kunitconversion/bc7495095baa7a70e756c4d2044de2197d1a4e3b |