After we explained about binary numbers, here’s how computers work with them.
Inside a computer, a wire with electricity running through it represents the digit 1, and when there’s no electricity it represents the digit 0. A single such digit is called a bit.
We can manipulate bits using logic gates. Here are 3 examples. Click the orange switches to see them in action.
The “And gate” outputs 1 if both its inputs are 1.
The “Or gate” outputs 1 if either of its inputs is 1.
The “Xor gate” outputs 1 if one of its inputs is 1, but not both.
Here’s how we can combine such gates to build an adding machine, or an Adder. Click the orange switches to see it work, and see explanation below.
The input to the adder are two numbers, each represented using two bits, or having two binary digits. So they can store a maximal value of binary “11”, which is 3 in decimal. The decimal value appears above each input.
These inputs are fed into a circuit of logic gates, which processes them according to the simple rules we defined above.
The output is made of three bits, or binary digits. Its decimal translation is shown below. You can verify that the output always equals the sum of the two inputs. This is a real working adder!
Next on our tour: some comments about bootstrapping and where this is referred to in the book.