diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/types.rst | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/docs/types.rst b/docs/types.rst index 59b9771b..069a9190 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -51,18 +51,18 @@ Integers Operators: * Comparisons: ``<=``, ``<``, ``==``, ``!=``, ``>=``, ``>`` (evaluate to ``bool``) -* Bit operators: ``&``, ``|``, ``^`` (bitwise exclusive or), ``~`` (bitwise negation), ``<<`` (left shift), ``>>`` (right shift) -* Arithmetic operators: ``+``, ``-``, unary ``-``, unary ``+``, ``*``, ``/``, ``%`` (remainder), ``**`` (exponentiation) +* Bit operators: ``&``, ``|``, ``^`` (bitwise exclusive or), ``~`` (bitwise negation) +* Arithmetic operators: ``+``, ``-``, unary ``-``, unary ``+``, ``*``, ``/``, ``%`` (remainder), ``**`` (exponentiation), ``<<`` (left shift), ``>>`` (right shift) Division always truncates (it just maps to the DIV opcode of the EVM), but it does not truncate if both operators are :ref:`literals<rational_literals>` (or literal expressions). -Division by zero and modulus with zero throws an exception. +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 an exception. +sign extends. Shifting by a negative amount throws a runtime exception. .. index:: address, balance, send, call, callcode, delegatecall @@ -144,9 +144,9 @@ Operators: * Bit operators: ``&``, ``|``, ``^`` (bitwise exclusive or), ``~`` (bitwise negation), ``<<`` (left shift), ``>>`` (right shift) * Index access: If ``x`` is of type ``bytesI``, then ``x[k]`` for ``0 <= k < I`` returns the ``k`` th byte (read-only). -The shifting operator wors with any integer type as right operand (bit will -return the type of the left operand). Shifting by a negative amount will cause -a runtime exception. +The shifting operator works with any integer type as right operand (but will +return the type of the left operand), which denotes the number of bits to shift by. +Shifting by a negative amount will cause a runtime exception. Members: |