octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #54491] Order of evaluation of power with unit


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #54491] Order of evaluation of power with unitary operators
Date: Mon, 13 Aug 2018 14:54:20 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Update of bug #54491 (project octave):

              Item Group:    Matlab Compatibility => WTF, Matlab?!?         
                  Status:                 Invalid => Confirmed              
             Open/Closed:                  Closed => Open                   
                 Release:                   4.4.0 => dev                    

    _______________________________________________________

Follow-up Comment #4:

According to
https://www.mathworks.com/help/matlab/matlab_prog/operator-precedence.html, it
seems that these compound power are unary +/- operators are given some special
treatment.  I have no idea why.  It means that an expression like


2^+2^+3^+4 == (2^+(2^+3))^+4 == (2^+8)^+4 == 256^+4 == 4294967296


will produce a different result from


2^2^3^4 == ((2^2)^3)^4 == (4^3)^4 == 64^4 == 16777216


I don't see these compound operators explained in the list of operators in the
Matlab docs.  WTF?  I don't understand why this behavior would be desirable.

Octave doesn't have these as separate operators (and I suspect that Matlab
doesn't either).  But when used this way in Octave, the evaluation is the same
as for the power operator without the unary operator (left to right).

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?54491>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]