Bug 496713 - A*B^C+X*Y^Z doesn't yield the same result as (A*B^C)+(X*Y^Z).
Summary: A*B^C+X*Y^Z doesn't yield the same result as (A*B^C)+(X*Y^Z).
Status: RESOLVED FIXED
Alias: None
Product: kcalc
Classification: Applications
Component: general (show other bugs)
Version: 24.08.3
Platform: Other Linux
: NOR grave
Target Milestone: ---
Assignee: Gabriel Barrantes
URL:
Keywords:
: 497580 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-11-26 17:29 UTC by qaliboire.bug_report
Modified: 2024-12-16 22:51 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description qaliboire.bug_report 2024-11-26 17:29:15 UTC
SUMMARY
A*B^C+X*Y^Z doesn't yield the correct result.
(A*B^C)+(X*Y^Z) does.

STEPS TO REPRODUCE
1. Open KCalc in science mode;
2. paste `5×3^3+2×3^2` in the input field and press the "Return" key.

OBSERVED RESULT
KCalc shows "225".

EXPECTED RESULT
We expect the same result as the one yielded by `(5×3^3)+(2×3^2)`, i.e. "153".

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Linux 40
KDE Plasma Version: 6.2.3
KDE Frameworks Version: 6.8.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION
Another example: `7×4^5+5×3^4` (yields "10003") and `(7×4^5)+(5×3^4)` (yields "7573").
Comment 1 qaliboire.bug_report 2024-11-26 17:34:15 UTC
I apologize if I overstated the severity of the bug, but that seemed quite important to me. I'm assuming the admins have the option to downgrade it if they judge it excessive...
Comment 2 qaliboire.bug_report 2024-11-26 18:03:06 UTC
Sorry for not having been able to figure this out early enough to put it in the description, but it seems like `5×3^3+2×3^2` is parsed as `5×(3^3+2×3^2)`.
Similarly, `7×4^5+5×3^4` yields the same result as `7×(4^5+5×3^4)`.
Comment 3 Filip 2024-11-26 19:07:10 UTC
Can confirm
Comment 4 Bug Janitor Service 2024-11-26 21:16:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kcalc/-/merge_requests/165
Comment 5 Gabriel Barrantes 2024-11-26 23:17:35 UTC
My bad, thanks for the heads up, try reinstalling the latest.
Comment 6 qaliboire.bug_report 2024-11-27 13:25:06 UTC
(In reply to Gabriel Barrantes from comment #5)
> My bad, thanks for the heads up, try reinstalling the latest.

You are very much welcome for the heads up. Thank *you* for the fix. Not sure what you mean by "try reinstalling the latest", though. I don't see why my testing would be more valuable than yours, so I'm wildly guessing that you're not asking me to check is everything is fine on my side of things... Are you suggesting that I upgrade to version 24.11 to have the fix take effect? I'm new to this, so I don't really know to which version(s) your commit will be applied, or when the package will be updated in the repo, or what I'm supposed to do at this point, really.
Comment 7 Gabriel Barrantes 2024-11-27 20:11:51 UTC
> what I'm supposed to do at this point, really.

I meant try to update so you can get the fixed version. To be honest I not quite sure how long would take to propagate, it depends on what repository your distro is using. Either way should be fixed in nex release.
Either way, thanks for the bug report, is really hard to cover all edge cases and is good to have it tested.
Comment 8 qaliboire.bug_report 2024-11-27 22:49:11 UTC
(In reply to Gabriel Barrantes from comment #7) 
> I meant try to update so you can get the fixed version.
> quite sure how long would take to propagate, it depends on what repository
> your distro is using. Either way should be fixed in nex release.

Alright! Cheers!

> Either way, thanks for the bug report, is really hard to cover all edge
> cases and is good to have it tested.

No problem. You guys do a lot of great work, so it's the least I can do.
Comment 9 Gabriel Barrantes 2024-12-16 22:51:54 UTC
*** Bug 497580 has been marked as a duplicate of this bug. ***