summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-06-19 12:54:23 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-06-19 12:54:23 +0000
commit07c8612be653093b0f4e3c212edcb51eacdda7e7 (patch)
tree5d95a0f9b9373da87e43e8dfa134e1a30600fb98
parent6c9cc0e4fc3ea34274b2b370c0430992b308c4c9 (diff)
downloadzsh-07c8612be653093b0f4e3c212edcb51eacdda7e7.tar.gz
zsh-07c8612be653093b0f4e3c212edcb51eacdda7e7.tar.xz
zsh-07c8612be653093b0f4e3c212edcb51eacdda7e7.zip
25214, tweaked: add warning about exponentiation precedence
-rw-r--r--ChangeLog4
-rw-r--r--Doc/Zsh/arith.yo10
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