1.1 Number systems

Show All Section Notes
Test yourself on Number systems 11 questions — drag-to-order, code completion, matching and multiple choice.
Start the quiz

Binary Addition and Overflow

Watch this lesson Video 1.1.4 · 8:00 · Adding bits, carrying, and what happens when a byte runs out of room

1. The Four Rules of Binary Addition

Binary addition follows the same logic as denary addition (carrying values to the next column), but you only have two digits to work with.

$0 + 0 = 0$
$0 + 1 = 1$
$1 + 1 = 10$
(0 carry 1)
$1 + 1 + 1 = 11$
(1 carry 1)

2. Addition Example

When adding binary numbers, always start from the Right (the Least Significant Bit).

 111     (Carries)
 01101010 (106)
+00011100 (28)
10000110 (134)

3. Overflow Errors

In IGCSE Computer Science, we usually work with 8-bit registers. An 8-bit register can store a maximum value of 255 ($11111111$).

Definition: An Overflow Error occurs when the result of a binary addition exceeds the maximum capacity of the register (e.g., the result needs 9 bits but only 8 are available).

Example of Overflow:

Attempting to add $150 + 150$ in an 8-bit register:

11       
  10010110 (150)
+ 10010110 (150)
100101100 (300)

The 9th bit (highlighted in red) has nowhere to go. The CPU simply drops it.

4. Consequences of Overflow

  • Data Loss: The computer "ignores" the extra bit, leading to an mathematically incorrect result (e.g., $150+150$ might appear to equal $44$).
  • System Crashes: In some cases, an unexpected overflow can cause a program to crash or behave unpredictably.
  • Security Risks: Hackers sometimes use "Buffer Overflows" to gain control of a system by forcing data into memory it shouldn't access.

5. Logical Binary Shifts

Shifting moves every bit left or right. Each place left multiplies a positive number by 2. Each place right divides it by 2 and throws away the remainder. Any bit pushed off the end is lost.

For worked examples and the limitations you need for the exam, see Logical Binary Shifts.

1 + 1 is 10, not 2!