[calculator-app]Correction needed in calculation

Bug #1226738 reported by Mihir Soni
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu Calculator App
Fix Released
High
Mihir Soni
Ubuntu UX
Fix Released
Undecided
Christina Li

Bug Description

It's not giving the correct output of the calculation with the following calculation :-

Steps :-

Start a new calculation
Press 9
Press *
Press 9
Press -
Press (=)

Result should be 81 , currently it shows 72.

Related branches

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

It's desidered behavior, if you press equal after a sign, first number before sign is used.
See https://bugs.launchpad.net/ubuntu-calculator-app/+bug/1203435

Changed in ubuntu-calculator-app:
status: New → Invalid
Revision history for this message
Mihir Soni (mihirsoni) wrote :

But how come its 72 ??

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Because
9*9-= is equal to 9*9-9, that is 72 ;)

Revision history for this message
Sam Bull (dreamsorcerer) wrote :

OK, I see two problems with this.

Firstly, the obvious one. If you do keep it behaving like this (despite no other calculator using this behaviour), then the output is wrong. Entering the above into the calculator actually displays the calculation as:

   9
+ 9
- 0
= 72

Which is clearly wrong. If you're going to implicitly add numbers to the calculation, you need to actually display them.

Secondly, this behaviour makes little sense to me. I would expect that after entering an operand such as '+', if I then hit a different operand like 'x' it would change the operand, because I've just changed my mind. I would then expect '=' to work as an operand in the same way, thus removing any trailing operand because I've just changed my mind.

For comparison, entering the above into gnome-calculator gives a 'malformed expression' and into Android's calculator, gives 81.

It's probably worth getting some designer input on the second point.

Changed in ubuntu-calculator-app:
status: Invalid → Confirmed
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Ok, we'll wait an input from design team.

Changed in ubuntu-calculator-app:
status: Confirmed → Incomplete
tags: added: needs-design
summary: - Correction needed in calculation
+ [calculator-app]Correction needed in calculation
David Planella (dpm)
Changed in ubuntu-calculator-app:
importance: Undecided → High
Revision history for this message
Daniel Oliver (dannioliver) wrote :

"Entering the above into the calculator actually displays the calculation as:

   9
* 9
- 0
= 72

Which is clearly wrong. If you're going to implicitly add numbers to the calculation, you need to actually display them."

Agreed. It doesn't make sense to consider the operator if the user hasn't input any number after that.

"I would expect that after entering an operand such as '+', if I then hit a different operand like 'x' it would change the operand, because I've just changed my mind."

Agreed.

David Planella (dpm)
Changed in ubuntu-calculator-app:
status: Incomplete → Triaged
tags: removed: needs-design
Mihir Soni (mihirsoni)
Changed in ubuntu-calculator-app:
assignee: nobody → Mihir Soni (mihirsoni-123)
Mihir Soni (mihirsoni)
Changed in ubuntu-calculator-app:
status: Triaged → In Progress
Changed in ubuntu-ux:
status: New → Fix Released
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

Fix committed into lp:ubuntu-calculator-app at revision 165, scheduled for release in ubuntu-calculator-app, milestone alpha-1

Changed in ubuntu-calculator-app:
status: In Progress → Fix Committed
John Lea (johnlea)
Changed in ubuntu-ux:
assignee: nobody → Christina Li (christina-li)
Sam Bull (dreamsorcerer)
Changed in ubuntu-calculator-app:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.