diff options
Diffstat (limited to 'doc/mathop.n')
-rw-r--r-- | doc/mathop.n | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/doc/mathop.n b/doc/mathop.n index d65b236..4c16d76 100644 --- a/doc/mathop.n +++ b/doc/mathop.n @@ -1,13 +1,11 @@ -.\" -*- nroff -*- +.\" .\" Copyright (c) 2006-2007 Donal K. Fellows. .\" .\" See the file "license.terms" for information on usage and redistribution .\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. .\" -.\" RCS: @(#) $Id: mathop.n,v 1.10 2007/12/13 15:22:32 dgp Exp $ -.\" -.so man.macros .TH mathop n 8.5 Tcl "Tcl Mathematical Operator Commands" +.so man.macros .BS .\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -128,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 @@ -240,7 +244,8 @@ result will be minus one. . Returns the bit-wise OR of each of the arbitrarily many arguments. Each \fInumber\fR must have an integral value. If no arguments are given, the -result will be zero..TP +result will be zero. +.TP \fB^\fR ?\fInumber\fR ...? . Returns the bit-wise XOR of each of the arbitrarily many arguments. Each @@ -272,9 +277,11 @@ Returns whether the value \fIarg\fR is present in the list \fIlist\fR Returns whether the value \fIarg\fR is not present in the list \fIlist\fR (according to exact string comparison of elements). .SH EXAMPLES +.PP The simplest way to use the operators is often by using \fBnamespace path\fR to make the commands available. This has the advantage of not affecting the set of commands defined by the current namespace. +.PP .CS namespace path {\fB::tcl::mathop\fR ::tcl::mathfunc} @@ -298,3 +305,6 @@ set sorted [\fB<=\fR {*}$list] expr(n), mathfunc(n), namespace(n) .SH KEYWORDS command, expression, operator +'\" Local Variables: +'\" mode: nroff +'\" End: |