Bug 501000 - Using the square root function in science mode leads to "Malformed expression"
Summary: Using the square root function in science mode leads to "Malformed expression"
Status: RESOLVED FIXED
Alias: None
Product: kcalc
Classification: Applications
Component: general (other bugs)
Version First Reported In: 24.12.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Gabriel Barrantes
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-03 11:39 UTC by prep
Modified: 2025-03-07 00:22 UTC (History)
2 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 prep 2025-03-03 11:39:02 UTC
SUMMARY
Using the square root function in science mode leads to "Malformed expression"
STEPS TO REPRODUCE
1. start kcalc and set science mode if it is not set;
2. type any number, for example 54;
3. press the sqrt button
OBSERVED RESULT
54√(
EXPECTED RESULT
7.34846922835
4. press the = button
OBSERVED RESULT
Malformed expression
EXPECTED RESULT
7.34846922835
SOFTWARE/OS VERSIONS
Linux/FC40/XFCE4
KDE Frameworks Version: 5.116.0
Qt Version: 4.8.7-76, 5.15.15-3, 6.8.2-3
ADDITIONAL INFORMATION
Comment 1 Gabriel Barrantes 2025-03-03 14:15:12 UTC
(In reply to prep from comment #0)
> SUMMARY
> Using the square root function in science mode leads to "Malformed
> expression"
> STEPS TO REPRODUCE
> 1. start kcalc and set science mode if it is not set;
> 2. type any number, for example 54;
> 3. press the sqrt button
> OBSERVED RESULT
> 54√(
> EXPECTED RESULT
> 7.34846922835
> 4. press the = button
> OBSERVED RESULT
> Malformed expression
> EXPECTED RESULT
> 7.34846922835
> SOFTWARE/OS VERSIONS
> Linux/FC40/XFCE4
> KDE Frameworks Version: 5.116.0
> Qt Version: 4.8.7-76, 5.15.15-3, 6.8.2-3
> ADDITIONAL INFORMATION

Now you need to enter the sqrt first, you will see in the display √(54 yielding the correct result below
Comment 2 prep 2025-03-06 08:29:14 UTC
Previously, the root and other functions were calculated from the displayed content of the input field, why not return exactly this behavior. If there are no brackets, then it is obvious. Well, or add a check for switching?
Comment 3 Gabriel Barrantes 2025-03-07 00:22:22 UTC
(In reply to prep from comment #2)
> Previously, the root and other functions were calculated from the displayed
> content of the input field, why not return exactly this behavior. If there
> are no brackets, then it is obvious. Well, or add a check for switching?

because that would be incompatible with the input display that allows the input to be edited. I need to do some changes so the blinking cursor is always visible but since now you can edit the input that old behaviour is just not compatible.