about summary refs log tree commit diff
path: root/Doc
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-01-09 22:46:42 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-01-10 19:49:16 +0000
commit53e3d9e0638d025cd99a65011ff96d5e2680e2ec (patch)
treef29d9c668f581a85d2ce5d3a6a6879b793412745 /Doc
parent3495dc5c275c7e3fe3517cfd20e2dc7f1cfa43db (diff)
downloadzsh-53e3d9e0638d025cd99a65011ff96d5e2680e2ec.tar.gz
zsh-53e3d9e0638d025cd99a65011ff96d5e2680e2ec.tar.xz
zsh-53e3d9e0638d025cd99a65011ff96d5e2680e2ec.zip
34914: explanation of effect of integer promotion
Diffstat (limited to 'Doc')
-rw-r--r--Doc/Zsh/arith.yo9
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/Zsh/arith.yo b/Doc/Zsh/arith.yo
index a620b73d1..5c334ce9c 100644
--- a/Doc/Zsh/arith.yo
+++ b/Doc/Zsh/arith.yo
@@ -233,6 +233,15 @@ necessary.  In addition, if any operator which requires an integer
 equivalents with assignment) is given a floating point argument, it will be
 silently rounded down to the next integer.
 
+Users should beware that, in common with many other programming
+languages but not software designed for calculation, the evaluation of
+an expression in zsh is taken a term at a time and promotion of integers
+to floating point does not occur in terms only containing integers.  A
+typical result of this is that a division such as tt(6/8) is truncated,
+in this being rounded down to 0.  The tt(FORCE_FLOAT) shell option can
+be used in scripts or functions where floating point evaluation is
+required throughout.
+
 Scalar variables can hold integer or floating point values at different
 times; there is no memory of the numeric type in this case.