Merge pull request #2172 from ethereum/docs-sar

Document how Solidity's SAR is different
This commit is contained in:
chriseth 2017-05-02 14:57:19 +02:00 committed by GitHub
commit d8b76e1eca

View File

@ -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: