diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-05-29 09:44:44 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-05-29 09:44:44 (GMT) |
commit | ae3ca8f5a7f6417162cbeadbc613d452c2b278c8 (patch) | |
tree | baf06272c14a5cf1c030debb20781ab4068243bb /doc/expr.n | |
parent | e5539135b837450e93c2470e43049bcb08648d97 (diff) | |
download | tcl-ae3ca8f5a7f6417162cbeadbc613d452c2b278c8.zip tcl-ae3ca8f5a7f6417162cbeadbc613d452c2b278c8.tar.gz tcl-ae3ca8f5a7f6417162cbeadbc613d452c2b278c8.tar.bz2 |
[Bug 2931407]: Clarified semantics of division and remainder operators.
Diffstat (limited to 'doc/expr.n')
-rw-r--r-- | doc/expr.n | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -131,7 +131,20 @@ Multiply, divide, remainder. None of these operators may be applied to string operands, and remainder may be applied only to integers. The remainder will always have the same sign as the divisor and -an absolute value smaller than the divisor. +an absolute value smaller than the absolute value of the divisor. +.RS +.PP +When applied to integers, the division and remainder operators can be +considered to partition the number line into a sequence of equal-sized +adjacent non-overlapping pieces where each piece is the size of the divisor; +the division result identifies which piece the divisor lay within, and the +remainder result identifies where within that piece the divisor lay. A +consequence of this is that the result of +.QW "-57 \fB/\fR 10" +is always -6, and the result of +.QW "-57 \fB%\fR 10" +is always 3. +.RE .TP 20 \fB+\0\0\-\fR Add and subtract. Valid for any numeric operands. |