Bug 497580 - Wrong result for calculations of the form a-b*c+d+e
Summary: Wrong result for calculations of the form a-b*c+d+e
Status: RESOLVED DUPLICATE of bug 496713
Alias: None
Product: kcalc
Classification: Applications
Component: general (show other bugs)
Version: 24.08.3
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: Gabriel Barrantes
URL:
Keywords:
: 499448 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-12-16 22:17 UTC by Hermann Kraus
Modified: 2025-02-04 03:00 UTC (History)
2 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 Hermann Kraus 2024-12-16 22:17:15 UTC
SUMMARY
Any calculation where there is a subtraction of a product as the second term and two additions or subtraction follow is wrong. The problem only occurs after a second addition, i.e. a-b*c+d is calculated correctly, but a-b*c+d+e is not. The sign of "d" gets inverted.


STEPS TO REPRODUCE
1. Enter "1-1*1+1". Result: 1. Correct.
2. Enter "1-1*1+1+0" Result: -1. Wrong. +1 would be correct.
3. Enter "4-2*2+100+10". Result: -90. Wrong. kcalc calculates with the sign of the last operand inverted.

OBSERVED RESULT
Wrong calculation results.

EXPECTED RESULT
Correct calculation results.

SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux 
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.8.0
Qt Version: 6.8.1
Kernel Version: 6.12.1-4-MANJARO (64-bit)
Graphics Platform: Wayland
Processors: 16 × 12th Gen Intel® Core™ i7-1260P
Memory: 16.5 GB of RAM
Graphics Processor: Mesa Intel® Graphics

ADDITIONAL INFORMATION
Comment 1 Gabriel Barrantes 2024-12-16 22:51:54 UTC
Got fixed by the patch for 496713, the fix is supposed to be already in 24.8, but I guess it did not propagate to your machine, try to reinstall the latest. Do not heasitate to report such issues. Thanks!

*** This bug has been marked as a duplicate of bug 496713 ***
Comment 2 Gabriel Barrantes 2025-02-04 03:00:57 UTC
*** Bug 499448 has been marked as a duplicate of this bug. ***