next up previous contents
Next: Recognizer predicates for Up: CHAPTER.5: NUMERICAL AND Previous: Arithmetical operators

Infix predicates on numbers

Besides arithmetical operations that take numbers as arguments and produce numbers as results, Pop-11 includes various predicates for testing properties of numbers, or relations between numbers. These predicates all have boolean (i.e. true or false) results. The most widely used infix predicates are:

OPERATOR PRECEDENCE DESCRIPTION
    >       6       test two numbers: TRUE if first greater than second.
    <       6       test two numbers: TRUE if first less than second.
    >=      6       test two numbers: TRUE if first greater than or
                    equal to second.
    <=      6       test two numbers: TRUE if first less than or equal
                    to second.

    ==      7       Exact identity (i.e. the very same object in the
                    machine.)
    =       7       Equality: i.e. the same type of object with
                    equivalent contents.
    /==     7       Not identical
    /=      7       Not equal
    ==#     7       Same type of number and same numeric value.
                    (E.g. 8 = 8.0 is TRUE 8 ==# 8.0 false)
The rules for "=" and "/=" when the two arguments are of different types are quite complicated. If X and Y are of different types and are integers, bigintegers or ratios then they cannot be either "=" or "==". If floating point numbers (decimals and ddecimals) are compared with integers, bigintegers or ratios then they are first converted to ddecimals and then compared. Further details are given in HELP EQUAL and REF NUMBERS

What sort of thing is denoted by an arithmetical expression depends on the "top level" operator. E.g. consider:

    99 > (X + Y)
This takes the expression `99' and the expression `(X + Y)' each of which may denote a number, and creates a new expression which denotes true or false, depending on whether the first number is greater than or less than the other. I.e. > is a binary operator, taking two numbers and producing a TRUTH-VALUE, i.e. a BOOLEAN as a result. So

    99 > 66        denotes TRUE
    66 > 99        denotes FALSE


Aaron Sloman
Fri Jan 2 03:17:44 GMT 1998