Advanced Boolean Functions - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: HP Prime Software Library (/forum-15.html) +--- Thread: Advanced Boolean Functions (/thread-14617.html) |
Advanced Boolean Functions - Eddie W. Shore - 03-08-2020 02:13 PM http://edspi31415.blogspot.com/2020/03/hp-prime-advanced-boolean-functions.html Integer Types on the HP Prime On the HP Prime, the integer type is used for Boolean function calculations. Symbolize integer types by preceding it by a hashtag # and designated a letter at the end of the integer: b for binary, o for octal, d for decimal, and h for hexadecimal. Example: #11010b represents the binary number 11010. You can specify the bit size, from 1 to 64, by attaching a colon and bit size in between the integer and it's indicator. Example: #11010:8b represents the 11010 in an 8-bit format. You can specify the default size in the Home Settings. NAND (Not And) The function NAND is also known as the Shaffer function. nand(A, B) = not(A and B) nand(1100 1010, 1110 0011) = not(1100 1010 and 1110 0011) = 0011 1101 Code: EXPORT NAND(a,b) NOR (Not Or) The function NOR is also known as the Peirce function. nor(A, B) = not(A or B) nor(1100 1010, 1110 0011) = not(1100 1010 or 1110 0011) = 0001 0100 Code: EXPORT NOR(a,b) Equivalence (←→), XNOR A ←→ B = (not A and not B) or (A and B) 1100 1010 ←→ 1110 0011 = 1100 1010 xnor 1110 0011 = (not 1100 1010 and not 1110 0011) or (1100 1010 and 1110 0011) = 1101 0110 Code: EXPORT XNOR(a,b) Implication (→) A → B = (not A) or B 1100 1010 → 1110 0011 = (not 1100 1010) or 1110 0011 = 1111 0111 Code: EXPORT IMPL(a,b) |