|
| Previous: 2.6.5 Bit Operators | TOC | Index | Back | Next: 2.6.7 Conjunctions and Disjunctions |
Relational operators are used to compare two operands. The relation between the operands is expressed as a truth value: all these operators return truth (-1), if their meaning applies to their operands and otherwise they return falsity (0). The following relational operations exist (.X denotes the unsigned value of X):
| Operator | Description |
|---|---|
| A < B | A is less than B |
| A > B | A is greater than B |
| A <= B | A is less than or equal to B |
| A >= B | A is greater than or equal to B |
| A .< B | .A is less than .B |
| A .> B | .A is greater than .B |
| A .<= B | .A is less than or equal to .B |
| A .>= B | .A is greater than or equal to .B |
| A = B | A is equal to B |
| A \= B | A is not equal to B |
Note: the operators expressing equivalence (=, \=) have a lower precedence than operators expressing ordering (> , <, >=, <=, .<, .>, .<=, .>=). For example,
A < B = C < D
is equal to
(A<B) = (C<D)
Consequently, the equation sign may be interpreted as `logical equivalence' when used between comparisons: the above expression evaluates to true, if either
(A<B) AND (C<D)
or
\(A<B) AND \(C<D)
applies. Since the inequation operator \= has the same precedence as =, it may be used as a negative logical equivalence operator (aka an Exclusive OR):
A<0 \= B<0
becomes true, if either A or B is negative. If the truth values of the comparisons A<0 and B<0 are equal, the expression yields the result `false'.
Note that any value may be considered a truth value in T3X. Everything but the zero value is interpreted as `truth', and only 0 may be used to express the `false' value.
| Previous: 2.6.5 Bit Operators | TOC | Index | Back | Next: 2.6.7 Conjunctions and Disjunctions |