diff options
| author | donal.k.fellows@manchester.ac.uk <dkf> | 2012-05-29 09:48:29 (GMT) |
|---|---|---|
| committer | donal.k.fellows@manchester.ac.uk <dkf> | 2012-05-29 09:48:29 (GMT) |
| commit | 9d0294bea08070a6ec9a492065994a9029251f07 (patch) | |
| tree | a19c305f82d180a47f31466d9bedd2e93df532dc /doc/expr.n | |
| parent | 117b215ec24f532e265060ee5f904d2b36f09e04 (diff) | |
| parent | 0b564eaa2e920bbcdfc6c5cd067e3ecb2320a486 (diff) | |
| download | tcl-9d0294bea08070a6ec9a492065994a9029251f07.zip tcl-9d0294bea08070a6ec9a492065994a9029251f07.tar.gz tcl-9d0294bea08070a6ec9a492065994a9029251f07.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
@@ -134,7 +134,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 . |
