0% found this document useful (0 votes)
33 views33 pages

Digital Literacy II Notes

The document discusses number systems, their definitions, and types, including decimal, binary, octal, and hexadecimal systems. It outlines learning objectives for students, such as recognizing different number systems and performing conversions and arithmetic operations. Additionally, it explains the processes of coding, decoding, and encoding between these systems.

Uploaded by

terasapcommunity
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views33 pages

Digital Literacy II Notes

The document discusses number systems, their definitions, and types, including decimal, binary, octal, and hexadecimal systems. It outlines learning objectives for students, such as recognizing different number systems and performing conversions and arithmetic operations. Additionally, it explains the processes of coding, decoding, and encoding between these systems.

Uploaded by

terasapcommunity
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 33

Ministry of Higher Education Republic of Cameroon

Yaounde International Business School Peace – Work - Fatherland


YIBS – Yaounde
Department of Computer Engineering

TOPIC: GENERAL COMPUTER SCIENCE II


Chapter I : NUMBER SYSTEMS
Year : HND 1 (One) By: MVOGO BILEGUE Edouard

Since the early days of human civilization, people have been using their fingers, sticks and
other things for counting. As daily activities became more complex, the numbers became
more important in trade, time and distance, and in all other spheres of human life. It became
apparent that we needed more than our fingers and toes to keep track of the number in our
daily routine. In 3400 BC, the ancient Egyptians started using special symbols for writing the
numbers. This was a major advancement, because it reduced the number of symbols required.
However, it was difficult to represent large or small numbers by using such a graphical
approach.

Learning objectives

After studying this lesson, student should be able to:

 Recognize different types of number systems as they relate to computers.


 Identify and define unit, number, base/radix, positional notation, and most and least
significant digits as they relate to decimal, binary, octal, and hexadecimal number
systems.
 Add and subtract in binary, octal, and hexadecimal number systems.
 Convert values from decimal, binary, octal, hexadecimal, and binary-code decimal
number systems to each other and back to the other systems.
 Add in binary-coded decimal.

Contents
I. DEFINITIONS..............................................................................................................................2
II. BASE (OR RADIX) OF SYSTEM................................................................................................2
III. TYPES OF NUMBER SYSTEM..............................................................................................2
IV. CONVERSION BETWEEN NUMBER BASES.......................................................................5
V. ARITHMETIC OPERATIONS IN NUMBER SYSTEMS.........................................................12
EXERCISES................................................................................................Error! Bookmark not defined.
Topic: Number Systems 3 By MVOGO BILEGUE

I. DEFINITIONS

A number system defines a set of values that is used to represent quantity. The number
systems can be classified into two broad categories as follows:

 Nonpositional Number Systems: In ancient times, people used to count on their


fingers. When the fingers became insufficient for counting, stones, pebbles or sticks
were used to indicate the values. This method of counting is called the nonpositional
number system.
 Positional Number Systems: In positional number systems, the value of each digit in
a number is defined not only by the symbol, but also by the symbol's position.
Positional number systems have a base or radix. The positional number system, which
is currently used is called the decimal number system. This system is a base 10
system, that is, it contains 10 digits (0, 1, 2, 3, …, 8, 9). Apart from the decimal
number system, there are some other positional number systems such as binary
number system, octal number system and hexadecimal number system, each
having a radix of 2, 8 and 16, respectively. However, the principles, which are applied
to the decimal number system, are also applicable for the other positional number
systems.

II. BASE (OR RADIX) OF SYSTEM

In the number system, the base or radix tells the number of symbols used in the system.
Radix of the system is always expressed in decimal numbers. The base or radix of the
decimal system is 10. This implies that there are 10 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
Similarly, the system using three symbols 0, 1, 2 will be of base 3, four symbols will be of
base 4 and so on.

The base of a number system is indicated by a subscript (decimal number) and this will be
followed by the value of the number. The following are few examples:

 (7592)10 is of base 10 number system.


 (214)8 is of base 8 number system.
 (123)16 is of base 16 number system

III. TYPES OF NUMBER SYSTEM

Eventually, the number systems that are generally used by the computers are as follows:

• Decimal number system


• Binary number system
• Octal number system
• Hexadecimal number system
Topic: Number Systems 4 By MVOGO BILEGUE

Number System Radix Value Set of Digits Example


Decimal r = 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (25)10
Binary r=2 0, 1 (11001)2
Octal r=8 0, 1, 2, 3, 4, 5, 6, 7 (31)8
Hexadecimal r = 16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F (19)16
Table 1. Types of Number Systems

Factorisation.

Let consider the number N of n digits in base b written as follow: ( D ¿ ¿ n−1 … D 2 D 1 D 0)b ¿.
N can be also written
n −1
N=D n−1 b n−1+ …+ Di bi +…+ D2 b2 + D1 b1 + D0=∑ D i b i
0

III.1 Decimal Number System


The primary number system used is a base 10 number system or decimal number system,
which we use every day while counting. This number system includes 10 digits from 0 to 9.
Each digit in a base 10 number system represents units, which are ten times the units of the
digit to its right.

Example. Let’s consider the number 7954

7954=7 ×1000+ 9× 100+5 ×10+ 4


3 2 1
7 ×10 + 9× 10 +5 ×10 +4

III.2 Binary Number System


The computers do not use the 10 digits of the decimal system for counting and arithmetic
operations. Their CPU and memory are made up of millions of tiny switches that can be
either in the ON or OFF states. Two digits, 0 and 1, are used to refer for the two states of ON
and OFF, respectively.

In the binary number system with base 2, the weight of n th bit of the number from the right-
hand side (RHS) is nth bit × 2n−1.

The weighted values for each position are determined as follows:

27 26 25 24 23 22 21 20 2-1 2-2
128 64 32 16 8 4 2 1 0.5 0.25
Table 2. Decimal Binary Comparison

The problem with the binary system is that it takes a large number of digits to represent
numerical values. This system is not efficient in representing fractional values. It cannot
represent these values accurately and needs many digits to even come close to approximation

III.3 Octal Number System


Topic: Number Systems 5 By MVOGO BILEGUE

The octal or base 8 number system is commonly used in computers. The octal number
system, with its eight digits, '0', '1', '2', '3', '4', '5', '6' and '7', is a base 8 system.

III.4 Hexadecimal Number System


Hexadecimal is another number system that works exactly like the decimal and binary
number systems, except that the base is 16. Similar to the decimal number that represents a
power of 10, each hexadecimal number represents a power of 16. To represent the decimal
numbers, this system uses numbers from 0 to 9 and characters from A to F to represent
numbers from 10 to 15, respectively

Decimal Binary Octal Hexadecimal


1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
Topic: Number Systems 6 By MVOGO BILEGUE

Chapter II : CONVERSIONS

II. CONVERSION BETWEEN NUMBER BASES

We have discussed earlier that internally the computer uses binary numbers for data
representation, whereas externally it uses decimal numbers. However, any number in one
number system can be represented in any other number system. Conversion between number
systems can be classified into three types: Coding, decoding and encoding.

II.1. Coding
Coding is the conversion from decimal base (base 10) to any non-decimal base b (b ≠ 10 ¿.

IV.1.1 Coding of whole numbers

The method used for the conversion of a decimal number to a non-decimal base b is often
called the remainder method.

This method involves the following steps:

1. Begin by dividing the decimal number by b (the base of the number).


2. Note the remainder separately as the rightmost digit of the equivalent.
3. Continually repeat the process of dividing by b until the quotient is zero and keep
writing the remainders after each step of division (these remainders will less than b).
4. Finally, when no more division can occur, write down the remainders in the reverse
order (last remainder written first).

Examples: a) Determine the binary equivalent of (36) 10. b) Convert (671)10 into base 6, then
in Base 16.

2 Taking 6 Taking the 16 the reverse


36 remainders in 671 remainders in the 671 order, we have
111 5 41 15=F
18 0 the reverse reverse order, we
9 0 2 9 (670)10=(29F)16
9 0 order, we have have 0 2
4 1
4 1 2 0
2 0 (36)10=(100100)2 1 0 (670)10=(100105)6
1 0 0 1
0 1
Remainders
Taking the remainders in
Remainders

IV.1.2 Conversion of Decimal Fractions


Topic: Number Systems 7 By MVOGO BILEGUE

The method used for the conversion of decimal fractions is similar to the above technique
except that instead of division, the mathematical process of multiplication is used. Moreover,
instead of looking for a remainder, we will look for a whole number. This method involves
the following steps:

1. Multiply the decimal fraction by the base b.


2. If a whole number is generated, place that integer in that position, if not then place 0.
3. Remove the whole number and continue steps 1 and 2 with the fraction value until it
becomes 0.
4. Finally, when no more multiplication can occur, write down the remainders in the
downward direction (as shown by the arrow mark).

Examples:

a) Determine the binary equivalent of (0.375)10.

0.375 x 2 = 0.750 0
0.75 x 2 = 1.50 1
0.5 x 2 = 1.0 1
Finally, (0.375)10 = (0.011)2

b) Determine hexadecimal conversion of (671.175)10

We have already noticed in the previous question that (671)10 = (29F)16. Now let convert
(0.175)10 in base 16

0.175 x 16 = 2.8 2
0.8 x 16 = 12.8 C
0.8 x 16 = 12.8 C
....
Finally, (671.175)10 = (29F.2CCC...)16

II. 2. Decoding
To decode is convert from a non-decimal base b (b ≠ 10) to the decimal base (base 10).

II.2.1 Conversion of whole numbers

In this case, each digit of the binary number is multiplied by its weighted position, and each
of the weighted values is added together to get the decimal number.

Examples:

a) Convert 2358 into base 10.

The Process:
Above each of the digits in your number, list the power of the base that
Topic: Number Systems 8 By MVOGO BILEGUE

the digit represents. See the example on the left. It is now a simple
process of multiplication and addition to determine your base 10
number. In this example you have
Now simply add these values together.
5 x 80 = 5
5 + 24 + 128 = 157
3 x 81 = 24
Answer: 2358 = 15710
2 x 82 = 128
**Remember: any number to the zero power equals one.

b) Convert 10112 to base 10.

1 x 20 = 1
1 + 2 + 0 + 8 = 11
1 x 21 = 2
0 x 22 = 0
Answer: 10112 = 1110
1 x 23 = 8
c) Convert 1C416 to base 10.

4 x 160 = 4 4 + 192 + 256 = 452


C x 161 = 12 x 161 = 192
1 x 162 = 256 Answer: 1C416 = 45210

II.2.2 Conversion of non-decimal fractions to decimal fraction

The conversion of fractions is similar to the decimal numbers. The only difference is the
negative exponents, which are used to denote the negative powers of b. Here, instead of a
'decimal' point we have a 'binary' point. The exponential expressions of each fractional
placeholder are b-1, b-2, and in this way the exponent notation proceeds. The steps involved in
the conversion process are as follows:

1. Write the weight value of each bit of the non decimal fractional number.
2. Multiply the weighted position with the respective bit of the non decimal fractional
number.
3. Add all the weighted values to get the decimal number.

Examples:

a) Determine the decimal equivalent of (0.01101)2.

Thus, the decimal equivalent of (0.01101)2 is (0.40625)10.

b) Determine the decimal equivalent of (237.04)8.


Topic: Number Systems 9 By MVOGO BILEGUE

Sum of weight of all bits = 128 + 24 + 7 + 0 + 0.0625 = 159.0625

Thus, the decimal equivalent of (237.04)8 is (159.0625)10.

c) Determine the decimal equivalent of (45C.8BE3)16.

Sum of weight of all bits = 1024 + 80 + 12 +0.5 + .0429687 + .0034179 + .0000457=


1116.5464323

Thus, the decimal equivalent of (45C.8BE3)16 is (1116.5464323)10.

II.3. Encoding
Encoding is the conversion from a non-decimal base to a non-decimal base. Some special
cases would be distinguished.

II.3.1 Conversion of Binary to Hexadecimal

The conversion of an integer binary number to hexadecimal is accomplished by the following


steps:

1. Break the binary number into four-bit sections starting from the LSB to the MSB.
2. Convert the four-bit binary number to its hexadecimal equivalent.

For whole numbers, it may be necessary to add a zero to the MSB to complete a grouping of
four bits.

NOTE: By adding a zero, the MSB will not change the value of the binary number.

Examples:

a) Determine the hexadecimal equivalent of (101011110011011001)2

The hexadecimal equivalent of (101011110011011001)2 is (2BCD9)16.

b) Determine the hexadecimal equivalent of (1100001.101011110011)2.


Topic: Number Systems 10 By MVOGO BILEGUE

The hexadecimal equivalent of (1100001.101011110011)2 is (61.AF3)16.

II.3.2 Conversion of Hexadecimal to Binary

Converting a hexadecimal (base 16) number to a binary (base 2) number is a precise process.
Since a single digit in a hexadecimal number corresponds directly to a four-digit binary
number, to convert the hexadecimal number into its binary equivalent, the following steps are
involved:

1. Convert each hexadecimal digit to its four-bit binary equivalent.


2. Combine the four-bit sections by removing the spaces to get the binary number.

Examples:

a) Determine the binary equivalent of (5AF)16.

Combining the four bits of the binary-coded values, we have 010110101111.

Thus, the binary equivalent of (5AF)16 is (010110101111)2.

b) Determine the binary equivalent of (2B.6C)16.

Combining the four bits of the binary-coded values, we have 00101011.01101100.

