Calculate and store value of previous calculation

Bug #1315799 reported by Bartosz Kosiorek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Calculator App
Fix Released
High
Riccardo Padovani

Bug Description

Current design of calculation from engine perspective is as add brackets after press "=":

Engine formula example:
1+2
=
(1+2)+3
=
((1+2)+3)+4
=

It cause many problems. The brackets are hidden, and it is very hard to implement official bracket support (there is a problems with Clear and backspace feature), and add new functions to it (sin, cos, tan, ln, sqrt etc), which are using brackets.
(Look at: https://bugs.launchpad.net/ubuntu-calculator-app/+bug/1289682)
It also cause dramatically performance drop with long calculation (try to even press several times "=")

My idea is store calculate values in some memory, and make all brackets visible for user.
Example:

Engine formula example: Array:
1+2 (nothing in array)
=
3+3 (1+2)
=
6+4 (1+2)(3+3)
=
10 (1+2)(3+3)(6+4)
C
6+4 (1+2)(3+3)
C
6 (1+2)(3+3)
C
3+3 (1+2)

Previous expression should be store in internal array.

Related branches

description: updated
description: updated
Changed in ubuntu-calculator-app:
assignee: nobody → Bartosz Kosiorek (gang65)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

This is an interesting bug, and we have to find a good solution.

One thing we have to keep in mind: we need to save the history as it is, because we have history log.
Actual implementation was good for a Simple Calculator, with advanced functions is unuseful.

One possible solution is to save two params in the table when we save calc, one for visual calc and one for engine calc.

For visual calc we keep only things we need to show, and for engine we save also results.
Take a look to Scientif calc: http://bazaar.launchpad.net/~ubuntu-calculator-dev/ubuntu-calculator-app/trunk/view/head:/Scientific/ScientificPage.qml

I think that implementation is good an we can start from here to build :-)

Changed in ubuntu-calculator-app:
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

Increasing priority, because it causing performance problems and it is blocker for advanced functions.

Changed in ubuntu-calculator-app:
importance: Low → High
status: Confirmed → Triaged
assignee: Bartosz Kosiorek (gang65) → nobody
description: updated
Changed in ubuntu-calculator-app:
status: Triaged → In Progress
assignee: nobody → Riccardo Padovani (rpadovani)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:ubuntu-calculator-app at revision 289, scheduled for release in ubuntu-calculator-app, milestone 1.6

Changed in ubuntu-calculator-app:
status: In Progress → Fix Committed
Changed in ubuntu-calculator-app:
status: Fix Committed → In Progress
assignee: Riccardo Padovani (rpadovani) → nobody
status: In Progress → Fix Committed
assignee: nobody → Riccardo Padovani (rpadovani)
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.