bugGNU Octave - Bugs: bug #31246, Inconsistent behavior of .^

 
 

bug #31246: Inconsistent behavior of .^

Submitter:  None
Submitted:  Mon 04 Oct 2010 08:15:59 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.2.4
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 04 Oct 2010 09:03:27 PM UTC, comment #2: 

I just came back to rescind this, since I realized it was just a precedence issue. Too late, you're quick. Sorry for the non-bug.

Anonymous
Mon 04 Oct 2010 08:28:15 PM UTC, comment #1: 

The .^ operator has a higher precedence than the - operator and so your two statement written differently ar

-(0.5 .^ (2/3))

and

(-0.5) .^ (2/3)

Are you really surprised they aren't equal? Read section 8.8 of the manual at

http://www.gnu.org/software/octave/doc/interpreter/Operator-Precedence.html#Operator-Precedence

for more information.

D.

David Bateman <dbateman>
Group Member
Mon 04 Oct 2010 08:15:59 PM UTC, original submission:  

I cannot think of a reason for these two results to be different. I would expect the second result to be the same as the first.

octave:70> -0.5 .^ (2/3)
ans = -0.62996
octave:71> [-0.5] .^ [(2/3)]
ans = -0.31498 + 0.54556i


octave:72> abs(ans)
ans =  0.62996

I was unable to find similar reported bugs, or test with a newer version.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dbateman (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-10-04 dbateman StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code