about summary refs log tree commit diff
path: root/Doc/Zsh/arith.yo
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 /Doc/Zsh/arith.yo
parent6c9cc0e4fc3ea34274b2b370c0430992b308c4c9 (diff)
downloadzsh-07c8612be653093b0f4e3c212edcb51eacdda7e7.tar.gz
zsh-07c8612be653093b0f4e3c212edcb51eacdda7e7.tar.xz
zsh-07c8612be653093b0f4e3c212edcb51eacdda7e7.zip
25214, tweaked: add warning about exponentiation precedence
Diffstat (limited to 'Doc/Zsh/arith.yo')
-rw-r--r--Doc/Zsh/arith.yo10
1 files changed, 8 insertions, 2 deletions
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