[Calculator Runner] Use "approximate" approximation mode
ClosedPublic

Authored by broulik on Jan 26 2017, 9:26 AM.

Details

Summary

The runner calculator isn't entitled for being a scientifically correct calculator.
This keeps seemingly innocent calculations such as "2^0.333333333" from eating all RAM until it crashes.

BUG: 277011
FIXED-IN: 5.10.0

Test Plan

Upstream issue https://github.com/Qalculate/libqalculate/issues/16

I'll also investigate how to have krunner cancel calculations once the runner context becomes invalid. Tried. calculator->abort() doesn't do anything anything.

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik retitled this revision from to [Calculator Runner] Use "approximate" approximation mode.Jan 26 2017, 9:26 AM
broulik updated this object.
broulik edited the test plan for this revision. (Show Details)
broulik added a reviewer: Plasma: Workspaces.
broulik set the repository for this revision to R120 Plasma Workspace.
Restricted Application added a project: Plasma. · View Herald TranscriptJan 26 2017, 9:26 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik edited the test plan for this revision. (Show Details)Jan 26 2017, 9:51 AM
broulik edited the test plan for this revision. (Show Details)

Probably needs some indication that the result is approximate:

When result.isApproximate() returns true I'll add a (approximation) suffix or something like this – can't go into 5.9 then.

mart added a subscriber: mart.Jan 26 2017, 4:11 PM

ship it with "aproximate" text (and just 5.10)

mart requested changes to this revision.Jan 27 2017, 11:28 AM
mart added a reviewer: mart.
mart added inline comments.
runners/calculator/qalculate_engine.cpp
103

add an (approximate) string in the result, then good to go

This revision now requires changes to proceed.Jan 27 2017, 11:28 AM
broulik updated this revision to Diff 10979.Feb 6 2017, 5:32 PM
broulik updated this object.
  • Add hint when the result is an approximation
mart accepted this revision.Mar 27 2017, 4:55 PM
This revision is now accepted and ready to land.Mar 27 2017, 4:55 PM
This revision was automatically updated to reflect the committed changes.

@kde-i18n-doc I'd like to ask for an exception to backport this fix to Plasma 5.8 (due mid of May) and Plasma 5.9 (due 25 April) as it is a rather severe, easily triggerable, memory leak/crash fix.
Initially it would have been without a new translation but as silently rounding results isn't ideal, I had to add a hint "Approximation" to it.

@kde-i18n-doc I'd like to ask for an exception to backport this fix to Plasma 5.8 (due mid of May) and Plasma 5.9 (due 25 April) as it is a rather severe, easily triggerable, memory leak/crash fix.
Initially it would have been without a new translation but as silently rounding results isn't ideal, I had to add a hint "Approximation" to it.

No objections from Ukrainian team.

lueck added a subscriber: lueck.Mar 28 2017, 4:49 AM

OK from german team