Thus, the binary equivalent of (2B.6C)16 is (00101011.01101100)2.

II.3.3 Conversion of Octal to Hexadecimal

Octal and hexadecimal have certain relations with binary, that is, the first digit in octal
corresponds to the first three digits in its binary equivalent and so on. The same is true for
hexadecimal and this time each digit represents four binary digits. This makes the conversion
of octal to hexadecimal and vice versa quite easy. This conversion involves the following
steps:

1. Convert each octal digit to three-bit binary form.


2. Combine all the three-bit binary numbers.
3. Divide the binary numbers into the four-bit binary form by starting the first number
from the right bit to the first number from the left bit.
4. Finally, convert these four-bit blocks into their respective hexadecimal symbols.
Topic: Number Systems 11 By MVOGO BILEGUE

Examples:

a) Determine the hexadecimal equivalent of (2327)8.

Combining the three-bit binary blocks, we have 010011010111.

Dividing the group of binary numbers into the four-bit binary blocks and by converting these
blocks into their respective hexadecimal symbols, we have:

Thus, the hexadecimal equivalent of (2327)8 is (4D7)16.

b) Determine the hexadecimal equivalent of (31.57)8.

Combining the three-bit binary blocks, we have 011001.101111.

Dividing the group of binary numbers into the four-bit binary blocks and by converting these
blocks into their respective hexadecimal symbols, we have:

Thus, the hexadecimal equivalent of (31.57)8 is (19.BC)16.

II.3.4 Conversion of Hexadecimal to Octal

This conversion follows the same steps of octal to hexadecimal conversion except that each
hexadecimal digit is converted into a four-bit binary form and then after grouping of all the
four bit binary blocks, it is converted into the three-bit binary form. Finally, these three-bit
binary forms are converted into octal symbols.

Examples:

a) Determine the octal equivalent of (5DE247)16.

Combining all the four-bit binary blocks, we have 010111011110001001000111.

Dividing the group of binary numbers into the three-bit binary blocks and by converting these
blocks into their respective octal symbols, we have:
Topic: Number Systems 12 By MVOGO BILEGUE

Thus, the octal equivalent of (5DE247)16 is (27361107)8.

b) Determine the octal equivalent of (7B.64D)16.

Combining all the four-bit binary blocks, we have 01111011.011001001101.

Dividing the group of binary numbers into the three-bit binary blocks and by converting these
blocks into their respective octal symbols, we have:

Thus, the hexadecimal equivalent of (7B.64D)16 is (173.3115)8


Topic: Number Systems 13 By MVOGO BILEGUE

Chapter III : ARITHMETICS OPERATIONS

I. ARITHMETIC OPERATIONS IN NUMBER SYSTEMS

I.1 Binary addition


 0+0=0
 0+1=1
 1+0=1
 1 + 1 = 0, and carry 1 to the next more significant bit

Examples,

a) 00011010 + 00001100 = 00100110 b) 00010011 + 00111110 = 01010001

1 1 carries 1 1 1 1 1 carries
0 0 0 1 1 0 1 0 = (26)10 0 0 0 1 0 0 1 1 = (19)10
+0 0 0 0 1 1 0 0 = (12)10 +0 0 1 1 1 1 1 0 = (62)10
0 0 1 0 0 1 1 0 = (38)10 0 1 0 1 0 0 0 1 = (81)10

I.2 Binary Subtraction


Rules of Binary Subtraction

0‐0=0
0 ‐ 1 = 1, and borrow 1 from the next more significant bit
1‐0=1
1‐1=0

a) 00100101 ‐ 00010001 = 00010100 ‐ 00010110 = (22)10


Examples,

00011101 = (29)10
1 borrows

‐ 00010001 = (17)10
00100101 = (37)10

00010100 = (20)10

b) 00110011 ‐ 00010110 = 00011101

11 borrows
00110011 = (51)10
Topic: Number Systems 14 By MVOGO BILEGUE

I.3 Binary Multiplication


The multiplication process for binary numbers is similar to that for
decimal numbers. Partial products are formed, with each product shifted
one place to the left. This is illustrated below.

Rules of Binary Multiplication


Example, a) 111 x 101
b) 101001 × 110 = 11110110
101001 = (41)10
× 110 = (6)10
000000
101001
101001
11110110 = (246)10

I.4 Binary division


Binary division follows a similar process to that of decimal division.
Example: Divide (a) (15)10by (5)10 in binary form, and (b) (15)10 by (6)10 in binary form.

I.5 Operation in octal and hexadecimal


For the other bases, the process is the same. The following table below show table those
various operations in different basis.
Octal addition octal multiplication (Base 8)

x 1 2 3 4 5 6 7
1 1 2 3 4 5 6 7
2 2 4 6 10 12 14 16
3 3 6 11 14 17 22 25
4 4 10 14 20 24 30 34
5 5 12 17 24 31 36 43
6 6 14 22 30 36 44 52
7 7 16 25 34 43 52 61
Topic: Number Systems 15 By MVOGO BILEGUE

Hexadecimal Addition Table

1
+ 1 2 3 4 5 6 7 8 9 A B C D E F
0
1 1
1 2 3 4 5 6 7 8 9 A B C D E F
0 1
1 1 1
2 3 4 5 6 7 8 9 A B C D E F
0 1 2
1 1 1 1
3 4 5 6 7 8 9 A B C D E F
0 1 2 3
1 1 1 1 1
4 5 6 7 8 9 A B C D E F
0 1 2 3 4
1 1 1 1 1 1
5 6 7 8 9 A B C D E F
0 1 2 3 4 5
1 1 1 1 1 1 1
6 7 8 9 A B C D E F
0 1 2 3 4 5 6
1 1 1 1 1 1 1 1
7 8 9 A B C D E F
0 1 2 3 4 5 6 7
1 1 1 1 1 1 1 1 1
8 9 A B C D E F
0 1 2 3 4 5 6 7 8
1 1 1 1 1 1 1 1 1 1
9 A B C D E F
0 1 2 3 4 5 6 7 8 9
1 1 1 1 1 1 1 1 1 1 1
A B C D E F
0 1 2 3 4 5 6 7 8 9 A
1 1 1 1 1 1 1 1 1 1 1 1
B C D E F
0 1 2 3 4 5 6 7 8 9 A B
1 1 1 1 1 1 1 1 1 1 1 1 1
C D E F
0 1 2 3 4 5 6 7 8 9 A B C
1 1 1 1 1 1 1 1 1 1 1 1 1 1
D E F
0 1 2 3 4 5 6 7 8 9 A B C D
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
E F
0 1 2 3 4 5 6 7 8 9 A B C D E
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
F
0 1 2 3 4 5 6 7 8 9 A B C D E F
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2
0 1 2 3 4 5 6 7 8 9 A B C D E F 0

Hexadecimal Multiplication Table

