Bug 436933 - Can't use comma as argument separator in Calculator
Summary: Can't use comma as argument separator in Calculator
Status: REPORTED
Alias: None
Product: krunner
Classification: Plasma
Component: calculator (other bugs)
Version First Reported In: 5.21.4
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Alexander Lohnau
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-11 15:17 UTC by Mahmud Nabil
Modified: 2025-12-01 21:21 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mahmud Nabil 2021-05-11 15:17:46 UTC
SUMMARY

As a result of the commit https://invent.kde.org/plasma/plasma-workspace/commit/a8644836253ee00f265ae11390dfd4afcef179ce,
functions requiring multiple arguments no longer work as showcased in https://userbase.kde.org/Plasma/Krunner#Calculator. This can be observed even in the screenshot(https://userbase.kde.org/File:KRunner.png) provided by the userbase.


STEPS TO REPRODUCE
1. In krunner enter '= integrate( -x/y^2, y )'
2. Clear input and try '= perm(10,5) ' or '= comb(10,5) '
3. 

OBSERVED RESULT
The calculator result shows C - x^2 / (2y^3).
Observed same result  by entering '.' in place of the comma.
I assume '.' here is interpreted as multiplication sign with higher precedence.
The next two inputs produces no result from calculator.

EXPECTED RESULT
-x/y
30240 and 252 for next inputs.

SOFTWARE/OS VERSIONS
Clear Linux OS 34590
KDE Plasma Version: 5.21.4
KDE Frameworks Version: 5.81.0
Qt Version: 5.15.0

ADDITIONAL INFORMATION

LC_NUMERIC information:

$ locale -kc LC_NUMERIC
LC_NUMERIC
decimal_point="."
thousands_sep=","
grouping=3;3
numeric-decimal-point-wc=46
numeric-thousands-sep-wc=44
numeric-codeset="UTF-8"
Comment 1 leo 2025-12-01 20:32:05 UTC
I think this should be solved by using Calculator::unlocalizeExpression from libqalculate instead of custom locale handling code.
Comment 2 Mahmud Nabil 2025-12-01 21:21:12 UTC
(In reply to leo from comment #1)
> I think this should be solved by using Calculator::unlocalizeExpression from
> libqalculate instead of custom locale handling code.

Exactly what I had suggested here: https://bugs.kde.org/show_bug.cgi?id=406388#c19,
but the maintainer seemed to be preferring his custom logic of considering both '.' and ',' to be used as decimal separator.

Now when I try krunner after 4 years the comma is neither considered a decimal separator nor a expression separator, the comma is just ignored, for instance '= comb(10,5) ' becomes '= comb(105) ' :). So the implementation still does not match the user guide, https://userbase.kde.org/Plasma/Krunner#Calculator.