Bug 271057

Summary: kcalc negative numbers ui problem
Product: [Applications] kcalc Reporter: Maarten Bezemer <maarten.bezemer>
Component: generalAssignee: Evan Teran <eteran>
Status: RESOLVED WORKSFORME    
Severity: wishlist CC: cfeck
Priority: NOR    
Version: 2.7   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description Maarten Bezemer 2011-04-15 21:44:31 UTC
Version:           2.7 (using KDE 4.5.1) 
OS:                Linux

When I click -5 in kcalc it shows as 5 and only when I press = will it show as -5. This is horrible as when I type -5+2 it doesn't show the sign and will be left wondering whether I have pressed the negative sign. Please show the negative sign when I have typed.

Reproducible: Always

Steps to Reproduce:
type - and 5

Actual Results:  
you only see 5

Expected Results:  
It is expected to see -5

LP #668020: https://bugs.launchpad.net/ubuntu/+source/kdeutils/+bug/668020
Comment 1 Evan Teran 2011-04-19 17:27:40 UTC
I believe that you are pressing the subtract button "-", then 5, then equals "=". That is actually not the correct way to create negative number! What that does is take the current value (0 when you start the calculator), then subtracts 5 from it when you hit equals. Which of course results in negative 5.

The correct way to input a negative number is instead to enter the value you want (5) and then to use the "+/-" button (located in the lower right in all modes). This will immediately toggle the sign of the value.

So, if you wanted to calculate "5 * -10", you would press the following keys:

5
x (multiply)
10
+/-
=

I hope this helps.
Comment 2 Maarten Bezemer 2011-04-19 17:47:46 UTC
I try not to press number but use my keyboard, which does not have a "+/-" key.
So to type "-5", I type "-" and "5" which indeed acts as "-5", since I can continue typing "+", "2" and "=" to get the correct result "-3".

The 'problem' is that I do not see "-5" when I type "-" and "5", which would be the expected output. Especially since kcalc acts correctly as if "-5" is present.
Comment 3 Christoph Feck 2011-04-19 19:22:48 UTC
If you want to toggle the sign using the keyboard, use the \ key.

Tip: Hold Ctrl to see the keyboard shortcuts.
Comment 4 Christoph Feck 2011-04-19 19:27:30 UTC
See also bug 240082 comment #9.
Comment 5 Evan Teran 2011-04-19 22:45:14 UTC
@Maarten Bezeme, When type the keyboard keys: "-5+2=", you are actually telling kcalc to calculate: "0-5+2=".

Christoph Feck offers the correct keyboard solution. It is possible that "\" is not the best keyboard shortcut for "invert sign", but that's a different discussion.