03-08-2020, 02:13 PM
Post: #1
 Eddie W. Shore Senior Member Posts: 1,122 Joined: Dec 2013
http://edspi31415.blogspot.com/2020/03/h...tions.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) BEGIN // not and Boolean Function RETURN  NOT (a AND b); END;

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) BEGIN // not or Boolean Function RETURN  NOT (a  OR  b); END;

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) BEGIN // equivalence, XNOR RETURN (NOT a AND NOT b) or (a AND b); END;

Implication (→)

A → B = (not A) or B

1100 1010 → 1110 0011
= (not 1100 1010) or 1110 0011
= 1111 0111

Code:
EXPORT IMPL(a,b) BEGIN // implication RETURN (NOT a) or b; END;
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)