Calculate and store value of previous calculation
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:/
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
- Bartosz Kosiorek: Needs Fixing
- PS Jenkins bot: Approve (continuous-integration)
- Ubuntu Phone Apps Jenkins Bot: Approve (continuous-integration)
- Mihir Soni: Approve
- Alan Pope 🍺🐧🐱 🦄 (community): Approve
-
Diff: 75 lines (+18/-11)2 files modifiedSimple/SimplePage.qml (+4/-1)
formula.js (+14/-10)
description: | updated |
description: | updated |
Changed in ubuntu-calculator-app: | |
assignee: | nobody → Bartosz Kosiorek (gang65) |
Changed in ubuntu-calculator-app: | |
status: | New → Confirmed |
importance: | Undecided → Low |
description: | updated |
Changed in ubuntu-calculator-app: | |
status: | Triaged → In Progress |
assignee: | nobody → Riccardo Padovani (rpadovani) |
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 |
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. bazaar. launchpad. net/~ubuntu- calculator- dev/ubuntu- calculator- app/trunk/ view/head: /Scientific/ ScientificPage. qml
Take a look to Scientif calc: http://
I think that implementation is good an we can start from here to build :-)