[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #33304] power operator precedence and directio
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #33304] power operator precedence and direction |
Date: |
Sun, 15 May 2011 03:23:54 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 |
Follow-up Comment #3, bug #33304 (project octave):
Verified in Matlab. Octave should be processing left-to-right and not
breaking off when it sees a unary symbol. This applies to either '+' or '-'.
2^+4^3
ans = 1.8447e+19
because this is parsed as 2^(+4^3).
For Matlab, the logical not operator (~) is at the same level of precedence as
the unary operators and therefore might need to be processed in the same
manner as +/-.
Demonstration code:
2^~0^2 = 2
because Octave parses this as
2^(~0^2) == 2^(~(0^2)) == 2^(~(0)) == 2^(1) == 2
It should probably be parsed as
(2^~0)^2 == (2^1)^2 == (2)^2 = 4
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?33304>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/