In this blog post, all numbers with a "b" after them are designated binary numbers. (the extra zeroes in front are for illustration purposes only)
XOR vs Addition
The logical operator XOR and addition may be very similar, but they are not the same.
1101b + 0110b = 10011b but 1101b XOR 0110b = 1011b
1001b + 0011b = 1100b but 1001b XOR 0011b = 1010b
Truth table for XOR (Exclusive OR):
1 XOR 1 = 0
1 XOR 0 = 1
0 XOR 1 = 1
0 XOR 0 = 0
XOR is like addition if we let 0 represent an even number and 1 represent an odd number:
odd + odd = even
even + odd = odd
odd + even = odd
even + even = even
AND vs Multiplication
Likewise, the logical operator AND and multiplication may be very similar, but they are not the same.
1101b × 0010b = 11010b but 1101b AND 0010b = 0000b
1100b × 1110b = 10101000b but 1100b AND 1110b = 1100b
Truth table for AND:
1 AND 1 = 1
1 AND 0 = 0
0 AND 1 = 0
0 AND 0 = 0
And likewise, AND is like addition if we let 0 represent an even integer and 1 represent an odd integer:
odd × odd = odd
odd × even = even
even × odd = even
even × even = even
Hopefully this clears any confusion up between arithmetic and two logic gates sometimes labeled as arithmetic. As always, love any comments and thanks as always.
This blog is property of Edward Shore. 2013
Wednesday, September 4, 2013
XOR vs Addition, AND vs Multiplication
Casio fx-CG 50 and HP Prime: The Price is Right Wheel Simulation Introduction On the very famous game show, The Price Is Right, c...
Casio fx-991EX Classwiz Review Casio FX-991EX The next incarnation of the fx-991 line of Casio calculators is the fx-991 EX. ...
One of the missing features of the TI-82/83/84 family is the ability to convert between bases. Here are two programs in TI-Basic to help...
HP Prime: Basic CAS Commands for Polynomials and Rational Expressions Define the following variables: poly: a polynomial o...