1 of 10

8.2 Data Representation

  • L1 Today we are learning to understand how numbers can be represented in binary and carry out simple operations on binary numbers

  • Hawks: Know that computers transfer data in binary�
  • Falcons: Can perform simple operations using bit patterns e.g. binary addition�
  • Eagles: Can convert Binary numbers into decimal, hexadecimal and vice-versa�

2 of 10

How computers see the world

  • There are a number of very common needs for a computer, including the need to store and view data.

  • Computers use the binary number system, or base 2, because they have two electrical circuits. On and off are the two electrical circuits used in the operation of a computer system.

All data that we want a computer to process needs to be converted into this binary format.

3 of 10

What is binary?

  • Binary is a number system that only uses two digits: 1 and 0. All information that is processed by a computer is in the form of a sequence of 1s and 0s. Therefore, all data that we want a computer to process needs to be converted into binary.

The binary system is known as a ‘base 2’ system.

This is because:

there are only two digits to select from (1 and 0)

when using the binary system, data is converted using the power of two.

4 of 10

Converting from denary to binary

  • There is a very simple method to convert a denary number into a binary number.
  • Let’s take the number 84

5 of 10

Converting from binary to denary

  • To convert a binary number to denary, start by writing out the binary place values. In denary, the place values are 1, 10, 100, 1000, etc – each place value is 10 times bigger than the last. In binary, each place value is 2 times bigger than the last (ie increased by the power of 2). The first few binary place values look like this:

6 of 10

Try counting Binary using your fingers

7 of 10

Adding binary

  • When two numbers are added together in denary, we take the first number, add the second number to it and get an answer.
  • For example, 1 + 2 = 3.
  • When we add two binary 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 2)
  • 1 + 1 + 1 = 11 (binary for 3)
  • Try counting Binary using your fingers

8 of 10

Example

  • Let’s try adding together two binary numbers: 0101 0011 and 0111 0110.
  • To get to the answer, use the following method:

9 of 10

Overflow errors

  • Sometimes, when adding two binary numbers we can end up with an extra digit that doesn’t fit. This is called an overflow error.

10 of 10

Overflow errors

  • This sum is fine as the original numbers have two digits, and the result of the sum also has two digits.

  • This sum has an overflow error. The original numbers had two binary digits, but the answer is three binary digits long.

The effects of an overflow error can vary. It might make the program crash or it might just ignore the extra digit on the left and produce an unexpected result (in this case, 2 + 3 = 0!).