* 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 1 2 3 4 5 6 7 8 9 A B C D E F
Topic: Number Systems 16 By MVOGO BILEGUE

2 0 2 4 6 8 A C E 10 12 14 16 18 1A 1C 1E
3 0 3 6 9 C F 12 15 18 1B 1E 21 24 27 2A 2D
4 0 4 8 C 10 14 18 1C 20 24 28 2C 30 34 38 3C
5 0 5 A F 14 19 1E 23 28 2D 32 37 3C 41 46 4B
6 0 6 C 12 18 1E 24 2A 30 36 3C 42 48 4E 54 5A
7 0 7 E 15 1C 23 2A 31 38 3F 46 4D 54 5B 62 69
8 0 8 10 18 20 28 30 38 40 48 50 58 60 68 70 78
9 0 9 12 1B 24 2D 36 3F 48 51 5A 63 6C 75 7E 87
A 0 A 14 1E 28 32 3C 46 50 5A 64 6E 78 82 8C 96
B 0 B 16 21 2C 37 42 4D 58 63 6E 79 84 8F 9A A5
C 0 C 18 24 30 3C 48 54 60 6C 78 84 90 9C A8 B4
D 0 D 1A 27 34 41 4E 5B 68 75 82 8F 9C A9 B6 C3
E 0 E 1C 2A 38 46 54 62 70 7E 8C 9A A8 B6 C4 D2
F 0 F 1E 2D 3C 4B 5A 69 78 87 96 A5 B4 C3 D2 E1

II. REPRESENTATION OF NEGATIVE BINARY NUMBER

We have just seen how to carry out arithmetic operations on positive numbers. We are going
to see here different ways of representing negative numbers in binary. Usually a given
computer uses a fixed number of bits for storing integers. So we use terms such as 8-bits
integer, 16-bits integers, ... Whatever the principle remains the same, the only difference is
that with more bits, we can store wider range of number. In general, with n bits, one can store
2n numbers.

II.1 Signed and unsigned numbers


A binary number may be positive or negative. Generally, we use the symbol “+” and “-” to
represent positive and negative numbers, respectively. The sign of a binary number has to be
represented using 0 and 1, in the computer. An n-bit signed binary number consists of two
parts – sign bit and magnitude. The left most bit, also called the Most Significant Bit (MSB)
is the sign bit. The remaining n-1 bits denote the magnitude of the number.

The rules for signed and unsigned binary numbers are simple and are explained as follows:

• In an unsigned number, the MSB is a weighted position bit.


• In a signed number, the MSB (the sign bit) is 0 for a positive number.
Topic: Number Systems 17 By MVOGO BILEGUE

• In a signed number, the MSB (the sign bit) is 1 for a negative number.

For example, 01100011 is a positive number since its sign bit is 0, and, 11001011 is a
negative number since its sign bit is 1. An 8-bit signed number can represent data in the range
-128 to +127 (-27 to +27-1). In general, using n bits, the range of integer we can store using
two’s complement is -2n-1 to 2n-1

II.2 Complements
The complement of a number is the number, which when added to the original will make it
equal to a multiple of the base number system.

The complement of a number can be used as a representation of that number as a negative and
as a positive number that represents a negative. It is a method, which can be used to make the
subtraction easier for machines. Consequently, complements are used in the digital computers
for simplifying the subtraction operation and for the logical operation.

For every base r system, there are two types of complements: rs complement and (r – 1)s
complement.

• For decimal r = 10, we have 9s and 10s complement.


• For binary r = 2, we have 1s and 2s complement.
• For octal r = 8, we have 7s and 8s complement.
• For hexadecimal r = 16, we have 15s and 16s complement.

There are two types of complements for the binary number system – 1’scomplement and
2’scomplement.

II.2.1 The 1s Complement

To form the negative of any number, first complement all the bits of that number. This result
is known as the 1s complement of the original number. This requires changing every logic 1
bit in a number to logic 0, and every logic 0 bit to logic 1.

For instance

• 1’s complement of 110 is 001


• 1’s complement of 1011 is 0100
• 1’s complement of 1101111 is 0010000

II.2.2 The 2s Complement

We do not just place 1 in the MSB of a binary number to make it negative. We must take the
2s complement of the number. Taking the 2s complement of the number will cause the MSB
to become 1. Using n bits, the range of integer we can store using two’s complement is -2n-1 to
2n-1-1

To obtain the 2s complement of a number, there is a two-step process:


Topic: Number Systems 18 By MVOGO BILEGUE

1. Take the 1s complement of the number by changing every logic 1 bit in the number to
logic 0 bit, and change every logic 0 bit to logic 1 bit.
2. Add 1 to the 1s complement of the binary number. Now, we have the 2s complement
of the original number. Here, we can notice that the MSB has become 1.

For instance,

• 2’s complement of 110 is 001 + 1 = 010


• 2’s complement of 1011 is 0100 + 1 = 0101
• 2’s complement of 1101111 is 0010000 + 1 = 0010001

II.3 Binary Data Representation


A binary number may also have a binary point, in addition to the sign. The binary point is
used for representing fractions, integers and integer-fraction numbers. There are two ways of
representing the position of the binary point in the register - fixed point number representation
and floating point number representation.

• The fixed point number representation assumes that the binary point is fixed at one
position. The binary point is not actually present in the register, but its presence is
assumed based on whether the number which is stored is a fraction or an integer.
• The floating point number representation uses two registers. The first register stores
the number without the binary point. The second register stores a number that
indicates the position of the binary point in the first register.

We shall now discuss representation of data in the fixed point number representation and
floating point number representation.

I.3.1 Fixed Point Number Representation

The integer binary signed number is represented as follows –

• For a positive integer binary number, the sign bit is 0 and the magnitude is a
positive binary number.
• For a negative integer binary number, the sign bit is 1. The magnitude is represented
in any one of the three ways-
 Signed Magnitude representation -The magnitude is the positive binary
number itself.
 Signed 1’s complement representation- The magnitude is the 1’s complement
of the positive binary number.
 Signed 2’s complement representation- The magnitude is the 2’s complement
of the positive binary number.

The table below shows the representation of the signed number 18.
Topic: Number Systems 19 By MVOGO BILEGUE

Signed magnitude and signed 1’s complement representation are seldom used in computer
arithmetic.

Representation Comparison for 8-bit Binary Numbers

I.3.2 Floating Point Number Representation

We are familiar with the fact that any number can be written as a fraction multiplied by 10 to
some power. For instance

123 can be written as 0.123 x 103


0.0187 can be written as 0.187 x 10-1
-57.3 can be written as -0.573 x 102

In the first example we can identify


(a) A Sign (not shown explicitly since it is positive)
(b) A fractional part 0.123 (called the mantissa)
(c) The base 10
(d) An exponent,

