aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaweł Bylica <chfast@gmail.com>2017-04-28 20:00:59 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-04-28 21:35:25 +0800
commitfc3f40febe3ed7686682e2e9ef4f615b206400b4 (patch)
tree2eba786a32d96f0c426309a63529b8f83ffa6950
parentf9bccab7b744c786f1eb12fad5cc0e499d0f1075 (diff)
downloaddexon-solidity-fc3f40febe3ed7686682e2e9ef4f615b206400b4.tar.gz
dexon-solidity-fc3f40febe3ed7686682e2e9ef4f615b206400b4.tar.zst
dexon-solidity-fc3f40febe3ed7686682e2e9ef4f615b206400b4.zip
Add warning about SAR in docs
-rw-r--r--docs/types.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/types.rst b/docs/types.rst
index 60235ad2..c868adc6 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -64,6 +64,12 @@ expression ``x << y`` is equivalent to ``x * 2**y`` and ``x >> y`` is
equivalent to ``x / 2**y``. This means that shifting negative numbers
sign extends. Shifting by a negative amount throws a runtime exception.
+.. warning::
+ The results produced by shift right of negative values of signed integer types is different from those produced
+ by other programming languages. In Solidity, shift right maps to division so the shifted negative values
+ are going to be rounded towards zero (truncated). In other programming languages the shift right of negative values
+ works like division with rounding down (towards negative infinity).
+
.. index:: address, balance, send, call, callcode, delegatecall, transfer
.. _address: