You are on page 1of 42

TOPIC 2:

NUMBERING
SYSTEMS
REPRESENTATION

TCS1063: COMPUTER
ORGANIZATION & ARCHITECTURE
NUMBERING SYSTEMS

Data
• Binary number and other binary-coded
information

Information
• Data that has been processed or organized
• Data been processed into a meaningful and
useful form
• Data types

Numeric data Logical data


• Used in arithmetic computations • Used by operations OR, AND,
COMPLEMENT,
• To set or test conditions

Single-bit data Alphanumeric data


• Used by operations SET, CLEAR and • Used for string manipulations by
TEST. instructions  MOVE and SEARCH
Decimal Number (Base10)
• Number consisting the digits of 0,1,2,….,9
• Examples: 4410 and 104710

• Leftmost digit  the Most Significant Digit (MSD)


• Rightmost digit  the Least Significant Digit (LSD)
Binary Number (Base2)
• Number consists of 0 and 1
• Examples : 10012 and 110112

Octal Number (Base8)


• Number consisting the digits of 0,1,2,….,7
• Examples : 2078 and 1008
Decimal Hexadecimal
Hexadecimal Number (Base 16) 0 0
• Number consisting of the digits : 1 1
0,1,2,…,9 . .
. .
• The values larger than 9 will be . .
replaced by alphabets A, B, C, D, 9 9
E and F 10 A
11 B
12 C
13 D
14 E
15 F
Decimal Binary Octal Hexadecimal
0 0000 0 0
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
CONVERSION BETWEEN BASES
Binary To Decimal Conversion
Example 1:
Convert 10011112 into decimal number
=(1 X 26)+(0 X 25)+(0 X 24)+( 1X 23)+(1 X 22)+(1 X 21)+(1 X 20)
=64 + 0 + 0 + 8 + 4 + 2 + 1
=7910
Example 2:
Convert 11.0112 into decimal number
= (1 X 21) + (1 X 20) + (0 X 2-1) + (1 X 2-2) + (1 X 2-3)
= 2 + 1 + 0 + 1/4 + 1/8
= 3 3/810
Octal To Decimal Conversion
Example 1:
Convert 12138 into decimal number
= (1 X 83) + (2 X 82) + (1 X 81) + (3 X 80)
= 512 + 64 + 8 + 3
Example 2:
= 58710
Convert 1.1238 into decimal number
= (1 X 80) + (1 X 8-1) + (2 X 8-2) + (3 X 8-3)
= 1 + 1/8 + 2/64 + 3/512
= 1 83/51210
Hexadecimal To Decimal Conversion

Examples 1:
Convert 6CF16 into decimal number
= (6 X 162) + (C X 161) + (F X 160)
= (6 X 162) + (12 X 161) + (15 X 160)
= 1536 + 192 + 15
= 174310
Decimal Into Binary Conversion
Example 1: Convert 4410 into binary number
2 44 0 LSB 44 ÷ 2 = 22 balance 0
2 22 0 22 ÷ 2 = 11 balance 0 4410 = 1011002
2 11 1 11 ÷ 2 = 5 balance 1
2 5 1 5 ÷ 2 = 2 balance 0
2 2 0 2 ÷ 2 = 1 balance 1
2 1 1 MSB 1 ÷ 2 = 0 balance 1
0
Example 2: What is the value of 37.687510 in binary?
37.6875 is a decimal number with decimal points.

37 . 6875

Integer number Decimal point


a. Convert 3710 to binary
2 37 1 LSB
2 18 0
2 9 1
2 4 0
2 2 0
2 1 1 MSB

0 3710 = 1001012
b. Convert .6875
Decimal Into Octal Conversion
Example: Convert 20010 into octal number
8 200  0
8 25  1
20010 = 3108
83 3
0
Decimal Into Hexadecimal Conversion
Example: Convert 7710 into hexadecimal number

16 77  13 = D
7710 = 4D16
16 4 4
0
Conversion Of Binary Into Octal
Example 1: Convert 10111012 into Octal number.
Grouping the binary number into a group of 3 bits

001 011 101


