aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-05-02 20:57:19 +0800
committerGitHub <noreply@github.com>2017-05-02 20:57:19 +0800
commitd8b76e1ecaf19e921e6a757a094e3ce3c2b02bbd (patch)
tree0f6359c31c0b6a61ff648a08bb0a493fe3ceddf3 /docs
parent2891b98882160c15a68b5166e3493ec8e7b21f7f (diff)
parentfc3f40febe3ed7686682e2e9ef4f615b206400b4 (diff)
downloaddexon-solidity-d8b76e1ecaf19e921e6a757a094e3ce3c2b02bbd.tar
dexon-solidity-d8b76e1ecaf19e921e6a757a094e3ce3c2b02bbd.tar.gz
dexon-solidity-d8b76e1ecaf19e921e6a757a094e3ce3c2b02bbd.tar.bz2
dexon-solidity-d8b76e1ecaf19e921e6a757a094e3ce3c2b02bbd.tar.lz
dexon-solidity-d8b76e1ecaf19e921e6a757a094e3ce3c2b02bbd.tar.xz
dexon-solidity-d8b76e1ecaf19e921e6a757a094e3ce3c2b02bbd.tar.zst
dexon-solidity-d8b76e1ecaf19e921e6a757a094e3ce3c2b02bbd.zip
Merge pull request #2172 from ethereum/docs-sar
Document how Solidity's SAR is different
Diffstat (limited to '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: