If neither object is an algebraic or a name, returns 1. if the two objects are the same type and have the same value, or 0. otherwise. For example, if 6 is stored in X, X 5 < puts 6 and 5 on the stack, then removes them and returns 0.. (Lists and programs are considered to have same value if the objects they contain are identical. For strings, “less than” means “alphabetically previous.”)

If one object is an algebraic (or name) and the other object is an algebraic (or name) or a number, returns an expression that must be evaluated to get a test result based on numeric values. For example, if 6 is stored in X, 'X' 5 < returns 'X<5', then →NUM returns 0..

(Note that == is used for comparisons, while = separates two sides of an equation.)

SAME returns 1. (true) if two objects are identical. For example, 'X+3' 4 SAME returns 0. regardless of the value of X because the algebraic 'X+3' is not identical to the real number 4. Binary integers must have the same wordsize and the same value to be identical. For all object types other than algebraics, names, and binary integers, SAME works just like ==.

You can use any comparison function (except SAME) in an algebraic by putting it between its two arguments. For example, if 6 is stored in X, 'X<5' →NUM returns 0..

Using Logical Functions

Logical functions return a test result based on the outcomes of one or two previously executed tests. Note that these four functions interpret any nonzero argument as a true result.

Logical Functions

Keys

Programmable

 

Description

 

Command

 

 

 

 

 

 

!°%TEST% L

 

 

 

 

 

 

%AND%

AND

Returns 1.

(true) only if both

 

 

 

 

arguments are true (0. otherwise).

%OR%

OR

Returns 1.

(true) if either or both

 

 

 

 

arguments are true (0. otherwise).

%XOR%

XOR

Returns 1.

(true) if either argument,

 

 

 

 

but not both, is true (0. otherwise).

%NOT%

NOT

Returns 1.

(true) if the argument is 0

 

 

(false); otherwise, returns 0. (false).

AND, OR, and XOR combine two test results. For example, if 4 is stored in Y, Y 8 < 5 AND returns 1.. First,

Y8 < returns 1. to the stack. AND removes 1. and 5 from the stack, interpreting both as true results, and returns 1. to the stack.

NOT returns the logical inverse of a test result. For example, if 1 is stored in X and 2 is stored in Y, X Y < NOT returns 0.

You can use AND, OR, and XOR in algebraics as infix functions. For example, '3<5 XOR 4>7' NUM returns 1.

You can use NOT as a prefix function in algebraics. For example, 'NOT Z‰4' →NUM returns 0. if Z = 2.

1-12 RPL Programming