Bug 412627 - Dsiplay properly rounded results instead of interval()
Summary: Dsiplay properly rounded results instead of interval()
Status: RESOLVED FIXED
Alias: None
Product: krunner
Classification: Plasma
Component: calculator (show other bugs)
Version: 5.16.90
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: Kai Uwe Broulik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-05 06:25 UTC by Kishore Gopalakrishnan
Modified: 2020-01-07 16:11 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.18.0


Attachments
Unreadable output because of interval print (15.40 KB, image/png)
2019-12-13 20:56 UTC, lukjp3
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kishore Gopalakrishnan 2019-10-05 06:25:36 UTC
SUMMARY
For some calculations, the calculator displays a bounding interval for the answer, like `interval(1.386294361119890, 1.386294361119891)`. This is difficult to read at a glance. Ideally, krunner would display a result rounded to the appropriate number of significant figures.

STEPS TO REPRODUCE
1. Type `=log(4)` in krunner

OBSERVED RESULT
The output is `interval(1.386294361119890, 1.386294361119891)` with `Approximation` written beside it in greyed-out text.

EXPECTED RESULT
Since we have so many digits after the decimal point, there seems to be no harm in outputting something like `1.38629436111989`, while still noting that it is an approximation.

SOFTWARE/OS VERSIONS
Linux distro: Arch Linux
KDE Plasma Version: 5.16.90
KDE Frameworks Version: 5.62
Qt Version: 5.13.1
Comment 1 Christoph Feck 2019-10-24 12:40:47 UTC
The interval notation is a 'feature' of qalculate. It doesn't happen when using the JavaScript-based computation.
Comment 2 lukjp3 2019-12-13 20:56:27 UTC
Created attachment 124480 [details]
Unreadable output because of interval print

I have the same problem, additionally for some calculations the result is completely unreadable because of the interval representation, as seen in the attached screenshot.
I would suggest to only print the significant digits, an alternative would be, to print the midpoint of the interval.

As libqalculate already has options for other representations [1, 2], the change would only be to set another representation in the print options of the qalculate module of krunner. I successfully tried the relevant change on my system with printing only the significant digits and can make a patch for it.

SOFTWARE/OS VERSIONS
Linux distro: Manjaro Linux
KDE Plasma Version: 5.17.4
KDE Frameworks Version: 5.64
Qt Version: 5.13.2

[1] https://qalculate.github.io/reference/structPrintOptions.html#ae940631420bfaa5da009fccb5c3a78b9
[2] https://qalculate.github.io/reference/includes_8h.html (enum IntervalDisplay)
Comment 3 Nate Graham 2020-01-07 16:11:36 UTC
Git commit e374492d24f467187faebe7915c12a6d639a5cd6 by Nate Graham, on behalf of Lukas Pichler.
Committed on 07/01/2020 at 16:11.
Pushed by ngraham into branch 'master'.

Change krunner calculator to display significant digits

Summary:
Change the qalculate krunner module to print only significant digits instead of an interval as this is sometimes unreadable.
FIXED-IN: 5.18.0

Test Plan:
Before this change:
{F7828390}
After:
{F7828389}

Reviewers: broulik, #plasma

Reviewed By: broulik, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26149

M  +3    -0    runners/calculator/qalculate_engine.cpp

https://commits.kde.org/plasma-workspace/e374492d24f467187faebe7915c12a6d639a5cd6