We can identify similar components fo3r the other two examples. Note that all the examples
have the common base, 10, thus if the base is understood, we can represent any number by
specifying its sign, mantissa and exponent. (-, 0.573, 2) refers to -0.573 x 102

The similar method is used for representing real numbers on a computer. The base varies from
one machine to another. But the common bases are 2, 10 and 16. In order to keep things
simple, we assume that 8 bits are to be used to store a floating point number, and that the base
2 is understood. Let’s then assume the following:
Topic: Number Systems 20 By MVOGO BILEGUE

- 1 bit for the sign (0 for positive, 1 for negative)


- 4 for the mantissa
- 3 for the exponent

Our floating number representation should have the following format

S E M

We will note the following

- The sign bit is 0 for a positive number and 1 for a negative number
- The mantissa is to be treated as a binary fraction, where the binary point is assumed to
be placed immediately in front of the leftmost bit. Thus the mantissa 1001 is taken to
mean the binary fraction 0.1001
- The exponent is stored using ‘sign and magnitude’. With 3 bits the range of exponent
is -3 to +3. -3 is stored as 111 and +3 is stored as 011

Examples

(1) What floating number is represented by 001011010


- The sign is positive
- The mantissa is 1010 represented the number 0.1010
- The exponent is 010 which represent 2

Therefore the number represented is 0.1010 x22 = (10.10)2 = (2.5)10

(2) What is the binary representation of (-2.75)10

(2.75)10 = (10.11)2 = (0.1011)2 x 22

- The sign is negative, hence 1


- The exponent is two, 010
- The mantissa is 1011

The representation of the number is then: 10101011

Features of the floating point representation

(a) A zero is represented by 0 000 0000


(b) The smallest positive number is represented by 0 111 0001. The value represented is
1
(0.0001)2 x 2-3 = (0.0000001)2 = = (0.0078125) 10
128
(c) The largest positive number is represented by 0 011 1111. The value represented is
(0.1111)2 x 23 = (111.1)2 = (7.5)10
(d) The range of numbers which can be represented is -7.5 to +7.5
Topic: Number Systems 21 By MVOGO BILEGUE

III. ADDITION-SUBTRACTION OF SIGNED NUMBERS USING 2S


COMPLEMENT ADDITION

Let’s now perform arithmetic operations on the signed binary numbers. We use the signed 2’s
complement representation to represent the negative numbers.

III.1 Addition of signed binary numbers


The addition of any two signed binary numbers is performed as follows -

 Represent the positive number in binary form.(For e.g., +5 is 0000 0101 and +10 is
0000 1010)
 Represent the negative number in 2’s complement form. (For e.g., -5 is 1111 1011 and
-10 is 1111 0110)
 Add the bits of the two signed binary numbers.
 Ignore any carry out from the sign bit position.

Please note that the negative output is automatically in the 2’s complement form. We get the
decimal equivalent of the negative output number, by finding its 2’s complement, and
attaching a negative sign to the obtained result.

Let’s understand the addition of two signed binary numbers with the help of some examples.

Example 1: Add (27)10 and (−11)10 using complementary representation for the negative
value.

Binary form of (27)10 = (011011)2 and of (11)10 = (001011)2

Get the 2s complement of (001011) = 1s complement of (001011) + 1


= 110100 + 1
= 110101
Add (011011)2 and (110101)2

Hence, the result is (010000)2 or (16)10.

Example 2. Add (-5)10 and (-10)10 using 2’s complement.

• We represent -5 in 2’s complement form, i.e., 1111 1011.


• We represent -10 in 2’s complement form, i.e., 1111 0110.
• Add the two numbers. The result is 1111 0001. The result is in 2’s complement form.
Topic: Number Systems 22 By MVOGO BILEGUE

To find the decimal equivalent of the result 1111 0001- Find the 2’s complement of 1111
0001, i.e., 0000 1110 + 1 = 0000 1111. This is binary equivalent of +15. Attaching a negative
sign to the obtained result gives us -15.

Example 3. Add +5 and -10.

We represent +5 in binary form, i.e., 0000 0101. We represent -10 in 2’s complement form,
i.e., 1111 0110. Add the two numbers. The result is 1111 1011. The result is in 2’s
complement form.

To find the decimal equivalent of the result 1111 1011 – Find the 2’s complement of 1111
1011, i.e., 0000 0100 + 1 = 0000 0101. This is binary equivalent of +5. Attaching a negative
sign to the obtained result gives us -5.

III.2 Subtraction of signed binary numbers

The subtraction of signed binary numbers is changed to the addition of two signed
numbers. For this, the sign of the second number is changed before performing the addition
operation.

 (-A) – (+B) = (-A) + (-B) (+B in subtraction is changed to –B in addition)


 (+A) – (+B) = (+A) + (-B) (+B in subtraction is changed to –B in addition)
 (-A) – (-B) = (-A) + (+B) (-B in subtraction is changed to +B in addition)
 (+A) – (-B) = (+A) + (+B) (-B in subtraction is changed to +B in addition)
We see that the subtraction of signed binary numbers is performed using the addition
operation.
The hardware logic for the fixed point number representation is simple, when we use 2’s
complement for addition and subtraction of the signed binary numbers.
Topic: Number Systems 23 By MVOGO BILEGUE

IV. BINARY CODING SCHEME

The alphabetic data, numeric data, alphanumeric data, symbols, sound data and video data, all
are represented as combination of bits in the computer. The bits are grouped in a fixed size,
such as 8 bits, 6 bits or 4 bits. A code is made by combining bits of definite size. Binary
Coding schemes represent the data such as alphabets, digits 0-9, and symbols in a standard
code. A combination of bits represents a unique symbol in the data. The standard code enables
any programmer to use the same combination of bits to represent a symbol in the data.

The binary coding schemes that are most commonly used are

 Binary Coded Decimal (BCD)


 American Standard Code for Information Interchange (ASCII)
 Extended Binary-coded Decimal Interchange Code (EBCDIC)
 Unicode

IV.1 Binary Coded Decimal (BCD)


Binary Coded Decimal (BCD) is a method of using binary digits to represent the decimal
digits 0–9. A decimal digit is represented by four binary digits. The BCD coding is the binary
equivalent of the decimal digit. BCD system was developed by the IBM (International
Business Machines) corporation. In this system, each digit of a number is converted into its
binary equivalent rather than converting the entire decimal number to its binary form.
Similarly, letters and special characters can be coded in the binary form.

Let us determine the BCD value for the decimal number 5319. Since there are four digits in
the decimal number, there are four bytes in the BCD number. They are:

Binary code decimal digits (0–9) are represented by using four bits. The valid combinations of
bits and their respective values are shown in the table below.

Table. Binary-coded Decimal


Topic: Number Systems 24 By MVOGO BILEGUE

