
Appendix B 733
Expression Evaluator Functions
References
References
The following references apply to the numbers that appear in parentheses in table B-1.
1. Special rules apply when you use the comparison operators with strings. The strings
are compared, character by character, until an inequality is found. This becomes the
inequality of the strings. For example: 'ba' > 'abcd' and 'abcc' < 'abdc'. If string1 is longer
than string2, and if string1 and string2 are equal up to the length of the string2, then
string1 > string2 evaluates as TRUE.
2. The BOUND(varname) function returns the value TRUE if varname has been defined
(assigned a value) and FALSE if it has not been defined. The BOUND function is
defined as follows:
• BOUND (name of a defined variable) = TRUE
• BOUND (name of an undefined variable) = FALSE
• BOUND (numeric value of expression) = TRUE
• BOUND (string value of expressions) = TRUE
• BOUND (Boolean value of expression) = TRUE
For example
setvar a 6
calc bound(a) TRUE
deletevar a
calc bound(A) FALSE
calc bound(1+2) TRUE
calc bound('a'+'b') TRUE
calc bound(5<4) TRUE
In BOUND (expression), if expression is not a valid expression, an error message is
displayed
3. The circular shift operators, CSL and CSR, shift the specified number of bits in a 32-bit
word in the specified direction. When 1 or 0 is shifted off one end, it comes back onto the
other end. The logical shift operators, LSL and LSR, perform the same shifting as the
circular shift operators, but when 1 or 0 is shifted off one end, a 0 comes back at the
other end.
4. The modulo operation functions as it is defined by Donald E. Knuth, The Art of Computer
Programming, Addison-Wesley Publishing Co., Reading, MA; Second ed., 1973; Volume I,
p. 38.
5. The TYPEOF(expression) returns one of the following integer values:
• 0 if expression is invalid.
• 1 if expression evaluates to an integer.
• 2 if expression evaluates to a string.
• 3 if expression evaluates to a Boolean value.