This blog entry is in response to a email regarding the logic operations I received from jcroot on the Texas Instruments TI-36X Pro Review: (link here)
How are you today? I was just wondering if you could please give us an example of how to use the "Logic function" on this calculator, I am trying to follow the manual but I still can't understand in which situations this could be useful.
jcroot, I hope that this blog entry (at least in part) answers your question. I had to research a bit because I must confess that I do not use logic operators much on calculators.
The most common logic operators are: and, or, not, 2's compliment and xor. The TI-36X has two additional operators xnor and nand. The latter two are not common on calculators.
I tend to think binary numbers as the prime example for these logic operators. It is my understanding that the operators compare the binary form (base 2 integers) of an integer and if necessary, convert the answer back into the required form (decimal, hexadecimal, or octal).
Binary numbers are numbers consisting of 0 and 1, with each digit being a bit. Often, the bit 0 is referred to "off" or "false", while the bit 1 is referred to "on" or "true". Each bit resembles a power of 2, with powers of 2 increasing from right to left:
For example, if the first (rightmost bit) is 1, then the value "1" is turned on. If the second bit is 1, then the value "2" is turned on, the third bit gives a value of "4", fourth bit gives a value of "8", and so on. Binary numbers are often written with a subscript of 2. On calculators, they are often designated with b or a "#b".
On the TI-36X Pro
Change to BINary Mode: Press [mode], arrow down five times, select BIN, hit [enter], then [2nd] [mode] (quit). You can designate DECimal (normal - base 10), HEXadecimal (base 16), and OCTal (base 8) modes in a similar way.
Designate a binary number in any mode: type your binary number, [2nd] [ 9 ] (base n), select TYPE, select 2: b. This procedure is not necessary if you are in Binary Mode.
[2nd] [ 9 ] (base n) gives you access to conversions (CONV), designations (TYPE), and operations (LOGIC).
One Argument Logic Operators
not: This operator basically switches a bit. In binary numbers, if the bit is 0, then not 0 = 1. Similarly, if the bit is 1, then not 1 = 0.
2's Complement: This complement is a way to manipulate binary numbers such that the arithmetic, specifically addition and subtraction of binary numbers, is accurate. More information is found by clicking on this sentence.
Two Argument Logic Operators
The following logic operations answer different types of questions:
and: Are both bit 1 true and bit 2 true?
or (inclusive or): Is either bit 1 or bit 2 true? Bit 1 and bit 2 can both be true.
xor (exclusive or): Is either bit 1 true or bit 2 true - without both bits being true?
xnor (not exclusive or): The opposite of xor. Are both bits true or both bits false?
nand (not and): The opposite of and. Is at least one of the bits false?
The following table summaries and, or, xor, xnor, and nand.
How the TI-36X Works With Binary Numbers
All binary numbers work with 10 bit integers. Attempting to work integers greater than 10 bits causes a SYNTAX Error. This error is not mentioned in the TI-36X Manual.
The binary number of a TI-36X looks like this:
where # is a 0 or 1. If you enter less than 10 bits, the calculator "fills" the leftmost bits with 0. Note that I designated the leftmost bit (10th bit) red and bold. This is known as the sign bit. If this bit is 0, then the integer is positive.
(sign) (2^8) (2^7) (2^6) (2^5) (2^4) (2^3) (2^2) (2^1) (2^0)
0 [ 1 = "on", 0 = "off"]
However, if the leftmost bit (10th bit) is 1, then the integer is negative. I am not 100% sure how the rest of the bits are designated.
Note in all examples, I designate binary numbers with the "b", like the calculator does.
10001b = 0000010001b = 17
1111101111b = -17
For the TI-36X Pro, the boundary for binary integers in the interval [-511, 511].
(2^9 - 1 = 511) Remember, the 10th bit is the sign bit on this calculator.
When using logic operators, the TI-36X compares each bit, including the 10th bit.
By the way, binary integers can be stored and recalled in variables.
Let x = 0000011101b (5th, 4th, 3rd, and 1st bits are on, x = 29)
and y = 0000010100b (5th and 3rd bits are on, y = 20)
(decimal equivalents in parenthesis)
x and y = 0000010100b (29 and 20 = 20)
x or y = 0000011101b (29 or 20 = 29)
x xor y = 0000001001b (29 xor 20 = 9)
x xnor y = 1111110110b (29 xnor 20 = -10)
x nand y = 1111101011b (29 nand 20 = -21)
So, when I think of logic operations, I think of comparing binary numbers (or binary equivalent of integers) bit by bit, given a designated amount of bits.
Hope this helps,
This blog is property of Edward Shore. © 2012