binaryA number system that contains two symbols, 0 and 1. Also known as base 2. addition is very like decimal addition, except that it carries on a value of 2 instead of a value of 10.
In decimal, if you add 8 + 2 you get 10. This gives the digit 0 and a carry of 1.
In binary addition, when you add 1 and 1 the result is 2. But since 2 is written as 10 in binary, we get the digit 0 and a carry of 1.
Therefore, in binary:
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 (which is 0 carry 1)
1 + 1 + 1 = 11 (which is 1 carry 1)
How do you work out a binary sum?
Adding two bytes
Sometimes a binary addition requires you to carry over values into the next highest place-value column, e.g. when finding the sum of the two bytes 0010 and 0111.
When adding two ones in the same column, the resulting value in the that column is 0, with 1 carried over:
The sume of the two bytes 0010 and 0111 is therefore 1001.
Overflow errors
An overflowAn overflow error is caused when the processor does not have enough bytes available to process an instruction. occurs when the total from adding binary numbers cannot be stored within the registers of a CPU. Consider an 8-bit processor – the largest number we can store in 8 bits is 11111111 (or 255).
If the result of the addition is greater than 255, an overflow error will occur as we do not have room to store the ninth bit. When this happens, the CPU drops the overflow digit because the computer cannot store it anywhere, and the computer thinks 255 + 1 = 0.
An example of an 8-bit overflow occurs in the binary sum 11111111 + 1 (denary: 255 + 1 = 256).
The CPU cannot store the ninth bit and will assume the result is 0.