aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/types.rst13
1 files changed, 6 insertions, 7 deletions
diff --git a/docs/types.rst b/docs/types.rst
index 08b74241..009896d5 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -60,15 +60,14 @@ operators are :ref:`literals<rational_literals>` (or literal expressions).
Division by zero and modulus with zero throws a runtime exception.
The result of a shift operation is the type of the left operand. The
-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.
+expression ``x << y`` is equivalent to ``x * 2**y``, and, for positive integers,
+``x >> y`` is equivalent to ``x / 2**y``. For negative ``x``, ``x >> y``
+is equivalent to dividing by a power of ``2`` while rounding down (towards negative infinity).
+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).
+ Before version ``0.5.0`` a right shift ``x >> y`` for negative ``x`` was equivalent to ``x / 2**y``,
+ i.e. right shifts used rounding towards zero instead of rounding towards negative infinity.
.. index:: ! ufixed, ! fixed, ! fixed point number