Created attachment 176857 [details] screenshot of kcalc demonstrating the bug SUMMARY Square of -2 produces -4 when it must be 4 STEPS TO REPRODUCE 1. Put kcalc to engineering mode 2. Press 2 3. Press change sign button (+/-) 4. Press square button (x2) OBSERVED RESULT -4 EXPECTED RESULT 4 SOFTWARE/OS VERSIONS Operating System: EndeavourOS KDE Plasma Version: 6.2.4 KDE Frameworks Version: 6.9.0 Qt Version: 6.8.1 Kernel Version: 6.12.6-arch1-1 (64-bit) Graphics Platform: Wayland Processors: 16 × AMD Ryzen 7 5800H with Radeon Graphics Memory: 58.7 ГиБ of RAM Graphics Processor: AMD Radeon Graphics
powers takes precedence over + or -, so -2^2 is equal to -4 according to that agreement. You can also enter it on wolframalpha to validate.
I guess the confusion is due to the old kcalc not having input display, but now the result agrees with the input you are seeing on top. So now to have (-2)^2 you need to actually add the parenthesis.
+/- button on calculators do not add "-" character to expression, but reverses it sign. But if we suppose it does - what is not a common convention. Then, following input sequences must work and produce valid results: 1. "(", "2", "+/-" Should produce "(-2", but produces "-2" 2. "(", "+/-" Should produce "(-" but produces "–(()" and "malformed expression" error.
(In reply to Kirill from comment #3) > +/- button on calculators do not add "-" character to expression, but > reverses it sign. This is what is doing, try a long expression. > 1. "(", "2", "+/-" > Should produce "(-2", but produces "-2" The result is 2, so reversing yields -2 > 2. "(", "+/-" > Should produce "(-" but produces "–(()" and "malformed expression" error. This might be a bug, still, kinda expected, because what it does is -(expression).
I agree with Kirill. Both the 'real' calculators I found in my drawer (different brands), and all the ones I can remember using in the past, pressing 2, +/-, x^2 gives 4.
(In reply to Paul Worrall from comment #5) > I agree with Kirill. > > Both the 'real' calculators I found in my drawer (different brands), and all > the ones I can remember using in the past, pressing 2, +/-, x^2 gives 4. I rechecked and it makes sense, somebody might fix it soon.