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: anonymous
Subject: [Octave-bug-tracker] [bug #54491] Order of evaluation of power with unitary operators
Date: Sat, 11 Aug 2018 02:35:03 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:51.0) Gecko/20100101 Firefox/51.0

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

                 Summary: Order of evaluation of power with unitary operators
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Sat 11 Aug 2018 06:35:01 AM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: rahnema1
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.4.0
        Operating System: GNU/Linux

    _______________________________________________________

Details:

According to the MATLAB documentation
<https://www.mathworks.com/help/matlab/matlab_prog/operator-precedence.html>
the operators (^-), (.^-), (^+), (.^+), (^~), and (.^~) work from second from
the right to left but in Octave they are evaluated from the left to right.

Test case:


z = 3;
out = z(a=1)^-(a=2);
out = z(b=1).^-(b=2);
out = z(c=1)^+(c=2);
out = z(d=1).^+(d=2);
out = z(ee=1)^~(ee=2);
out = z(f=1).^~(f=2);

disp([a b c d ee f])

#shows [2 2 2 2 2 2] but it should produce [1 1 1 1 1 1]






    _______________________________________________________

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]