Data representation - EduqasBinary addition

Binary data can represent numbers, graphics, sound and characters. It is then organised and manipulated differently. Data can also be stored in arrays, records or external files and go through validation or verification checks to ensure accuracy.

Part ofComputer ScienceUnderstanding Computer Science

Binary addition

When two numbers are added together in , take the first number and add the second number to it to get an answer. For example, 1 + 2 = 3.

When adding two numbers together the process is different.

There are four rules that need to be followed when adding two binary numbers. These are:

  • 0 + 0 = 0
  • 1 + 0 = 1
  • 1 + 1 = 10 (binary for denary 2)
  • 1 + 1 + 1 = 11 (binary for denary 3)

Example - calculate 01 + 10

1 + 0 = 1

0 + 1 = 1

Binary addition: 0 1 plus 1 0 equals 1 1

Result in binary: 11 (which is denary 3)

Example - calculate 01 + 101

1 + 1 = 0, carry 1

1 + 0 + 0 = 1

0 + 1 = 1

Binary addition: 0 1 plus 1 0 1 equals 1 1 0

Result in binary: 110 (which is denary 6)

Example - calculate 01010011 + 01110110

1 + 0 = 1

1 + 1 = 0, carry 1

1 + 0 + 1 = 0, carry 1

1 + 0 + 0 = 1

1 + 1 = 0, carry 1

1 + 0 + 1 = 0, carry 1

1 + 1 + 1 = 1, carry 1

1 + 0 + 0 = 1

Binary addition: 0 1 0 1 0 0 1 1 plus 0 1 1 1 0 1 1 0 equals 1 1 0 0 1 0 0 1

Result in binary: 11001001 (which is denary 201). You can check your answers by converting each binary number into denary and checking your addition. In this example, 01010011 is 83 in denary and 01110110 is 118 in denary. So, 83 + 118 is 201.

Overflow

For example, when using eight , the largest number that can be recorded is 11111111 (denary 255). When adding together two eight-bit numbers, a situation may occur when the result requires more than eight bits to hold it. For example, adding the binary numbers 11111110 (denary 254) and 00000010 (denary 2) would give:

Binary addition: 1 1 1 1 1 1 1 0 plus 0 0 0 0 0 0 1 0 equals 0 0 0 0 0 0 0 0

The result is actually 100000000 (denary 256), which requires nine bits. However, as only eight bits are available to hold the number, the result would be 00000000 (denary 0).

As you can see, overflow can have serious consequences for the validity of calculations.