diff options
author | Paweł Bylica <chfast@gmail.com> | 2017-04-28 20:00:59 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-04-28 21:35:25 +0800 |
commit | fc3f40febe3ed7686682e2e9ef4f615b206400b4 (patch) | |
tree | 2eba786a32d96f0c426309a63529b8f83ffa6950 /docs/types.rst | |
parent | f9bccab7b744c786f1eb12fad5cc0e499d0f1075 (diff) | |
download | dexon-solidity-fc3f40febe3ed7686682e2e9ef4f615b206400b4.tar.gz dexon-solidity-fc3f40febe3ed7686682e2e9ef4f615b206400b4.tar.zst dexon-solidity-fc3f40febe3ed7686682e2e9ef4f615b206400b4.zip |
Add warning about SAR in docs
Diffstat (limited to 'docs/types.rst')
-rw-r--r-- | docs/types.rst | 6 |
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: |