To represent the signs + and -, any of the remaining 4 bits patterns can be used. One
convention uses 1010 for + and 1011 for -. You can see that in one byte we can have either 2
digits or a sign and one digit. Here we must use the full 4-bits representation of any digit
(including the leading 0s). Thus the BCD representation of 5319 is 0101001100011001 and
not 101001100011001

IV.2 Extended Binary-coded Decimal Interchange Code (EBCDIC)


Once upon a time IBM invented EBCDIC. EBCDIC is an acronym for Extended Binary
Coded Decimal Interchange Code. It is a single byte (8 bit) character encoding standard that
is used in the IBM mainframe environment. IBM didn't invent just one version of EBCDIC
either but several different incompatible versions. The computing friendly and user friendly
thing would have been to use the already in existence ASCII standard.

 The Extended Binary Coded Decimal Interchange Code(EBCDIC) uses 8 bits (4 bits
for zone, 4 bits for digit) to represent a symbol in the data.
 EBCDIC allows 28= 256 combinations of bits.
 256 unique symbols are represented using EBCDIC code. It represents decimal
numbers (0-9), lower case letters (a-z), uppercase letters (A-Z), Special characters, and
Control characters (printable and non-printable e.g. for cursor movement, printer
vertical spacing etc.).
 EBCDIC codes are used, mainly, in the mainframe computers.

IV.3 American Standard Code for Information Interchange (ASCII)


The name ASCII is an acronym for: American Standard Code for Information Interchange.
It is a character encoding standard developed several decades ago to provide a standard way
for digital machines to encode characters.

Some important things to note about ASCII code:

 ASCII codes are of two types –ASCII-7 and ASCII-8.


 ASCII-7is a 7-bit standard ASCII code. In ASCII-7, the first 3 bits are the zone bits
and the next 4 bits are for the digits. ASCII-7 allows 2 7= 128 combinations. 128
unique symbols are represented using ASCII-7. ASCII-7 has been modified by IBM to
ASCII-8.
 ASCII-8is an extended version of ASCII-7. ASCII-8 is an 8-bit code having 4 bits for
zone and 4 bits for the digit. ASCII-8 allows 2 8= 256 combinations. ASCII-8
represents 256 unique symbols. ASCII is used widely to represent data in computers.
 The ASCII-8 code represents 256 symbols.
o Codes 0 to 31 represent control characters (non-printable), because they are used
for actions like, Carriage return (CR), Bell (BEL) etc.
o Codes 48 to 57 stand for numeric 0-9.
o Codes 65 to 90 stand for uppercase letters A-Z.
Topic: Number Systems 25 By MVOGO BILEGUE

o Codes 97 to 122 stand for lowercase letters a-z.


o Codes 128-255 are the extended ASCII codes.

IV.4 Unicode
Unicode is a computing industry standard for the consistent encoding, representation and
handling of text expressed in most of the world's writing systems. Developed in conjunction
with the Universal Character Set standard and published in book form as The Unicode
Standard, the latest version of Unicode contains a repertoire of more than 110,000 characters
covering 100 scripts.

• Unicode is a universal character encoding standard for the representation of text which
includes letters, numbers and symbols in multi-lingual environments. The Unicode
Consortium based in California develops the Unicode standard.
• Unicode uses 32 bits to represent a symbol in the data.
• Unicode allows 232= 4164895296 (~ 4 billion) combinations.
• Unicode codes can uniquely represent any character or symbol present in any language
like Chinese, Japanese etc. In addition to the letters; mathematical and scientific
symbols are also represented in Unicode codes.
• An advantage of Unicode is that it is compatible with the ASCII-8 codes. The first 256
codes in Unicode are identical to the ASCII-8 codes.
• Unicode is implemented by different character encodings. UTF-8 is the most
commonly used encoding scheme. UTF stands for Unicode Transformation Format.
UTF-8 uses 8 bits to 32 bits per code.

If you wish to see the Unicode character encoding in MS-Word 2007, do as follows-
< >. A Symbol dialog box will appear which displays the symbols, and the character codes in
a coding scheme, as shown in Figure 1.
Topic: Number Systems 26 By MVOGO BILEGUE

APPENDIX: The ASCII and EBCDIC Tables

The following is the ASCII and EBCDIC translation tables. In addition to the ASCII and
EBCDIC values the following tables include the decimal, hexadecimal and binary values.

DEC HEX EBCDIC ASCII BINARY DEC HEX EBCDIC ASCII BINARY
000 00 NUL NUL 0000 0000 016 10 DLE DLE 0001 0000
001 01 SOH SOH 0000 0001 017 11 DC1 DC1 0001 0001
002 02 STX STX 0000 0010 018 12 DC2 DC2 0001 0010
003 03 ETX ETX 0000 0011 019 13 DC3 DC3 0001 0011
RES/
004 04 SEL EOT 0000 0100 020 14 DC4 0001 0100
ENP
005 05 TAB ENQ 0000 0101 021 15 NL NAK 0001 0101
006 06 RNL ACK 0000 0110 022 16 BS SYN 0001 0110
007 07 DEL BEL 0000 0111 023 17 POC ETB 0001 0111
008 08 GE BS 0000 1000 024 18 CAN CAN 0001 1000
009 09 SPS TAB 0000 1001 025 19 EM EM 0001 1001
010 0A RPT LF 0000 1010 026 1A UBS SUB 0001 1010
011 0B VT VT 0000 1011 027 1B CU1 ESC 0001 1011
012 0C FF FF 0000 1100 028 1C IFS FS 0001 1100
013 0D CR CR 0000 1101 029 1D IGS GS 0001 1101
014 0E SO SO 0000 1110 030 1E IRS RS 0001 1110
ITB/
015 0F SI SI 0000 1111 031 1F US 0001 1111
IUS
Topic: Number Systems 27 By MVOGO BILEGUE

DEC HEX EBCDIC ASCII BINARY DEC HEX EBCDIC ASCII BINARY
032 20 € Space 0010 0000 048 30 0 0011 0000
033 21 SOS ! 0010 0001 049 31 1 0011 0001
034 22 FS " 0010 0010 050 32 SYN 2 0011 0010
035 23 WUS # 0010 0011 051 33 IR 3 0011 0011
BYP/
036 24 $ 0010 0100 052 34 PP 4 0011 0100
INP
037 25 LF % 0010 0101 053 35 TRN 5 0011 0101
038 26 ETB & 0010 0110 054 36 NBS 6 0011 0110
039 27 ESC ' 0010 0111 055 37 EOT 7 0011 0111
040 28 SA ( 0010 1000 056 38 SBS 8 0011 1000
041 29 SFE ) 0010 1001 057 39 IT 9 0011 1001
042 2A SM/SW * 0010 1010 058 3A RFF : 0011 1010
043 2B CSP + 0010 1011 059 3B CU3 ; 0011 1011
,
044 2C MFA (comma 0010 1100 060 3C DC4 < 0011 1100
)
045 2D ENQ - 0010 1101 061 3D NAK = 0011 1101
046 2E ACK . 0010 1110 062 3E > 0011 1110
047 2F BEL / 0010 1111 063 3F SUB ? 0011 1111

