aboutsummaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-01-12 16:38:00 +0000
committerPeter Stephenson <pws@zsh.org>2015-01-12 16:38:00 +0000
commit5f4325a0a41987a92cee8b64a76e5b0d5e831f60 (patch)
tree8d66f0afe363b606c5841aff3c0c8869c2da4c4d /README
parent626650f20e5c01fa6554da2a73dc5338a2523842 (diff)
downloadzsh-5f4325a0a41987a92cee8b64a76e5b0d5e831f60.tar.gz
zsh-5f4325a0a41987a92cee8b64a76e5b0d5e831f60.tar.xz
zsh-5f4325a0a41987a92cee8b64a76e5b0d5e831f60.zip
Propagate float/integer type in arithmetic assignment.
Add test. Mention this and also floating point mod change in README.
Diffstat (limited to 'README')
-rw-r--r--README48
1 files changed, 48 insertions, 0 deletions
diff --git a/README b/README
index e3ccc70b1..218f27d58 100644
--- a/README
+++ b/README
@@ -35,6 +35,54 @@ Zsh is a shell with lots of features. For a list of some of these, see the
file FEATURES, and for the latest changes see NEWS. For more
details, see the documentation.
+Incompatibilites between 5.0.7 and 5.0.8
+----------------------------------------
+
+A couple of arithmetic operations have changed: the new behaviour
+is intended to be more consistent, but is not compatible with the old.
+
+Previously, the modulus operation, `%', implicitly converted the
+operation to integer and output an integer result, even if one
+or both of the arguments were floating point. Now, the C math
+library fmod() operator is used to implement the operation where
+one of the arguments is floating point. For example:
+
+Old behavour:
+
+% print $(( 5.5 % 2 ))
+1
+
+New behaviour:
+
+% print $(( 5.5 % 2 ))
+1.5
+
+Previously, assignments to variables assigned the correct type to
+variables declared as floating point or integer, but this type was
+not propagated to the value of the expression, as a C programmer
+would naturally expect. Now, the type of the variable is propagated
+so long as the variable is declared as a numeric type (however this
+happened, e.g. the variable may have been implicitly typed by a
+previous assignment). For example:
+
+Old behaviour:
+
+% integer var
+% print $(( var = 5.5 / 2.0 ))
+2.2000000000000002
+% print $var
+2
+
+(the actual rounding error may vary).
+
+New behaviour:
+
+% integer var
+% print $(( var = 5.5 / 2.0 ))
+2
+% print $var
+2
+
Incompatibilities between 5.0.2 and 5.0.5
-----------------------------------------