diff options
author | Matthew Martin <phy1729@gmail.com> | 2015-09-29 00:06:39 -0500 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2015-09-30 14:22:59 +0100 |
commit | 007f249a8e190306a9ef6bca2317e79004ace871 (patch) | |
tree | 535686c1b937b9346ec43a6aab5426a2ef5294f3 /Doc/Zsh/arith.yo | |
parent | 533658730745ae6261f9552aba01dc5346405d30 (diff) | |
download | zsh-007f249a8e190306a9ef6bca2317e79004ace871.tar.gz zsh-007f249a8e190306a9ef6bca2317e79004ace871.tar.xz zsh-007f249a8e190306a9ef6bca2317e79004ace871.zip |
36693: arithmetic rounds towards zero, document
Diffstat (limited to 'Doc/Zsh/arith.yo')
-rw-r--r-- | Doc/Zsh/arith.yo | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Doc/Zsh/arith.yo b/Doc/Zsh/arith.yo index 1dcd18cad..c152bf48d 100644 --- a/Doc/Zsh/arith.yo +++ b/Doc/Zsh/arith.yo @@ -215,7 +215,7 @@ findex(integer, use of) Arithmetic evaluation is performed on the value of each assignment to a named parameter declared integer in this manner. Assigning a floating point number to an integer results in -rounding down to the next integer. +rounding towards zero. cindex(parameters, floating point) cindex(floating point parameters) @@ -230,16 +230,16 @@ format. Promotion of integer to floating point values is performed where necessary. In addition, if any operator which requires an integer -(`tt(~)', `tt(&)', `tt(|)', `tt(^)', `tt(%)', `tt(<<)', `tt(>>)' and their -equivalents with assignment) is given a floating point argument, it will be -silently rounded down to the next integer. +(`tt(&)', `tt(|)', `tt(^)', `tt(<<)', `tt(>>)' and their equivalents with +assignment) is given a floating point argument, it will be silently rounded +towards zero except for `tt(~)' which rounds down. 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 +in this being rounded towards 0. The tt(FORCE_FLOAT) shell option can be used in scripts or functions where floating point evaluation is required throughout. |