Incorrect Evaluation Order for Implied Multiplication
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcalctool (Ubuntu) |
Fix Released
|
High
|
Unassigned |
Bug Description
Binary package hint: gcalctool
1. Ubuntu 10.10
2. gcalctool:
Installed: 5.32.0-0ubuntu4
Candidate: 5.32.0-0ubuntu4
Version table:
*** 5.32.0-0ubuntu4 0
500 http://
100 /var/lib/
5.
500 http://
3. Step 1: Type (without quotes): "48/2(9+3)"
Step 2: Expected result: 288
4. Actual result: 2
Additional Notes: Typing in (without quotes): "48/2*(9+3)" gives the correct result of 288. My guess is that the left parenthesis after the 2 is lexed at the binding of a function call rather than an implied multiplication.
Related branches
Changed in gcalctool (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → High |
There's nothing in the help that describes this situation but a look at the equation parser in the source would seem to agree with the described behaviour.
In this case 48÷2(9+3) is equivalent to 48÷(2x(9+3)) i.e. the precedence of the multiplication is raised in this situation. This is the same as some TI calculators (TI-80/81/82/85). Later calculators changed the order of calculation to make implicit and explicit multiplication the same.
The choice here appears to be between explicitly mentioning this order of evaluation in the help or change the precedence in the code.