Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

Representation Of Numbers &

Characters

Lecture#4
Number System
A number system defines how a number can be represented
using distinct symbols. A number can be represented
differently in different systems. For example, the two numbers
(2A)16 and (52)8 both refer to the same quantity, (42)10, but
their representations are different.

We are all familiar with the decimal number system (Base 10).
Some other number systems that we will work with are:

Binary  Base 2
Octal  Base 8
Hexadecimal  Base 16
The decimal system (base 10)
The word decimal is derived from the Latin word decem (ten).
In this system the base b = 10 and we use ten symbols

S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}

The symbols in this system are often referred to as decimal


digits or just digits.
The binary system (base 2)

The word binary is derived from the Latin word bini (two). In
this system the base b = 2 and we use only two symbols,
S = {0, 1}
The symbols in this system are often referred to as binary digits
or bits (binary digit).
The hexadecimal system (base 16)
The word hexadecimal is derived from the Greek word hex
(six) and the Latin word decem (ten). In this system the base
b = 16 and we use sixteen symbols to represent a number.
The set of symbols is

S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}
Note that the symbols A, B, C, D, E, F are equivalent to 10,
11, 12, 13, 14, and 15 respectively. The symbols in this
system are often referred to as hexadecimal digits.
The octal system (base 8)
The word octal is derived from the Latin root octo (eight).
In this system the base b = 8 and we use eight symbols to
represent a number. The set of symbols is

S = {0, 1, 2, 3, 4, 5, 6, 7}
Summary of the four positional systems
Table shows how the number 0 to 15 is represented
in different systems
Conversion
We need to know how to convert a number in one system
to the equivalent number in another system. Since the
decimal system is more familiar than the other systems,
Binary To Decimal
1101 = 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20
=1x8+1x4+0x2+1x1
=8+4+0+1

(1101)2 = (13)10
Decimal To Binary

2 13 LSB
2 6 1
2 3 0
1 1 MSB

(13)10 = (1101)2
Octal To Decimal
137 = 1 x 82 + 3 x 81 + 7 x 80
= 1 x 64 + 3 x 8 + 7 x 1
= 64 + 24 + 7

(137)8 = (95)10
Decimal To Octal

8 95 LSP
8 11 7
1 3
MSP

(95)10 = (137)8
Hex To Decimal
BAD = 11 x 162 + 10 x 161 + 13 x 160
= 11 x 256 + 10 x 16 + 13 x 1
= 2816 + 160 + 13

(BAD)16 = (2989)10

A = 10, B = 11, C = 12, D = 13, E = 14, F = 15


Decimal Hex

16 2989 LSP
16 186 13
11 10
MSP

(2989)10 = (BAD)16
Number Representation
An integer is a number which has no fraction part.
Numbers can be represented as a combination of
Value or magnitude
Sign (plus or minus)
Unsigned Integer
The representation of a non-negative integer using
binary, is called unsigned integer representation
Unsigned integers are appropriate for representing
quantities that can never be negative, such as
address of memory location, counter, ASCII
characters code.
Signed Integer
It can be positive or negative. The most significant bit
is reserved for the sign. 1 means negative & 0 means
positive. Negative integers are stored in the computer
in a special way known as 2’s complement.
ASCII (American Standard Code for
Information Interchange)
Represents each character in a standard character
set as a single byte binary code.
The standard code form that most PCs use to allow
for communication between systems.
Usually uses a 7 bit binary code so can store 128
different characters and simple communications
protocols.
Sufficient for all characters on a standard keyboard
plus control codes.

You might also like