DEC HEX EBCDIC ASCII BINARY DEC HEX EBCDIC ASCII BINARY
064 40 Space @ 0100 0000 080 50 & p 0101 0000
065 41 RSP A 0100 0001 081 51 é Q 0101 0001
066 42 â B 0100 0010 082 52 ê R 0101 0010
067 43 ä C 0100 0011 083 53 ë S 0101 0011
068 44 à D 0100 0100 084 54 è T 0101 0100
069 45 á E 0100 0101 085 55 í U 0101 0101
070 46 ã F 0100 0110 086 56 î V 0101 0110
071 47 å G 0100 0111 087 57 ï W 0101 0111
072 48 ç H 0100 1000 088 58 ì X 0101 1000
073 49 ñ I 0100 1001 089 59 ß Y 0101 1001
074 4A ¢ J 0100 1010 090 5A ! Z 0101 1010
075 4B . K 0100 1011 091 5B $ [ 0101 1011
076 4C < L 0100 1100 092 5C * \ 0101 1100
077 4D ( M 0100 1101 093 5D ) ] 0101 1101
078 4E + N 0100 1110 094 5E ; ^ 0101 1110
079 4F | O 0100 1111 095 5F ¬ _ 0101 1111
Topic: Number Systems 28 By MVOGO BILEGUE

DEC HEX EBCDIC ASCII BINARY DEC HEX EBCDIC ASCII BINARY
096 60 - ` 0110 0000 112 70 ø p 0111 0000
097 61 / a 0110 0001 113 71 É q 0111 0001
098 62 Â b 0110 0010 114 72 Ê r 0111 0010
099 63 Ä c 0110 0011 115 73 Ë s 0111 0011
100 64 À d 0110 0100 116 74 È t 0111 0100
101 65 Á e 0110 0101 117 75 Í u 0111 0101
102 66 Ã f 0110 0110 118 76 Î v 0111 0110
103 67 Å g 0110 0111 119 77 Ï w 0111 0111
104 68 Ç h 0110 1000 120 78 Ì x 0111 1000
105 69 Ñ i 0110 1001 121 79 ` y 0111 1001
106 6A ¦ j 0110 1010 122 7A : z 0111 1010
,
107 6B k 0110 1011 123 7B # { 0111 1011
(comma)
108 6C % l 0110 1100 124 7C @ | 0111 1100
109 6D _ m 0110 1101 125 7D ' } 0111 1101
110 6E > n 0110 1110 126 7E = ~ 0111 1110
111 6F ? o 0110 1111 127 7F " DEL 0111 1111

DEC HEX EBCDIC ASCII BINARY DEC HEX EBCDIC ASCII BINARY
128 80 Ø € 1000 0000 144 90 DLE 1001 0000
129 81 a 1000 0001 145 91 j 1001 0001
130 82 b 1000 0010 146 92 k 1001 0010
131 83 c 1000 0011 147 93 l 1001 0011
132 84 d 1000 0100 148 94 m 1001 0100
133 85 e 1000 0101 149 95 n 1001 0101
134 86 f 1000 0110 150 96 0 1001 0110
135 87 g 1000 0111 151 97 p 1001 0111
136 88 h 1000 1000 152 98 q 1001 1000
137 89 i 1000 1001 153 99 r 1001 1001
138 8A 1000 1010 154 9A 1001 1010
139 8B 1000 1011 155 9B 1001 1011
140 8C 1000 1100 156 9C Æ 1001 1100
141 8D ý 1000 1101 157 9D 1001 1101
142 8E 1000 1110 158 9E æ 1001 1110
143 8F 1000 1111 159 9F Ÿ 1001 1111

DEC HEX EBCDIC ASCII BINARY DEC HEX EBCDIC ASCII BINARY
160 A0 1010 0000 176 B0 ^ 1011 0000
161 A1 ~ 1010 0001 177 B1 £ 1011 0001
162 A2 s ¢ 1010 0010 178 B2 ¥ 1011 0010
163 A3 t £ 1010 0011 179 B3 1011 0011
Topic: Number Systems 29 By MVOGO BILEGUE

164 A4 u 1010 0100 180 B4 1011 0100


165 A5 v ¥ 1010 0101 181 B5 1011 0101
166 A6 w ¦ 1010 0110 182 B6 1011 0110
167 A7 x 1010 0111 183 B7 1011 0111
168 A8 y 1010 1000 184 B8 1011 1000
169 A9 z © 1010 1001 185 B9 1011 1001
170 AA 1010 1010 186 BA [ 1011 1010
171 AB 1010 1011 187 BB ] » 1011 1011
172 AC ¬ 1010 1100 188 BC 1011 1100
173 AD Ý 1010 1101 189 BD 1011 1101
174 AE ® 1010 1110 190 BE 1011 1110
175 AF 1010 1111 191 BF 1011 1111

DEC HEX EBCDIC ASCII BINARY DEC HEX EBCDIC ASCII BINARY
192 C0 { À 1100 0000 208 D0 } 1101 0000
193 C1 A Á 1100 0001 209 D1 J Ñ 1101 0001
194 C2 B Â 1100 0010 210 D2 K Ò 1101 0010
195 C3 C Ã 1100 0011 211 D3 L Ó 1101 0011
196 C4 D Ä 1100 0100 212 D4 M Ô 1101 0100
197 C5 E Å 1100 0101 213 D5 N Õ 1101 0101
198 C6 F Æ 1100 0110 214 D6 O Ö 1101 0110
199 C7 G Ç 1100 0111 215 D7 P 1101 0111
200 C8 H È 1100 1000 216 D8 Q Ø 1101 1000
201 C9 I É 1100 1001 217 D9 R Ù 1101 1001
202 CA Ê 1100 1010 218 DA Ú 1101 1010
203 CB ô Ë 1100 1011 219 DB û Û 1101 1011
204 CC ö Ì 1100 1100 220 DC ü Ü 1101 1100
205 CD ò Í 1100 1101 221 DD ù Ý 1101 1101
206 CE ó Î 1100 1110 222 DE ú 1101 1110
207 CF õ Ï 1100 1111 223 DF ÿ ß 1101 1111

