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 | 3be8c207009de29d1b986abc9e11c9815a42beec (patch) | |
tree | baf06272c14a5cf1c030debb20781ab4068243bb /doc/mathop.n | |
parent | 8d944280e1616ab92d470c999c5c1b98bf97908d (diff) | |
download | tcl-3be8c207009de29d1b986abc9e11c9815a42beec.zip tcl-3be8c207009de29d1b986abc9e11c9815a42beec.tar.gz tcl-3be8c207009de29d1b986abc9e11c9815a42beec.tar.bz2 |
[Bug 2931407]: Clarified semantics of division and remainder operators.
Diffstat (limited to 'doc/mathop.n')
-rw-r--r-- | doc/mathop.n | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/doc/mathop.n b/doc/mathop.n index 5a6ba4e..5757f87 100644 --- a/doc/mathop.n +++ b/doc/mathop.n @@ -126,13 +126,19 @@ will be an integer. .TP \fB%\fR \fInumber number\fR . -Returns the integral modulus of the first argument with respect to the second. -Each \fInumber\fR must have an integral value. Note that Tcl defines this -operation exactly even for negative numbers, so that the following equality -holds true: +Returns the integral modulus (i.e., remainder) of the first argument +with respect to the second. +Each \fInumber\fR must have an integral value. +Also, the sign of the result will be the same as the sign of the second +\fInumber\fR, which must not be zero. .RS +.PP +Note that Tcl defines this operation exactly even for negative numbers, so +that the following command returns a true value (omitting the namespace for +clarity): +.PP .CS -(\fIx \fB/ \fIy\fR) \fB* \fIy \fB== \fIx \fB-\fR (\fIx \fB% \fIy\fR) +\fB==\fR [\fB*\fR [\fB/\fI x y\fR] \fIy\fR] [\fB-\fI x\fR [\fB%\fI x y\fR]] .CE .RE .TP |