1 3 5

10111012 = 1358
Example 2: Convert 10101.112 into Octal number
Grouping the binary number into a group of 3 bits

Add 0 to
10 101 .110 complete
2 5 .6 the group of
three bits

10101.112 = 25.68
Conversion Of Hexadecimal Into Binary
Example 1: Convert 6CF16 into Hexadecimal number.
Convert the relevant digit into the group of 4 binary digits
6 C F

12 15

0110 1100 1111


6CF16 = 0110110011112
Conversion of Octal into Binary
Example 1: Convert 268 into Binary number
Convert the relevant digit into the group of 3 binary digits
2 6

010 110

268 = 0101102
Example 2: Convert 22.68 into Binary number
Convert the relevant digit into the group of 3 binary digits

2 2 .6

010 010 .110

22.68 = 010101.1102
Conversion Of Binary Into Hexadecimal
Example: Convert 0110110011112 into Hexadecimal number
Grouping the binary number into a group of 4 bits

0110 1100 1111

12 15

6 C F
0110110011112 = 6CF16
Conversion of Octal into Hexadecimal
Example: Convert 358 into Hexadecimal number
a. Convert the relevant digit into the group of 3 binary digits
3 5

011 101
358 = 0111012
b. Grouping the binary number into a group of 4 bits

00 01 1101
Add 00 to
complete the
group of four 13
bits
D
1
358 = 1D16
Conversion Of Hexadecimal Into Octal
Example: Convert 1D16 into Octal number
a. Convert the relevant digit into the group of 4 binary digits
1 D

13
0001 1101
1D16 = 000111012
b. Grouping the binary number into a group of 3 bits

0 00 011 101
Add 0 to
complete the
group of three
bits 0 3 5

1D16 = 358
COMPLEMENT

Used in digital
Complement computers
Simplifying the
subtraction operation
Purpose
Logical manipulation

1’s Complement
Types
2’s Complement
1’s Complement 2’s Complement
Provides an easier way to
Inversion of binary bits subtract numbers using
addition

The interim step to Importance: Allows to


finding the two’s represent signed
complement numbers in binary
The One’s Complement Convention
• The 1's complement changing (invert) all 1's to 0's and all 0's to
1's.
• This is called as taking complement or 1's complement or
inversion.
The Two’s Complement Convention
• The most popular among computer manufacturers
• Reason: It does not present any of the problems of the sign-
and-magnitude or one’s complement
• The 2's complement is obtained by adding 1 to the Least
Significant Bit (LSB) of 1's complement of the number

2's complement = 1's complement + 1


• 3 steps to perform 2’s complement:
Example 1: What is the 2’s complement representation of –23?
The absolute value of the number is 23
Step 1: Step 2: Step 3:
|2310|= 000101112 Change all zeros to Add 1,
ones and vice versa,
= 11101000 11101000
(1’s complement) + 1
11101001
Result: the 2’s complement for –23 is 11101001
Example 2: What is the decimal positive value of the 2’s
complement number 11100011?
Step 2: Step 3:
Complement all bits Add 1,
of the given number,
= 00011100 00011100
(1’s complement) + 1
00011101

Result: the 2’s complement for 111000112 is 000111012 (2910)


ARITHMETIC OPERATIONS

• Digital circuits are frequently used for arithmetic operations


• Fundamental arithmetic operations on binary numbers and
digital circuits which perform arithmetic operations will be
examined
Binary Addition
• Four rules of binary addition
Addition rules Note:
In fourth case, a
binary addition is
creating a sum of (1
+ 1 = 10) i.e. 0 is
written in the given
column and a carry
of 1 over to the next
column.
Note:
• If 1 + 1, the result
is 10
• 0 is written in the
given column and
a carry of 1 over
to the next
column
Binary Subtraction
• Subtraction will involve 2’s complement for negative number
• Similar to adding 2 numbers with one of the number is
negative value
• Example:
• 21 – 5 = 21 + (-5)
• 9 – 15 = 9 + (-15)
• Determine the 2’s complement representation for negative
value then add with the positive number.

You might also like