0% found this document useful (0 votes)
1 views

Chapter 4- Iinformation Representation

Uploaded by

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

Chapter 4- Iinformation Representation

Uploaded by

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

Chapter 04 : Information

Representation

• Introduction
• Decimal, binary, octal and hexadecimal system
• Conversion from one number system to another
system .
• Operations in binary, octal and hexadecimal.

1
Vocabulary

• A bit: This is the smallest unit of information that can be manipulated


by a digital machine.

• Weight: This is the value of a bit. This value depends on the position
of the bit starting from the right, from weakest to strongest.

• A byte: it is a unit of information made up of 8 bits. For example, it


allows you to store a character, such as a letter or a number.

• A base: It is a decomposition, which allows the writing of a number


in a particular way according to the number of the base

2
What is the system used in digital machines?

. Digital machines use the binary system .


.In the binary system: only 2 symbols are used: 0 and 1 .
.It is easy to represent these two symbols in digital machines .
. The 0 and the 1 are represented by two voltages .

5v
Tension Binary Binary: 1
(logic ) 2.8v
0V 0 Unused
0.8v
5V 1
Binary: 0
0v
3
Introduction
• We usually represent numbers using ten (10) different symbols: 0,
1, 2, 3, 4, 5, 6, 7, 8, 9
• This system is called the decimal system (deci means ten).
• There are, however, other forms of numbering that operate using a
number of distinct symbols.
– Example :
• The binary system (bi: two),
• The octal system ( oct : eight),
• The hexadecimal system (hex: sixteen).
• In fact, any number of different symbols (not necessarily numbers)
can be used.
• In a numbring system: the number of distinct symbols is called the
base of the number system.

4
The decimal system
• We use ten different symbols:
{0,1,2,3,4,5,6,7,8,9}
• Any combination of the symbols {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} gives us a
number.

7654332

Low weight
Heavyweight

345, 567
Fractional part
Whole part 5
Polynomial expansion of a number in the
decimal system

• Given the number 1954, this number can be written in the following
form:
1954 1000  900  50  4
1954 1*1000  9 *100  5 *10  4 *1
1954 1*103  9 *10 2  5 *101  4 *10 0

.This form is called the polynomial form

NB : real number can also be written in the form polynomial

