mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add warning about SAR in docs
This commit is contained in:
parent
f9bccab7b7
commit
fc3f40febe
@ -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
|
equivalent to ``x / 2**y``. This means that shifting negative numbers
|
||||||
sign extends. Shifting by a negative amount throws a runtime exception.
|
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
|
.. index:: address, balance, send, call, callcode, delegatecall, transfer
|
||||||
|
|
||||||
.. _address:
|
.. _address:
|
||||||
|
Loading…
Reference in New Issue
Block a user