We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d84a5ae commit 4fec34dCopy full SHA for 4fec34d
Doc/faq/programming.rst
@@ -831,7 +831,7 @@ Why does -22 // 10 return -3 instead of -2?
831
A non-integral float, such as ``x = -22 / 10``, can be converted to an int
832
with either :meth:`math.trunc` or :meth:`math.floor`, giving -2 or -3.
833
Maintaining the desired invariant ``i == (i // j) * j + (i % j)`` requires
834
-that the choice for integer division (`//`) match the choice for which of
+that the choice for integer division (``//``) match the choice for which of
835
``i`` or ``j`` determines the sign of ``i % j``. For -22 and 10, ``-2*10 + (-2) ==
836
-3*10 + 8 == -22``. Some languages choose truncation for int division
837
and hence modulo sign determination by ``i``.
0 commit comments