Binary Numbers
Binary numbers are very simple. In ancient Egypt and China, people coded some kind of logic using binary numbers. Leibniz saw in this the mystery of God: it is something from which the World is created from nothing -> something. Creatio ex nihilo (Latin for "creation out of nothing").
- 0 - no light
- 1 - there is light
Binary/Boolean Logic
Boole compiled truth table later. AND, OR, NOT etc.
Useful Counter
This counter shows how to count in binary from numbers zero through thirty-one.
[0-3110]
Addition
Addition is performed with carry. If 1 + 1.
1 1 <- carry
10101 = 21
+
1110 = 14
------
100011 = 35
Addition Table:
0 | 1 | |
---|---|---|
0 | 1 | 1 |
1 | 1 | 10 |
Subtraction
0111 = 7
-
1010 = 10
----
1 1101 WTF?
Binary subtraction cannot subtract a large negative number from a small positive number (7-10)?????
You need to choose a different representation.
Subtraction with two's complement representation:
A - B = A + not B + 1