diff options
author | Georg Brandl <georg@python.org> | 2013-10-08 19:47:18 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2013-10-08 19:47:18 (GMT) |
commit | 0aaae26518202d8aa6a7654d62432b33b5b4b425 (patch) | |
tree | 5388768047a955b9b38d3f4655bed1424f26f712 /Doc/reference | |
parent | f24c1416eb609d7b4bfce2c0cfeb93a5192feb02 (diff) | |
download | cpython-0aaae26518202d8aa6a7654d62432b33b5b4b425.zip cpython-0aaae26518202d8aa6a7654d62432b33b5b4b425.tar.gz cpython-0aaae26518202d8aa6a7654d62432b33b5b4b425.tar.bz2 |
Clarify two points about division and shifting. Suggested by Albert Hofkamp on docs@.
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/expressions.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index 87a6d2e..caf34f4 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -912,7 +912,7 @@ repetition is performed; a negative repetition factor yields an empty sequence. The ``/`` (division) and ``//`` (floor division) operators yield the quotient of their arguments. The numeric arguments are first converted to a common type. -Integer division yields a float, while floor division of integers results in an +Division of integers yields a float, while floor division of integers results in an integer; the result is that of mathematical division with the 'floor' function applied to the result. Division by zero raises the :exc:`ZeroDivisionError` exception. @@ -972,8 +972,8 @@ the left or right by the number of bits given by the second argument. .. index:: exception: ValueError -A right shift by *n* bits is defined as division by ``pow(2,n)``. A left shift -by *n* bits is defined as multiplication with ``pow(2,n)``. +A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A left +shift by *n* bits is defined as multiplication with ``pow(2,n)``. .. note:: |