Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: c869f51a5a0b224df639acf7eb255a2243f7cc1c
Ticket: 218243ffffffffffffffffffffffffffffffffff
expr operator precedence
User & Date: nobody on 2000-10-26 00:54:59
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 2813 Bug
    Version: 8.2
    SubmitDate: '1999-09-16'
    LastModified: '1999-09-16'
    Severity: MED
    Status: Closed
    Submitter: techsupp
    ChangedBy: hobbs
    OS: Linux-Red Hat
    Machine: Other
    FixedDate: '2000-10-25'
    ClosedDate: '1999-09-16'
    
    
    Name:
    John Ellson
    
    ReproducibleScript:
    expr -2^2
        expr -2^2+2^2
        expr 2^2-2^2
        expr 2^-2^2
    
    ObservedBehavior:
    according to tcl:
        
          -2^2 = -4
          -2^2+2^2 = -8
           2^2-2^2 = 0
           2^-2^2 = -2
    
    DesiredBehavior:
    according to matlab
        
          -2^2 = -4
          -2^2+2^2 = 0
           2^2-2^2 = 0
           2^-2^2 = 0.0625
        
        according to perl:
        
          bash>> perl -e '$x=-2**2;print "$x\n";'
          -4
          bash>> perl -e '$x=-2**2+2**2;print "$x\n";'
          0
          bash>> perl -e '$x=+2**2-2**2;print "$x\n";'
          0
          bash>> perl -e '$x=+2**-2**2;print "$x\n";'
          0.0625
    
    
    
    The user was confusing the Tcl bitwise XOR (^) with the power
    function (expr pow(base,exp)). 
    -- 09/16/1999 hobbs
    
  4. foundin changed to: "obsolete: 8.2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to: "expr operator precedence"
  11. type changed to: "Bug"