HP Forums
Logical NOT - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Logical NOT (/thread-4111.html)



Logical NOT - Alberto Candel - 06-08-2015 01:32 AM

There seems to be an error with logical NOT (and other logicals) in CAS. The ToolBox shows "NOT" with capital letters, but when selecting it from CAS, transforms to lower case letters ("not"). In lower case in CAS it does not work (returns error).


RE: Logical NOT - Joe Horn - 06-08-2015 06:47 AM

(06-08-2015 01:32 AM)Alberto Candel Wrote:  There seems to be an error with logical NOT (and other logicals) in CAS. The ToolBox shows "NOT" with capital letters, but when selecting it from CAS, transforms to lower case letters ("not"). In lower case in CAS it does not work (returns error).

Lowercase "not" does work in CAS, but then it requires parentheses (contrary to what the help screen says), like this:

not(5) --> 0.
not(0) --> 1.

This split personality of NOT/not in CAS is also found in other functions, e.g. the XOR/xor function in CAS:

1 XOR 2 --> 0 (ok)
xor(1,2) --> 0. (ok)
1 xor 2 --> error
XOR(1,2) --> error

Needless to say, the HP Prime has many personality quirks, unlike us perfectly balanced humans. Wink


RE: Logical NOT - Alberto Candel - 06-08-2015 03:11 PM

Thank you for the illustration. Now that I look at your examples I see that there is some pattern to it: lower case uses functional form like xor(1,0) and upper case uses infix form 1 XOR 0.


RE: Logical NOT - Joe Horn - 06-10-2015 05:42 AM

(06-08-2015 03:11 PM)Alberto Candel Wrote:  Thank you for the illustration. Now that I look at your examples I see that there is some pattern to it: lower case uses functional form like xor(1,0) and upper case uses infix form 1 XOR 0.

That's sometimes true, but don't rely on it. For example, INTERSECT is vice versa: it only allows infix form when spelled in lowercase (CAS only), and prefix form when spelled in uppercase (both CAS and Home)! Another strange "case": CAS only allows prefix syntax for the AND function if it's spelled with mixed case: And(1,2). You really gotta try all three spelling variations for each function to be sure. And you can't memorize them either, because they sometimes change when the firmware is revised. And of course none of this is documented. PPL is a moving target wearing camouflage, which is fun when you're hunting for sport but frustrating when you're hunting to survive.


RE: Logical NOT - Alberto Candel - 06-10-2015 03:19 PM

There you go; I thought I had found something.
Thanks again!


RE: Logical NOT - compsystems - 06-10-2015 06:18 PM

1 OR 1 → true ok
1 OR 0 → true ok
2 OR 2 → true ok
-2 OR -2 → true ??? → false
true OR true → true ok
true OR false → true ok
true XOR false → 1 ??? → true
-1 XOR 1 → 1 ??? → true
NOT true → false
NOT false → true