HP 48gII Advanced User's Reference Manual page 38

Graphing calculator
Hide thumbs Also See for 48gII:
Table of Contents

Advertisement

The comparison commands return 1. (true) or 0. (false) based on the comparison — or an expression that can
evaluate to 1. or 0.. The order of the comparison is "level 2 test level 1," where test is the comparison function.
All comparison commands except SAME return the following:
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.
!°%TEST% L
%AND%
%XOR%
%NOT%
AND, OR, and XOR combine two test results. For example, if 4 is stored in Y, Y 8 < 5 AND returns 1.. First, Y
8 < 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.
1-12 RPL Programming
Logical Functions
Keys
Programmable
Command
AND
%OR%
OR
XOR
NOT
Description
Returns 1. (true) only if both
arguments are true (0. otherwise).
Returns 1. (true) if either or both
arguments are true (0. otherwise).
Returns 1. (true) if either argument,
but not both, is true (0. otherwise).
Returns 1. (true) if the argument is 0
(false); otherwise, returns 0. (false).

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

49g+

Table of Contents