SUMMARY STEPS TO REPRODUCE 1. Alt-F2 to call krunner 2. 6729.69-6727.6 OBSERVED RESULT 2.0899999999992 EXPECTED RESULT 2.09 SOFTWARE/OS VERSIONS Linux/KDE Plasma: Gentoo Linux, kernel-5.11.0, updated to 2021-02-22 (available in About System) KDE Plasma Version: 5.21.0 KDE Frameworks Version: 5.79.0 Qt Version: 5.15.2 ADDITIONAL INFORMATION I've noticed this sometime late 2014, so this has been around for many versions. If I use the KCalc application, I get correct result. I'd expect the calculator plugin for krunner to produce the same results.
It seems like you don't have qalculate installed. With that you get the expected result. Otherwise QJSEngine is used to evaluate the result.
Hmm, Should we mark this as INTENTIONAL an require qalculate as a hard dependency, or fix the built-in calculation? My preference would be for the former.
The downstream plasma-workspace package correctly lists sci-libs/libqalculate as an optional dependency. We can certainly enable that by default, and improve the description in case user is disabling the option.
When you run `node` and type in the expression you mentioned it you get a similar result. Messing with the JS engine would seem like a really bad idea. I personally have been thinking that it could make sense to not build this runner at all when qaclulate is not available, it is kindof confusing if you still have the runner, but it does not work as you would expect.
Indeed, enabling the +qalculate USE flag for kde-plasma/plasma-workspace does resolve the issue, not sure why I've not noticed this before. As far as I can tell this flag has been around for some years now. I will work with Andreas to have this enabled by default in Gentoo.
Should we maybe make qalculate mandatory? If not using it causes this problem, that doesn't seem ideal.
(In reply to Alexander Lohnau from comment #4) > I personally have been thinking that it could make sense to not build this > runner at all when qaclulate is not available, it is kindof confusing if you > still have the runner, but it does not work as you would expect. ^ second that. I'd say build the runner conditionally on qalculate.
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/856
Git commit 4c5e454024df728885f42e9757e35d993afa948a by Nate Graham, on behalf of Zoltan Puskas. Committed on 01/01/2022 at 00:52. Pushed by ngraham into branch 'master'. calculatorrunner: Enforce using Qalculate If libqalculate is not present on the system, calculator runner falls back to using QJSEngine, which results in significantly reduced precision. Make calculator runner unconditionally dependent on Qalculate and remove conditional fallback code to QJSEngine. M +5 -0 CMakeLists.txt M +18 -36 runners/calculator/CMakeLists.txt M +0 -5 runners/calculator/autotests/calculatorrunnertest.cpp M +0 -179 runners/calculator/calculatorrunner.cpp M +0 -8 runners/calculator/calculatorrunner.h https://invent.kde.org/plasma/plasma-workspace/commit/4c5e454024df728885f42e9757e35d993afa948a