Difference between revisions of "Bit.bxor"

From ComputerCraft Wiki
Jump to: navigation, search
Line 1: Line 1:
 
== Explanation ==
 
== Explanation ==
''XOR'' is similar to the ''OR'' gate, but the numbers can '''not''' be equal.
+
All bit operations operate in Binary numeral system [http://en.wikipedia.org/wiki/Binary_numeral_system].
(ex. (0,0)=0; (1,0)=1; (0,1)=1; (1,1)=0)
+
  
== Above 1 and Below 0 ==
+
So if you understand the basics than XOR is an EXCLUSIVE OR and like an OR with exclusion give:
I tried to research and work on numbers above 1, but it gets kind of confusing, at first it is simple(ex. (1,2)=3; (2,2)=0; (4,2)=6; (5,2)=7;), but then when you input (6,2) it equals 4. I tried working on this for half and hour with no luck. When I tried to work on numbers below 0 at first it was as confusing as above 1 and as simple as 0 and 1, but still a positive number. Then when I mixed negative and positive, I got 4294967295 from (-1,1). I didn't try to research it. So hopefully someone will edit this and explain how going above 1 works, and possibly include an equation or 2.
+
----
 +
01001011 (75)
 +
----
 +
<i>XOR</i>
 +
----
 +
00011000 (24)
 +
----
 +
<i>=</i>
 +
----
 +
01010011 (83)
 +
----
 +
 
 +
Bits are XOR`red sequentially.

Revision as of 10:39, 28 February 2012

Explanation

All bit operations operate in Binary numeral system [1].

So if you understand the basics than XOR is an EXCLUSIVE OR and like an OR with exclusion give:


01001011 (75)


XOR


00011000 (24)


=


01010011 (83)


Bits are XOR`red sequentially.