Bug 188341 - wish: document grammar used by calculator plugin (or at least provide detailed description of capabilities)
Summary: wish: document grammar used by calculator plugin (or at least provide detaile...
Status: RESOLVED DUPLICATE of bug 369136
Alias: None
Product: krunner
Classification: Plasma
Component: calculator (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-28 16:41 UTC by doc.evans
Modified: 2020-07-08 13:05 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description doc.evans 2009-03-28 16:41:52 UTC
Version:            (using KDE 4.2.0)
OS:                Linux
Installed from:    Ubuntu Packages

Trying to use the calculator plugin is a very hit-or-miss affair, since there seems to be no user documentation to describe what kinds of expressions or operators it understands.

Just a few examples (these are not intended at all to suggest that the calculator is missing particular capabilities; they are intended to be examples that show that a user might easily enter things and not know whether the calculator is going to be able to handle them and give the correct answer):

1. It seems to understand the ^ operator, but not the equivalent **
2. It understands sqrt(); I have no idea how many other functions it understands (it understands tan() but not tanh(), for example)
3. It understands sin(), but there is no obvious way to tell it if the parameter is in degrees
4. It understands neither pi nor π (but gives a NaN for at least some operations using the former)
5. It doesn't seem to understand scientific notation, but the failure for 1e5 (for example) is different from the failure for 1e-5 (for example)
6. It seems to understand + - / * and parentheses, but does not understand !

The point is that there is insufficient documentation for the user to know any of this. By providing a grammar (or, failing that, a detailed description of its capabilities), the user would not have to discover all this by experiment.
Comment 1 Diggory Hardy 2011-06-24 15:05:06 UTC
It would be nice to have support for unicode operators: × ÷ −

According to localisation, a comma may be used as the decimal-point separator in output (e.g. 1/9 = 0,11111111), but this doesn't match the input syntax (if you input 0,11111111 the calculator thinks you have a list). I don't care which kind of decimal-point separator it uses myself, but this kind of inconsistency is odd (though perhaps unimportant).
Comment 2 Matteo Agostinelli 2011-10-02 20:35:10 UTC
This report motivated to document a bit better the new features available in the calculator runner since SC 4.5. See http://userbase.kde.org/Plasma/Krunner. It can definitely be improved but it's a start.

Concerning the points you raised, some of the features you mentioned are now available if the runner has been compiled with support for Qalculate enabled (the choice is up to the distribution packager).
Assuming Qalculate support is enabled:
1. operator ** is correctly working
2. a lot of functions are now implemented. A list can be found at http://qalculate.sourceforge.net/gtk-manual/apa.html
3. the parameter is by default in radians, but you can input degrees by typing the 'deg' keyword, e.g. =sin(30 deg)
4. pi and other constants (e.g. 'e') are recognized. A list can be found at http://qalculate.sourceforge.net/gtk-manual/apb.html
5. scientific notation should be fully working
6. '!' is now interpreted as factorial. There is a slightly annoying behavior (unrelated to this bug report): the query must be at least 3 characters long (excluding the '=') so typing =5! will not yield any result. A workaround is to add parenthesis: =(5)!

Please close this report if you are satisfied by this answer.
Comment 3 Matteo Agostinelli 2011-10-02 20:46:13 UTC
(In reply to comment #1)
This definitely sounds like Bug 249357, which should be already fixed. Are you running an updated version of the KDE workspace? Can you please post a comment on that report if you confirm the issue?
Comment 4 Diggory Hardy 2011-10-09 13:14:57 UTC
In reply to #3, no, neither of the things mentioned in #1 have been fixed in 4.6.5 (since bug 249357 was marked as fixed in december 2010 I presume it should be part of the release by now. To reiterate:

If I enter: "0.5=" I get "0,5", but if I enter "0,5=" I get "[0; 5]" (the same as when I enter "0;5=").

If I enter "3÷2=" I get: 6 "÷"

Also note that in "solve(f(n)=2n,f)=", f(n) is interpreted as f×n, not as a function, which doesn't make much sense. Returning something like "operation not supported" would be less confusing in some cases.
Comment 5 Alexander Lohnau 2020-07-08 13:05:22 UTC

*** This bug has been marked as a duplicate of bug 369136 ***