Unary minus priority?

Issue #327 duplicate
Former user created an issue

Originally reported on Google Code with ID 327 ``` What steps will reproduce the problem? -1^2

What is the expected output? -1 (MatLab, SciLab)

What do you see instead? 1

Please provide any additional information below. From Wikipedia:

Unfortunately, there exist differing conventions concerning the unary operator − (usually read "minus"). In written or printed mathematics, the expression −32 is interpreted to mean −(32) = −9, but in some applications and programming languages, notably the application Microsoft Office Excel and the programming language bc, unary operators have a higher priority than binary operators, that is, the unary minus (negation) has higher precedence than exponentiation, so in those languages −32 will be interpreted as (−3)2 = 9. In any case where there is a possibility that the notation might be misinterpreted, it is advisable to use parentheses to clarify which interpretation is intended. ```

Reported by `alek.silverstone` on 2010-02-04 16:08:23

Comments (2)

  1. Former user Account Deleted

    Reported by `helder.pereira.correia` on 2010-02-07 08:34:21 - Status changed: `Duplicate` - Merged into: #160

  2. Log in to comment