diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Doc/Zsh/arith.yo | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index 1297b1382..9e0d9cd9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-06-19 Peter Stephenson <pws@csr.com> + + * 25214, tweaked: add warning about exponentitation precedence. + 2008-06-16 Clint Adams <clint@zsh.org> * 25167: Src/system.h: patch from Petr Salinger to define diff --git a/Doc/Zsh/arith.yo b/Doc/Zsh/arith.yo index 423e6c1bc..dd18ee720 100644 --- a/Doc/Zsh/arith.yo +++ b/Doc/Zsh/arith.yo @@ -93,8 +93,9 @@ cindex(arithmetic operators) cindex(operators, arithmetic) An arithmetic expression uses nearly the same syntax and associativity of expressions as in C. -The following operators are supported (listed in decreasing order -of precedence): + +In the native mode of operation, the following operators are supported +(listed in decreasing order of precedence): startsitem() sitem(tt(PLUS() - ! ~ PLUS()PLUS() --))(unary plus/minus, logical NOT, complement, {pre,post}{in,de}crement) @@ -142,6 +143,11 @@ sitem(tt(= PLUS()= -= *= /= %= &= ^= |= <<= >>= &&= ||= ^^= **=))(assignment) sitem(tt(,))(comma operator) endsitem() +Note the precedence of exponentiation in both cases is below +that of unary operators, hence `tt(-3**2)' evaluates as `tt(9)', not +tt(-9). Use parentheses where necessary: `tt(-(3**2))'. This is +for compatibility with other shells. + cindex(mathematical functions, use of) cindex(functions, math, use of) Mathematical functions can be called with the syntax |