summaryrefslogtreecommitdiffstats
path: root/doc/expr.n
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-05-16 23:19:47 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-05-16 23:19:47 (GMT)
commit95a02f829d476464637599f39be7aeaa335c70ad (patch)
treed79282c7750a7c90c7b4fd1982f8818236915bf2 /doc/expr.n
parentb68b8009bd3e885e1b2b4b6204c92d9791ea6f1b (diff)
parent03716dfee8f0f0df26a8c56e6a2b3ceeb9319dbc (diff)
downloadtcl-95a02f829d476464637599f39be7aeaa335c70ad.zip
tcl-95a02f829d476464637599f39be7aeaa335c70ad.tar.gz
tcl-95a02f829d476464637599f39be7aeaa335c70ad.tar.bz2
[Bug 3525462]: Document what relational operators really do with string args.
Diffstat (limited to 'doc/expr.n')
-rw-r--r--doc/expr.n6
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/expr.n b/doc/expr.n
index 8d6a8ae..177e127 100644
--- a/doc/expr.n
+++ b/doc/expr.n
@@ -298,6 +298,7 @@ returns \fB4.0\fR, not \fB4\fR.
String values may be used as operands of the comparison operators,
although the expression evaluator tries to do comparisons as integer
or floating-point when it can,
+i.e., when all arguments to the operator allow numeric interpretations,
except in the case of the \fBeq\fR and \fBne\fR operators.
If one of the operands of a comparison is a string and the other
has a numeric value, a canonical string representation of the numeric
@@ -308,11 +309,10 @@ is that produced by the \fB%g\fR format specifier of Tcl's
\fBformat\fR command. For example, the commands
.CS
\fBexpr {"0x03" > "2"}\fR
-\fBexpr {"0y" < "0x12"}\fR
+\fBexpr {"0y" > "0x12"}\fR
.CE
both return 1. The first comparison is done using integer
-comparison, and the second is done using string comparison after
-the second operand is converted to the string \fB18\fR.
+comparison, and the second is done using string comparison.
Because of Tcl's tendency to treat values as numbers whenever
possible, it is not generally a good idea to use operators like \fB==\fR
when you really want string comparison and the values of the