Numeric Relational Operators
Numeric relational operators use the numeric values of the operands to produce a Boolean result. When operating on strings, a numeric relational operator treats each of the strings as its numeric value, according to the rules described in String-to-Number Conversion.
Numeric relational operators should not be used to compare non-numeric strings.
ObjectScript provides the following numeric relational operators:
Less Than Operator (<)
The less than operator tests whether the left operand is less than the right operand. For example:
WRITE 9 < 6 // 0
For details, see the Less Than (<) reference page.
Greater Than Operator (>)
The greater than operator tests whether the left operand is greater than the right operand. For example:
WRITE 15 > 15 // 0
For details, see the Greater Than (<) reference page.
Less Than or Equal To Operator (<= or '>)
The less than or equal to operator tests whether the left operand is less or equal to than the right operand. For example:
WRITE 9 <= 6 // 0
See the Less Than or Equal To (<= or '>) reference page.
Greater Than or Equal To Operator (>= or '<)
The greater than or equal to operator tests whether the left operand is greater than or equal to the right operand. For example:
WRITE 15 >= 15 // 1
See the Greater Than or Equal To (<= or '>) reference page.
Note:
InterSystems IRIS supports two representations of numbers: ObjectScript decimal floating-point (referred to as decimal format) and IEEE double-precision binary floating-point (referred to as $DOUBLE format, generally used for special purposes).
Less-than/greater-than comparisons between these formats are performed exactly, without rounding. However, equality comparisons between decimal and $DOUBLE numbers often yield unexpected results, and should be avoided. For further details, see Numeric Computing in InterSystems Applications.