You may already know that the standard PC works with 8-bit bytes. You may also know that processors and Windows software have progressed from 8 bits to 16 bits to 32 bits to 64 bits, by a multiple of 2 each time. What this means is that the computer can work on 1, 2, 4 or 8 bytes at once.
Computer math works using a principle known as Boolean algebra. It is really simple yet very powerful. George Boole, an English mathematician in the 19th century is the father of Boolean algebra. He devised the logic system that is used in digital computers today.
In Boolean algebra, standard addition and subtraction takes place using AND and OR logic gates. Here is the logic.
x OR y = z means z occurs if x or y is present.
x AND y = z means both x and y need to be present to get z.
Another type of logic gate is an XOR (eXclusive OR).
x XOR y=z means that x or y BUT NOT BOTH have to be present to get z.
That is about the entire math you need to understand how a computer does counting and additions.
With this logic, we make up little electronic circuits called gates that are built using electronic transistors. These then work on binary numbers stored in a register - a bit of memory. We can make an AND gate, an XOR gate, and an OR gate.
In decimal addition for example 9+5 we get 5 'units' and carry one to the 10s place, giving 10+5=15.
Binary numbers have bit values of 1,2,4,8 etc in decimal. We begin at 0 then 1 in the first bit position, the 1 bit. If we add 1 + 1 in binary we get the result 10 that has a 1 bit in the second bit position, and a 0 in the first, giving decimal 2+0 = 2. The second bit position is formed using a CARRY operation from the first bit.
In order to make an adding circuit called an adder, we can duplicate this logic with a logic circuit. To add 1+1 we need 3 inputs, one for each bit, and a carry in, and 2 outputs, one for the result (0 or 1), and a carry out (1 or 0). The carry input is not used in this case. We use 2 AND gates, 2 XOR gates and an OR gate to make up the adder for 1 bit.
Now we have a Logic Block called an ADDER. The computer is designed by using various combinations of such logic blocks. We might have logic blocks like a multiplier (a series of adders) and other components.
Our ADDER logic block takes one bit (0 or 1) from each number to be added, plus the Carry bit (0 or 1) and outputs a 0 or 1, and a carry of 0 or 1. A table of the inputs A, B and Carry, and output O and Carry, looks like this:-
With Carry in:
A B c O C
0 0 1 1 0
1 0 1 0 1
0 1 1 0 1
1 1 1 1 1
With no Carry in:
A B c O C
0 0 0 0 0
1 0 0 1 0
0 1 0 1 0
1 1 0 0 1
This type of table is known as a Truth Table, and the table shows the output state for any input state.
Let's see how the process works. Let us add 2+3 decimal. In binary this is 010 plus 011. We're gonna need 3 ADDER blocks for decimal bit values of 1, 2 and 4.
The first ADDER takes the Least Significant Bit from each number. Input A should be 0, input B should be 1 with no carry - 0.
From the truth table we see that this gives an output of 1 and a carry of 0 (3rd row). So BIT 1 RESULT = 1
The next ADDER has inputs of 1, 1 and a carry of 0, giving an output of 0 with a carry bit of 1 (4th row). So BIT 2 RESULT = 0
The next ADDER has inputs of 0, 0 and a carry of 1, giving an output of 1 with no carry - 0 (5th row). Therefore BIT 4 RESULT = 1.
Therefore, we have bits 4,2,1 as 101 or 4+1=5.
While this may seem like a laborious way to do a simple addition, remember that a computer can have 64 adders or more, able to add two large numbers billions of times a second. This is where it scores - in speed and accuracy.
Published by Stable Guy
- More Essential Windows FreewareThe article describes five 'nice to have' Windows applications that make tasks like photo editing, instant messaging and watching videos much easier.
- Windows XP: How to Network Your Home ComputersThis step-by-step tutorial will walk you through the process of home networking your Windows XP Computers.
- How Your Computer Works and Why You Should CareUnderstanding how your computer works will enable you to work and play smarter.
- Money Pulling - the Add-on Way
- Tinted Car Windows
- Windows XP Service Pack 2
- Windows Desktop Security Tips
- Apple Macintosh, Meet Microsoft Windows
- Computers in Medicine: What Can We Expect Next?
- My Initial Impressions of Windows Vista



