Skip to content

Commit 8d1bff6

Browse files
qwertystopaaronfrankeCalinou
authored
Document behavior of modulo operator (#9358)
Different languages and contexts have different default behaviors for modulo where one or both operands are negative. "The remainder of an integer division" is underspecified. As such, clarification is in order. Co-authored-by: Aaron Franke <[email protected]> Co-authored-by: Hugo Locurcio <[email protected]>
1 parent c6bcae3 commit 8d1bff6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tutorials/scripting/evaluating_expressions.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ The following operators are available:
4444
| Division (``/``) | Performs and integer division if both operands are integers. |
4545
| | If at least one of them is a floating-point number, returns a floating-point value. |
4646
+------------------------+-------------------------------------------------------------------------------------+
47-
| Modulo (``%``) | Returns the remainder of an integer division. |
47+
| Remainder (``%``) | Returns the remainder of an integer division (modulo). |
48+
| | The result will always have the sign of the dividend. |
4849
+------------------------+-------------------------------------------------------------------------------------+
4950

5051
Spaces around operators are optional. Also, keep in mind the usual

0 commit comments

Comments
 (0)