6
The binary system
• In the binary system, to express any value we only use 2
symbols: { 0 , 1}
The base
One bit 2 )1101(

2 )1 0 1 1(
The most significant The least significant bit
bits

A number in base 2 can also be written in polynomial form .


(1110) 2 1* 23  1* 2 2  1* 21  0 * 20 (14)10

7
Binary counting

• On a single bit: 0, 1 On 3 Bits

Decimal Binary
0 000
:On 2 bits . 1 001
2 010
Decimal Binary 3 011
0 00 4 100
1 01 5 101
2 10 6 110
3 11 7 111

combinations = 2 2 4
combinations = 2 3 8 8
The octal system (base 8)

• 8 symbols are used in this system:


{0,1,2,3,4,5,6,7}

• Example 1:

(127) 8 1* 82  2 * 81  7 * 80

:Example 2
The number (1289) does not exist in base 8 since the symbols 8 and 9 do not
.belong to the base

9
The hexadecimal system (base 16)
Hexadecimal Decimal
0 0
1 1
• Sixteen (16) different symbols 2 2
are used: 3 3
4 4
5 5
6 6
(17)16 1*161  7 *160 7 7
(AB)16  A *161  B *160 10 *161  11 *1 8 8
9 9
A 10
B 11
C 12
D 13
E 14
F 15
10
Summary

• In a base X, we use X distinct symbols to represent numbers.


• The value of each symbol must be strictly less than the base X.
• Every number in a base X can be written in its polynomial form.

11
Converting base X to base 10

• This conversion is quite simple since you just need to expand


this number into a polynomial in the base X , and do the sum
afterwards.

: Example

(1101) 2 1* 23  1* 2 2  0 * 21  1* 2 0 (13)10


(1A7)16 1*16 2  A *161  7 *16 0 1*16 2  10 *161  7 *160 256  160  7 (423)10

12
Exercise

• Perform the following transformations to base 10?


– (123) 6 =(?) 10
– (1ABC) 16 =(?) 10

13
Converting from decimal to base X

• The conversion is done by taking the remainders of


successive divisions on the base X in the opposite
direction.
: Example 35 2
2 )?( = 35 2
1 17
1 8 2
2 )100011 (=35 0 4 2
0 2 2
0 1 2
1 0
• Question : Perform the following transformations:
(43) 10 =(?) 2 =(?) 5 =(?) 8 =(?) 16
14
43 2
43 5
1 21 2
3 8 5
1 10
2 3 1 5
0 5 2 1 0
1 2 2
0 1 2
5 )133(
1 0
2 )101011(

43 16
43 8
8 11 2 16
3 5
2 0
5 0

)2B(
8 )53(
16
15
Converting from a base b1 to a base b2

• There is no method to go from a base b1 to another base b2


directly.
• The idea is to convert the number from base b1 to base 10, then
convert the result from base 10 to base b2 .

?
b1 b2

Polynomial
developpement Successive divisions

10
16
Example: (34) 5 =(?) 7

(34) 5 3 * 51  4 * 50 15  4 (19)10 (?) 7

19 7
7 )25( = 10 )19(
5 2 7
7 )25(= 5 )34(
2 0

Exercise: perform the following transformations

8 )?(= 5 )?(= 6 )43(


16 =(?) 9 )2A(

17
Conversion: Octal  binary

Binary Octal
In octal, each base symbol is written on 3 bits in . 000 0
. binary 001 1
The basic idea is to replace each symbol in the . 010 2
octal base by its value in 3-bit binary (do 3-bit 011 3
.bursting) 100 4
101 5
110 6
:Examples
111 7
2 ) 101 100 011 (= 8 )345(

18
Conversion: Binary  Octal

The basic idea is to make 3 -bit groupings starting from the least .
.significant
Subsequently replace each grouping with the corresponding octal .
.value

: Example

8 )31226(= 2 ) 110 010 010 001 11 0 (= 2 )11001010010110(

19
Conversion: hexadecimal  binary
Hexadecimal Decimal
0 0
1 1
2 2
. In Hexa each symbol of the base is written on 4 bits . 3
4
3
4
. The basic idea is to replace each symbol 5 5
by its 4-bit binary value (make 4-bit bursting). 6 6
7 7
8 8
9 9
HAS 10
B 11
VS 12
: Example
D 13
16 =( 0011 0100 0101 1011 ) 2 )345B( E 14
F 15

20
Conversion: binary  hexadecimal

.The basic idea is to make 4-bit groupings starting from the least significant .

.Subsequently replace each grouping with the corresponding Hexa value

: Example
16 )32A6(= 2 ) 0110 1010 0010 11 00 (= 2 )11001010100110(

21
4. Arithmetic operations in binary
0 0 1 1
+ + + +
0 1 0 1
0 1 1 0 1

1 1
1 1 0 0 0 1 1

+
1 1 0 1 0 0 0 1

1 1 1 0 1 1 1 0

22
Binary multiplication
We will start with (1010) 2 times (101010) 2 :

In base 2: 1010 × 10 1010 = 1 1010 0100.


Now, (1010) 2 = (10) 10 ; (101010) 2 = (42) 10 ; so theoretically, we
should have 420.
You can check: (1 1010 0100) 2 is indeed 420 in base ten.

23
Arithmetic operations in octal

1 1

5 6 3 4
+
1 5 4
5 8 11 6

In octal 8 is written In octal 11 is written 13


10
0 3

The final result: ( 5036) 8


24
Arithmetic operations in hexadecimal

5 6 8 4
+
A 5 1 7
12 18 11 6

C En hexa 11 is written B
In hex 18 is written 12
B
2

The final result: (C2B6)16 25


Exercise
Perform the following operations:
• (43) 8 +(34) 8 =(?) 8 Annex
• (43) 6 +(34) 6 =(?) 6
• (AB1) 16 +(237) 8 =(?) 16

26

You might also like