Wa0000.
Wa0000.
Wa0000.
2024
NUMBER SYSTEMS
COURSE NAME: NATIONAL DIPLOMA:
FOUNDATION IT INFORMATION TECHNOLOGY
B TECH FINANCIAL INFORMATION SYSTEMS
All rights reserved. Apart from any fair dealing for the purpose of research criticism or review as permitted under
Copyright Act, no part of this document may be reproduced or transmitted in any other form or by any means, electronic
or mechanical, including photocopy and recording, without permission in writing from the publisher.
CFAF05D #.1
Chapter 1 Data Representation
Objectives: When you have completed this chapter, you should be able to:
understand and convert the decimal, binary, hexadecimal number systems.
1. Introduction
A computer is based on the most basic beginnings of 2 electronic states. The electronic circuits
of a computer can only be in one of two states: ‘on’ or ‘off’. A bit (binary digit) represents these
two states. There are therefore two values which a bit or binary digit can be, namely 0 and 1.
One could say that strings of ones and zeros are the mother tongue of the computer!
2. Grouping of bits
Computer manufacturers use a grouping of bits to represent letters, figures and special
characters such as? or +. A group of eight bits is called a byte.
A computer word is the number of bits that can be handled as a unit. The word length of
computers differs. In modern computers it is normally 32 or 64 bits.
3. Number systems
There are different number systems. The number system that is familiar to us is called the
decimal number system.
The decimal number system uses ten symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9) to represent
numbers. The decimal number system therefore has a base of 10.
The place of the figure determines its value. This concept is the same for all number systems.
The place values of the decimal number system are shown in the following table.
CFAF05D #.2
3.2 Expanded notation
By multiplying numbers with their place values, you can write numbers in expanded notation.
Examples:
5347,23110 = 5x103 + 3x102 + 4x101 + 7x100 + 2x10-1 + 3x10-2 + 1x10-3
702,0710 = 7x102 + 0x101 + 2x100 + 0x10-1 + 7x10-2
Take note: Since we are working with different number systems you must include the base to
ensure that everybody knows in which number system you are working. If you do not include
the base, marks will be deducted in this module.
Take note: The methods used in this module and these notes, will be the only methods
that will be marked. Indicate all steps to get full marks!
CFAF05D #.3
Example 3: Convert 100111,012 to a decimal number.
The conversions can also be done by writing the place values above each binary number and
then adding the place values, which are not zero together.
You must add decimal numbers, else your answer will be wrong!
You can test your answer by using the place value. Therefore, for Example 4 you can test
your answer as follows:
Step 1: Write down the place values of the binary number system. It is only necessary to
write down the place values smaller or equal to 510 and bigger or equal to 0,62510
Step 2: Start at the left-hand side of the decimal comma, and determine from left to right
what combination of place values make up the number 510
Place values 4 2 1
Number 1 0 1
1 + 4 = 510
Step 3: Start at the decimal comma and determine from right to left what combination of
place values make up the fraction 0,62510
CFAF05D #.4
Exercise
1. Convert the following binary numbers to decimal numbers.
2 90
2 45 r 0
2 22 r 1
2 11 r 0
2 5 r 1
2 2 r 1
2 1 r 0
0 r 1
2 137
2 68 r 1
2 34 r 0
2 17 r 0
2 8 r 1
2 4 r 0
2 2 r 0
2 1 r 0
0 r 1
CFAF05D #.5
Exercise
1. Convert the following decimal numbers to binary numbers.
The base of the hexadecimal number system is 16. Therefore the hexadecimal number system
consists of 16 different elements. The first 10 elements in the hexadecimal number system
are 0 to 9.
Because the elements of a number system must all be single symbols, the hexadecimal number
system uses the letters A, B, C, D, E and F as elements to represent the values 10 to 15. This
is shown in the table:
Decimal Hexadecimal
10 A
11 B
12 C
13 D
14 E
15 F
CFAF05D #.10
You can test your answer by using the place value.
Therefore 28510 =
11D16 You can test your answer by using the place value.
256 + 16 + 13 = 28510
Exercise
1. Convert the following hexadecimal numbers to decimal.
a) 2416 b) A216 c) 11016
d) B0316 e) AB1216 f) 1BCD16
Hexadecimal values are a shorter notation of the binary equivalent. The contents of files of
data are sometimes given in hexadecimal code. The conversion between the binary number
CFAF05D #.10
system and the decimal number system is very easy. Sometimes the hexadecimal code is
used for a
shorter notation than binary code.
Following the relationship between the place values of binary numbers and the hexadecimal
numbers, the conversion between this number system is very simple and quick. Each group
of four bits is replaced with a hexadecimal number.
1011 1001
1011 1001
B 9
A 3
1010 0011
CFAF05D #.10
Example 2: Convert 2C716 to a binary number.
2 C 7
0010 1100 0111
Zero’s in front of a number has no meaning;
therefore you do not need to write it down. It
2C716 = 10 1100 01112
is not wrong to leave it, i.e. 0010 1100 01112
CFAF05D #.10
Exercise
1. Convert the following binary numbers to hexadecimal.
CFAF05D 11
Chapter 2 Binary addition
1. Introduction
All data is represented in a computer in one of two conditions, zeros and one’s. To be able to
understand better how a computer works, it is useful to know how numbers are represented in a
computer.
Fewer mistakes are made when the correct data types are used in Turbo Pascal. When
programming in Pascal, it is important to know how the different types of data such as REAL,
INTEGER and LONGINT are represented in the computer.
In other programs such as a database, it is important to know that we get different data types, for
example, integers and real and that the internal representation differs.
Transfer 111
768
+475
1243
The following combinations exist when two single digit binary numbers are added:
0 0 1 1
+0 +1 +0 +1
0 1 1 1 0 (transfer of 1)
CFAF05D 12
Example 2: Calculate the following: 101112 + 1102
Transfer 11
10111
+ 110
1 1 1 012
Remember: 12 + 12 + 12 = 112
11101
When three or more numbers must be
+1 1 1
added, the chances of making a mistake becomes
100100
much smaller if the first two numbers are added and
+1 0 1 1
then the third one
1 0 1 1 1 12
To check whether the addition was correctly done, the numbers may be changed to decimals.
Exercise
1. Calculate the following:
CFAF05D 13
3. Internal representation of integers
Digital systems like computers must be able to represent positive and negative numbers. There
are three methods of representing positive and negative integers namely the
• sign-and-size code
• one’s complement
• two’s complement
Example 1: Use 1 byte to represent the numbers, -12 and 12, in the sign-and-size-code.
2 12
2 6 r0
2 3 r0
2 1 r1
0 r1
Therefore 1210 = 11002
Take note: One byte (7 bits + sign bit = 8 bits) is used throughout for the
representations.
One byte (7 bits + the sign bit = 8 bits) is used throughout for the representations.
Sign-and-size-code:
12 0 0 0 0 1 1 0 0
-12 1 0 0 0 1 1 0 0
Example 2: Convert the number -120 to the sign-and-size-code and represent it in 1 byte.
2 120
2 60 r0
2 30 r0
2 15 r0
2 7 r1
2 3 r1
2 1 r1
0 r1
Therefore 12010 = 11110002
Sign-and-size-code:
For readability and to
-12010 1 1 1 1 1 0 0 0 use a standard format
throughout, you must
We will write it as: -12010 = 1 1111 0002 write the sign bit, leave a
space followed by four
digits, a space, and the
remaining three digits. #.14
The sign-and-size method is not generally used in computers. This type of representation results
in problems when adding is done, as the sign bit must be handled separately from the rest of the
number.
Example 3: Add -12 to 12. (We have used the conversion in Example 1 to just add the two
numbers)
1 0001 100
+0 0001 100
1 0 0 1 1 0 0 02
The answer is -2410, which is wrong. We know the answer is 0. The two’s complement
representation solves this problem.
Exercise
1. Represent the following decimal numbers in the sign-and-size code. Use 1 byte for the
representation.
a) 6710 b) -3510 c) 9710
d) -12410 e) -12710 f) -11110
2. The following binary numbers are written in sign-and-size code. Write down the decimal
equivalent.
a) 0 0001 1012 b) 1 0111 0002 c) 0 0011 1012
d) 1 1101 1112 e) 1 0101 0102 f) 1 1111 1012
CFAF05D #.15
Take note: You should know now how to convert numbers. We will only give the answers
in the examples that follow.
CFAF05D #.16