summaryrefslogtreecommitdiffstats
path: root/doc/mathop.n
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2024-01-21 17:48:32 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2024-01-21 17:48:32 (GMT)
commitc0820abc21f24df06915c420f63efab64af79dac (patch)
tree619dd4a0a33861ce42065d751e86a9ba4dbf929b /doc/mathop.n
parentd8760322be4e1bfb0091bac0a799aef13dc77b87 (diff)
downloadtcl-c0820abc21f24df06915c420f63efab64af79dac.zip
tcl-c0820abc21f24df06915c420f63efab64af79dac.tar.gz
tcl-c0820abc21f24df06915c420f63efab64af79dac.tar.bz2
Clean up of docs
Diffstat (limited to 'doc/mathop.n')
-rw-r--r--doc/mathop.n71
1 files changed, 49 insertions, 22 deletions
diff --git a/doc/mathop.n b/doc/mathop.n
index 3a13456..f8a0dc4 100644
--- a/doc/mathop.n
+++ b/doc/mathop.n
@@ -13,19 +13,19 @@ mathop \- Mathematical operators as Tcl commands
.SH SYNOPSIS
package require \fBTcl 8.5-\fR
.sp
-\fB::tcl::mathop::!\fR \fInumber\fR
+\fB::tcl::mathop::!\fI number\fR
.br
-\fB::tcl::mathop::~\fR \fInumber\fR
+\fB::tcl::mathop::~\fI number\fR
.br
\fB::tcl::mathop::+\fR ?\fInumber\fR ...?
.br
-\fB::tcl::mathop::\-\fR \fInumber\fR ?\fInumber\fR ...?
+\fB::tcl::mathop::\-\fI number\fR ?\fInumber\fR ...?
.br
\fB::tcl::mathop::*\fR ?\fInumber\fR ...?
.br
-\fB::tcl::mathop::/\fR \fInumber\fR ?\fInumber\fR ...?
+\fB::tcl::mathop::/\fI number\fR ?\fInumber\fR ...?
.br
-\fB::tcl::mathop::%\fR \fInumber number\fR
+\fB::tcl::mathop::%\fI number number\fR
.br
\fB::tcl::mathop::**\fR ?\fInumber\fR ...?
.br
@@ -35,13 +35,13 @@ package require \fBTcl 8.5-\fR
.br
\fB::tcl::mathop::^\fR ?\fInumber\fR ...?
.br
-\fB::tcl::mathop::<<\fR \fInumber number\fR
+\fB::tcl::mathop::<<\fI number number\fR
.br
-\fB::tcl::mathop::>>\fR \fInumber number\fR
+\fB::tcl::mathop::>>\fI number number\fR
.br
\fB::tcl::mathop::==\fR ?\fIarg\fR ...?
.br
-\fB::tcl::mathop::!=\fR \fIarg arg\fR
+\fB::tcl::mathop::!=\fI arg arg\fR
.br
\fB::tcl::mathop::<\fR ?\fIarg\fR ...?
.br
@@ -53,7 +53,7 @@ package require \fBTcl 8.5-\fR
.br
\fB::tcl::mathop::eq\fR ?\fIarg\fR ...?
.br
-\fB::tcl::mathop::ne\fR \fIarg arg\fR
+\fB::tcl::mathop::ne\fI arg arg\fR
.br
.VS "8.7, TIP461"
\fB::tcl::mathop::lt\fR ?\fIarg\fR ...?
@@ -65,9 +65,9 @@ package require \fBTcl 8.5-\fR
\fB::tcl::mathop::ge\fR ?\fIarg\fR ...?
.VE "8.7, TIP461"
.br
-\fB::tcl::mathop::in\fR \fIarg list\fR
+\fB::tcl::mathop::in\fI arg list\fR
.br
-\fB::tcl::mathop::ni\fR \fIarg list\fR
+\fB::tcl::mathop::ni\fI arg list\fR
.sp
.BE
.SH DESCRIPTION
@@ -92,34 +92,39 @@ The following operator commands are supported:
.SS "MATHEMATICAL OPERATORS"
.PP
The behaviors of the mathematical operator commands are as follows:
+.\" COMMAND: !
.TP
-\fB!\fR \fIboolean\fR
+\fB!\fI boolean\fR
.
Returns the boolean negation of \fIboolean\fR, where \fIboolean\fR may be any
numeric value or any other form of boolean value (i.e. it returns truth if the
argument is falsity or zero, and falsity if the argument is truth or
non-zero).
+.\" COMMAND: +
.TP
\fB+\fR ?\fInumber\fR ...?
.
Returns the sum of arbitrarily many arguments. Each \fInumber\fR argument may
be any numeric value. If no arguments are given, the result will be zero (the
summation identity).
+.\" COMMAND: -
.TP
-\fB\-\fR \fInumber\fR ?\fInumber\fR ...?
+\fB\-\fI number\fR ?\fInumber\fR ...?
.
If only a single \fInumber\fR argument is given, returns the negation of that
numeric value. Otherwise returns the number that results when all subsequent
numeric values are subtracted from the first one. All \fInumber\fR arguments
must be numeric values. At least one argument must be given.
+.\" COMMAND: *
.TP
\fB*\fR ?\fInumber\fR ...?
.
Returns the product of arbitrarily many arguments. Each \fInumber\fR may be
any numeric value. If no arguments are given, the result will be one (the
multiplicative identity).
+.\" COMMAND: /
.TP
-\fB/\fR \fInumber\fR ?\fInumber\fR ...?
+\fB/\fI number\fR ?\fInumber\fR ...?
.
If only a single \fInumber\fR argument is given, returns the reciprocal of that
numeric value (i.e. the value obtained by dividing 1.0 by that value).
@@ -134,8 +139,9 @@ results will be as if the functions \fIfloor\fR and \fIint\fR are applied to
them, in that order). If all values in the operation are integers, the result
will be an integer.
.RE
+.\" COMMAND: %
.TP
-\fB%\fR \fInumber number\fR
+\fB%\fI number number\fR
.
Returns the integral modulus (i.e., remainder) of the first argument
with respect to the second.
@@ -152,6 +158,7 @@ clarity):
\fB==\fR [\fB*\fR [\fB/\fI x y\fR] \fIy\fR] [\fB\-\fI x\fR [\fB%\fI x y\fR]]
.CE
.RE
+.\" COMMAND: **
.TP
\fB**\fR ?\fInumber\fR ...?
.
@@ -171,6 +178,7 @@ arguments are integral values.
.PP
The behaviors of the comparison operator commands (most of which operate
preferentially on numeric arguments) are as follows:
+.\" COMMAND: ==
.TP
\fB==\fR ?\fIarg\fR ...?
.
@@ -178,23 +186,27 @@ Returns whether each argument is equal to the arguments on each side of it in
the sense of the \fBexpr\fR == operator (\fIi.e.\fR, numeric comparison if
possible, exact string comparison otherwise). If fewer than two arguments
are given, this operation always returns a true value.
+.\" COMMAND: eq
.TP
\fBeq\fR ?\fIarg\fR ...?
.
Returns whether each argument is equal to the arguments on each side of it
using exact string comparison. If fewer than two arguments are given, this
operation always returns a true value.
+.\" COMMAND: !=
.TP
-\fB!=\fR \fIarg arg\fR
+\fB!=\fI arg arg\fR
.
Returns whether the two arguments are not equal to each other, in the sense of
the \fBexpr\fR != operator (\fIi.e.\fR, numeric comparison if possible, exact
string comparison otherwise).
+.\" COMMAND: ne
.TP
-\fBne\fR \fIarg arg\fR
+\fBne\fI arg arg\fR
.
Returns whether the two arguments are not equal to each other using exact
string comparison.
+.\" COMMAND: <
.TP
\fB<\fR ?\fIarg\fR ...?
.
@@ -205,6 +217,7 @@ otherwise performed using UNICODE string comparison. If fewer than two
arguments are present, this operation always returns a true value. When the
arguments are numeric but should be compared as strings, the \fBlt\fR
operator or the \fBstring compare\fR command should be used instead.
+.\" COMMAND: <=
.TP
\fB<=\fR ?\fIarg\fR ...?
.
@@ -215,6 +228,7 @@ otherwise performed using UNICODE string comparison. If fewer than two
arguments are present, this operation always returns a true value. When the
arguments are numeric but should be compared as strings, the \fBle\fR
operator or the \fBstring compare\fR command should be used instead.
+.\" COMMAND: >
.TP
\fB>\fR ?\fIarg\fR ...?
.
@@ -225,6 +239,7 @@ otherwise performed using UNICODE string comparison. If fewer than two
arguments are present, this operation always returns a true value. When the
arguments are numeric but should be compared as strings, the \fBgt\fR
operator or the \fBstring compare\fR command should be used instead.
+.\" COMMAND: >=
.TP
\fB>=\fR ?\fIarg\fR ...?
.
@@ -235,6 +250,7 @@ otherwise performed using UNICODE string comparison. If fewer than two
arguments are present, this operation always returns a true value. When the
arguments are numeric but should be compared as strings, the \fBge\fR
operator or the \fBstring compare\fR command should be used instead.
+.\" COMMAND: lt
.TP
\fBlt\fR ?\fIarg\fR ...?
.VS "8.7, TIP461"
@@ -243,6 +259,7 @@ after the first having to be strictly more than the one preceding it.
Comparisons are performed using UNICODE string comparison. If fewer than two
arguments are present, this operation always returns a true value.
.VE "8.7, TIP461"
+.\" COMMAND: le
.TP
\fBle\fR ?\fIarg\fR ...?
.VS "8.7, TIP461"
@@ -251,6 +268,7 @@ after the first having to be equal to or strictly more than the one preceding it
Comparisons are performed using UNICODE string comparison. If fewer than two
arguments are present, this operation always returns a true value.
.VE "8.7, TIP461"
+.\" COMMAND: gt
.TP
\fBgt\fR ?\fIarg\fR ...?
.VS "8.7, TIP461"
@@ -259,6 +277,7 @@ after the first having to be strictly less than the one preceding it.
Comparisons are performed using UNICODE string comparison. If fewer than two
arguments are present, this operation always returns a true value.
.VE "8.7, TIP461"
+.\" COMMAND: ge
.TP
\fBge\fR ?\fIarg\fR ...?
.VS "8.7, TIP461"
@@ -271,38 +290,44 @@ arguments are present, this operation always returns a true value.
.PP
The behaviors of the bit-wise operator commands (all of which only operate on
integral arguments) are as follows:
+.\" COMMAND: ~
.TP
-\fB~\fR \fInumber\fR
+\fB~\fI number\fR
.
Returns the bit-wise negation of \fInumber\fR. \fINumber\fR may be an integer
of any size. Note that the result of this operation will always have the
opposite sign to the input \fInumber\fR.
+.\" COMMAND: &
.TP
\fB&\fR ?\fInumber\fR ...?
.
Returns the bit-wise AND of each of the arbitrarily many arguments. Each
\fInumber\fR must have an integral value. If no arguments are given, the
result will be minus one.
+.\" COMMAND: |
.TP
\fB|\fR ?\fInumber\fR ...?
.
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.
+.\" COMMAND: ^
.TP
\fB^\fR ?\fInumber\fR ...?
.
Returns the bit-wise XOR 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.
+.\" COMMAND: <<
.TP
-\fB<<\fR \fInumber number\fR
+\fB<<\fI number number\fR
.
Returns the result of bit-wise shifting the first argument left by the
number of bits specified in the second argument. Each \fInumber\fR
must have an integral value.
+.\" COMMAND: >>
.TP
-\fB>>\fR \fInumber number\fR
+\fB>>\fI number number\fR
.
Returns the result of bit-wise shifting the first argument right by
the number of bits specified in the second argument. Each \fInumber\fR
@@ -310,13 +335,15 @@ must have an integral value.
.SS "LIST OPERATORS"
.PP
The behaviors of the list-oriented operator commands are as follows:
+.\" COMMAND: in
.TP
-\fBin\fR \fIarg list\fR
+\fBin\fI arg list\fR
.
Returns whether the value \fIarg\fR is present in the list \fIlist\fR
(according to exact string comparison of elements).
+.\" COMMAND: ni
.TP
-\fBni\fR \fIarg list\fR
+\fBni\fI arg list\fR
.
Returns whether the value \fIarg\fR is not present in the list \fIlist\fR
(according to exact string comparison of elements).