1.2.18

Binary Arithmetic

Test yourself

Binary Addition

We can add two binary numbers in exactly the same way as denary numbers.

Illustrative background for Adding two digitsIllustrative background for Adding two digits ?? "content

Adding two digits

  • If we add 0 + 0 we get 0.
  • If we add 1 + 0 (or 0 + 1) we get 1.
  • If we add 1 + 1, then we cannot use the symbol 2. So we need to carry the 1 and put 0 in the current place.
Illustrative background for Adding in a third bitIllustrative background for Adding in a third bit ?? "content

Adding in a third bit

  • It might be the case that we have 1 + 1 and also a 1 carried over from the previous column.
  • If this is the case, then we carry the 1 and have 1 left over.
    • So we carry 1 and put 1 in the current place.
Illustrative background for Overflow errorsIllustrative background for Overflow errors ?? "content

Overflow errors

  • Binary numbers are stored as a fixed length.
  • If a number is carried past the last place column, then this is called an overflow error.
  • Overflow errors can lead to inaccurate results and software crashes.

Binary Shifts

A binary shift is a technique for performing multiplication or division on a binary number.

Illustrative background for Binary shiftIllustrative background for Binary shift ?? "content

Binary shift

  • In a binary shift, each digit is moved one column to the left or the right.
  • Extra 0 bits are added to the start or end of the binary number to fill any missing spaces.
Illustrative background for Left binary shiftIllustrative background for Left binary shift ?? "content

Left binary shift

  • In a left binary shift, each digit is moved one place to the left.
    • This has the effect of multiplying the number by two.
  • You must take care, when performing a left shift, that there is no overflow error (where we run out of space to store the last digit of the number).
Illustrative background for Right binary shiftIllustrative background for Right binary shift ?? "content

Right binary shift

  • In a right binary shift, each digit is moved one place to the right.
    • This has the effect of dividing the number by two.
  • You must take care when performing a right shift that no data is shifted off the right hand side. This can cause a loss of accuracy.

Jump to other topics

1Computer Systems

1.1Systems Architecture

1.2Memory & Storage

1.3Computer Networks, Connections & Protocols

1.4Network Security

1.5Systems Software

1.6Ethical, Legal, Cultural & Environmental Concern

2Computational Thinking, Algorithms and Programming

Go student ad image

Unlock your full potential with GoStudent tutoring

  • Affordable 1:1 tutoring from the comfort of your home

  • Tutors are matched to your specific learning needs

  • 30+ school subjects covered

Book a free trial lesson