Incorrect Evaluation Order for Implied Multiplication

Bug #756277 reported by Ajay Roopakalu
20
This bug affects 3 people
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://us.archive.ubuntu.com/ubuntu/ maverick-updates/main i386 Packages
        100 /var/lib/dpkg/status
     5.32.0-0ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ maverick/main i386 Packages

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
Revision history for this message
Andrew Simmonds (andrew-c-side) wrote :

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.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Fixed upstream for gcalctool 6.0.1

Changed in gcalctool (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcalctool - 6.0.1~git20110421-0ubuntu1

---------------
gcalctool (6.0.1~git20110421-0ubuntu1) natty; urgency=low

  * New upstream release
    - Fixes (LP: #756277) (LP: #760536) (LP: #760718) (LP: #668512)
      (LP: #755820)
 -- Robert Ancell <email address hidden> Thu, 21 Apr 2011 18:11:46 +1000

Changed in gcalctool (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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