DEC HEX EBCDIC ASCII BINARY DEC HEX EBCDIC ASCII BINARY
224 E0 \ à 1110 0000 240 F0 0 1111 0000
225 E1 á 1110 0001 241 F1 1 ñ 1111 0001
226 E2 S â 1110 0010 242 F2 2 ò 1111 0010
227 E3 T ã 1110 0011 243 F3 3 ó 1111 0011
228 E4 U ä 1110 0100 244 F4 4 ô 1111 0100
229 E5 V å 1110 0101 245 F5 5 õ 1111 0101
230 E6 W æ 1110 0110 246 F6 6 ö 1111 0110
231 E7 X ç 1110 0111 247 F7 7 1111 0111
232 E8 Y è 1110 1000 248 F8 8 ø 1111 1000
233 E9 Z é 1110 1001 249 F9 9 ù 1111 1001
Topic: Number Systems 30 By MVOGO BILEGUE

234 EA ê 1110 1010 250 FA ú 1111 1010


235 EB Ô ë 1110 1011 251 FB Û û 1111 1011
236 EC Ö ì 1110 1100 252 FC Ü ü 1111 1100
237 ED Ò í 1110 1101 253 FD Ù ý 1111 1101
238 EE Ó î 1110 1110 254 FE Ú 1111 1110
239 EF Õ ï 1110 1111 255 FF Ÿ ÿ 1111 1111

EXERCISES

MCQ

1. Choose the correct answer from below for the result of the binary multiplication 1101 ×
110.
(a) 1001111, (b) 1010110, (c) 1001110, (d) 1011111.
2. Choose the correct answer from below for the result of the binary division 11011 ÷ 1001.
(a) 10, (b) 101, (c) 11, (d) 110.
3. Which of the following is the binary product 1001 × 111?
(a) 110111 (b) 111111, (c) 111011, (d) 111110.
4. Which of the following is the binary product 1101 × 1011?
(a) 10101111, (b) 10001111, (c) 10101011, (d)
10111011.
5. Which of the following is the binary division 10101 ÷ 11?
(a) 100, (b) 110, (c) 101, (d) 111.
6. Which of the following is the binary division 100011 ÷ 1010?
(a) 10.1, (b) 11.11, (c) 11.01, (d) 11.1.

Exercise 1.
(a) Convert the binary number 1011 into decimal form.
(b) Convert the binary number 1.011 into decimal form.
(c) Convert the numbers 15 and 12 into binary form, add the two binary numbers together and
convert the answer to decimal form to check that the sum is correct.
(d) Convert the numbers 9 and 6 into binary form. Use this to find 9 − 6 in binary form.
Check that the answer is correct by converting the binary answer into decimal form.

Exercise 2.
In each of the questions below, a product is written in decimal form. In each case, convert
both numbers to binary form, multiply them in binary form and check that the solution is
correct by converting the answer to decimal form. (Click on the green letters for solutions.)
(a) 3 × 2, (b) 4 × 4, (c) 5 × 10, (d) 6 × 7, (e) 9 × 6, (f) 11 × 7

Exercise 3.
Topic: Number Systems 31 By MVOGO BILEGUE

In each of the questions below, a division is written in decimal form. In each case, convert
both numbers to binary form, perform the division in binary form and check that the solution
is correct by converting the answer to decimal form. (Click on the green letters for solutions.)
(a) 6 ÷ 2, (b) 8 ÷ 2, (c) 9 ÷ 3, (d) 10 ÷ 4, (e) 21 ÷ 7, (f) 18 ÷ 8.

STRUCTURAL
Ex 1
1) Using Sign and magnitude, what range of integer can be stored using 6 bits, 8 bits, 16
bits.
2) Using 6 bits, give the sign and magnitude representation of 14, -15, 31, -17
3) Using 6 bits, give the two complement representation of: 15, -28, 31, -1

Ex 2
1) What is the BCD representation of (a) 215 (b) -215 (c) 2001
2) What numbers are represented by the following bit strings assume that when there is a
sign, it is represented by the first 4 bits with the convention 1010 for + and 1011 for -.
(a) 10101100100110111 (c) 1001100000000010
(b) 10110011011110010100 (d) 1010010101011011

Ex 3
1) What is the smallest and the largest floating point value which may be represented
using the representation described in the note?
2) What floating point numbers are represented by
(a) 1 001 1100 d) 1 100 0101
(b) 0 101 1100 e) 1 111 1111
(c) 0 000 1000 f) 0 010 1110
3) Using the representation described in the note, give the floating point representation of
each of the following. State whether the representation is exact or not. If inexact
calculate the error in the representation.
(a) 5.25 (d) 7.35 (g) -7.7
(b) 2.1875 (e) -3.3 (h) 1.115
(c) -4.5 (f) 6.256 (i) -3.75

Ex 4: Numbers are stored in an 8-bits byte of a computer in a normalized floating point


representation as follow:

S M E

- S is the sign (0 for positive and 1 for negative)


Topic: Number Systems 32 By MVOGO BILEGUE

- M is the mantissa with binary point assumed to be just before the leftmost bit
- E is the exponent (a power of two) stored as a two’s complement integer
(a) What are the largest and the smallest positive value which may be represented?
(b) Give, in binary form, the best possible representation of the values 0.875 and -1.4,
indicating the actual value stored in each case.
(c) What is the smallest positive number which may be represented if the mantissa is
allowed to be unnormalized

Ex 5 A certain computer uses 11-bits words for storing a floating point number:
- 1 bit represent the sign, S; 0 for positive and 1 for negative
- The exponent, E, is a 4-bits value, stored in 2’s complement form
- The mantissa, M, is a 6-bits normalized value, with the binary point assumed to be just
in front of the leftmost bit.

Give the representation of : 0.3, 7.3 and 6.375, Stating the error in each representation.

Ex 5
(a) What is the lowest possible value for an 8-bit signed magnitude binary number?
(b) What is the highest possible value for a 10-bit 2's complement binary number?

Ex 6
1) Convert each of the following decimal values to 8-bit 2's complement binary.
a) 5410 b) –4910 c) –12810 d) –6610 e) –9810

2) Convert each of the following 8-bit 2's complement binary numbers to decimal.
a) 100111012 b) 000101012 c) 111001102 d) 011010012

Ex 7
1) Convert each of the following decimal values to 8-bit signed magnitude binary.
a) 5410 b) –4910 c) –12710 d) –6610 e) –9810

2) Convert each of the following 8-bit signed magnitude binary numbers to decimal.
a) 100111012 b) 000101012 c) 111001102 d) 011010012

Ex 8: Using 1’s and 2’s complements perform the following subtractions


a. 100110 – 11011 c. 1101010 – 110100
b. 10011.1101 – 101.11 d. 1010 - 11011

Ex 9: Find the following differences using 2’s complement arithmetic. First convert decimal
values to corresponding binary values. Next, find the two’s complement representation of the
subtrahend. Add the minuend and 2’s complemented subtrahend. Check your answers.
a) 12 – 6 b) 4 – 6 c) 3.125 – 6.5 d) 67.25 – 83.125
Topic: Number Systems 33 By MVOGO BILEGUE

You might also like