Topic Two (1.2): Internal Coding of Numbers

Introduction Icon.png Introduction

In this topic you will continue learning the basis of the different number systems, you will learn a new skill of binary addition and subtraction, while also expressing a denary/decimal number in Binary Coded Decimal (BCD) and vice versa.

You will also be able to describe practical applications where BCD is used.

By the end of this topic you should be able to:

  • Show an understanding of the basis of different number systems.
  • Perform binary addition and subtraction.
  • Describe practical applications where Binary Coded Decimal (BCD) and hexadecimal (HEX) are used.

Watch Icon.png Watch

WATCH – Signed Binary (Sign Magnitude and Twos Complement) (YouTube)

WATCH – Adding in Binary | Applying Mathematical Reasoning | Pre-Algebra | Khan Academy (YouTube)

WATCH – Binary Subtraction Tutorial (YouTube)

WATCH – HEX and BCD (YouTube) 

WATCH – What is BCD and Where is it Used? (YouTube)

Read & Make Notes Icon.png Read and Make Notes

Read pages 8 to 14 of the textbook. Ensure you make some notes and list examples as you read through. In particular, use the worked example 1.03 to see how you can convert twos complement binary numbers.

Read Icon.png Further Reading

READ – Number Systems (courses.cs.vt.edu)

Review Icon.png End of Topic Review

Work through exam style questions 1c,1d,1e and 4b on pages 24 and 25.

You may check your answers using the Module 1 Exam style answer sheet.

CHECK - Textbook Answers

Top Tip Icon.png Top Tip

Ensure that you understand the following before moving on to the next topic:

  • A byte has eight bits, so there are 28 = 256 different combinations allowing 256 different codes. But, for unsigned integers, the highest value is 256 – 1 because one of the codes represents 0.
  • In two’s complement representation of signed integers, the topmost bit is 0 for positive and 1 for negative values.
  • In two’s complement representation, the smallest magnitude negative number has all 1s. This can be explained by the fact that the corresponding denary value can be calculated by assigning a negative value to the most significant bit, and positive values to all remaining bits.
  • Just adding a leading zero to a binary value converts it to two’s complement.
  • Two’s complement values are self-complementary; applying the two’s complement conversion takes positive to negative or negative to positive.
  • You can add any number of leading zeros to a representation of a positive value without changing the value.
  • You can add any number of leading ones to a representation of a negative value without changing the value.
  • BCD coding does not fully utilise the four bits in a nibble.
  • Try and show all your working out. When converting it is a good idea to go from decimal to binary to hex (and vice versa).