Chapeter1 Part 1
Chapeter1 Part 1
Chapter 1 (Part 1)
Presented by:
Dr L. CHELOUAH
1
I. NUMERATION SYSTEMS
Definition:
A numeration system is a set of conversions used to represent information
(number, text, …).
Each number is represented by a symbol called a digit.
The number of symbols used defines the base of a numeration system.
2
I. NUMERATION SYSTEMS
1. Decimal System
Base 10 -> (𝑁)10 symbols {0,1,2, 3, 4, 5, 6, 7, 8, 9}
2. Binary system
Base 2 -> (𝑁)2 symbols {0,1}
3. Octal system
Base 8 -> (𝑁)8 symbols {0,1, 2, 3, 4, 5, 6, 7}
4. Hexadecimal system
Base 16 -> (𝑁)16 symbols {0,1,2, …, 9, A,B,C,D,E,F}
3
I. NUMERATION SYSTEMS
4
I. NUMERATION SYSTEMS
Digit weight: this is the rank of the digit in a number when counting from the
right; the rightmost number has zero weight.
5
II. CONVERSIONS
From base 10 to base b
The successive divisions method is generally used to convert a number
written in base 10 to base b.
6
II. CONVERSIONS
Examples :
(42)10 = (? )2
(47)10 = (? )8
(94)10 = (? )16
7
II. CONVERSIONS
Examples :
(10111)2 = (? )10
(1𝐴2)16 = (? )10
8
II. CONVERSIONS
3. From base 2 to base 8
The number is grouped into subsets of 3 digits. Each subset is then
converted to base 8.
(110011000)2 = (630)8
Examples :
(11110011)2 = (? )16
(1110011)2 = (? )8
9
II. CONVERSIONS
5. From base 8 to base 2
Each digit of the number is broke down into 3 bits.
(753)8 = (111101011)2
Examples :
(𝐹𝐶1)16= (? )2
(164)8 = (? )2
10
II. CONVERSIONS
7. From base b1 to base b2
To convert a number from base b1 to base b2, we need to go through an
intermediate base, which is base 10 ∶ (𝑁)𝑏1 = (? )10 = (? )𝑏2
11
8. Convert a fractional number from base 10 to base b
We multiply the fractional part by base b and repeat this operation with
the fractional part of the product until it becomes equal to 0. The desired
value is in fact made up of the concatenation of the integer parts of the
various products obtained.
(9,5)10 = (1001,1)2
12
III. BINARY ARITHMETIC
Basic operations
A. Binary addition
Example :
(1110011)2 +(11101)2 =(? )2
13
III. BINARY ARITHMETIC
Basic operations
B. Binary subtraction
14
III. BINARY ARITHMETIC
Basic operations
C. Binary multiplication
Operation Product
0×0 0
0×1 0
1×0 0
1×1 1
Example :
(1101)2 × (1011)2 = (? )2
15
III. BINARY ARITHMETIC
Basic operations
D. Binary division
Operation Division
0÷0 Impossible
0÷1 0
1÷0 Impossible
1÷1 1
Example :
(100101,1)2 ÷ (1,01)2 = (? )2
16
IV. REPRESENTATIONS OF INFORMATION
Basic computer units of measurement
Bit (0 or 1)
Byte
Kilobyte (Kb)
Megabyte (Mb)
Gigabyte (Gb)
Terabyte (Tb)
17
IV. REPRESENTATIONS OF INFORMATION
Remark :
With n bits we can achieve :
𝟐𝒏 combinations
ቊ 𝒏
𝟐 −1 is the largest number
Example :
With n=2, we have 22 = 4 combinations and 22 -1 = 3 is the largest
number. The four combinations are :
A B
0 0
0 1
1 0
1 1
18
IV. REPRESENTATIONS OF INFORMATION
1. Coding of unsigned numbers
A coding with n bits allows for encoding all integers belonging to the range :
[0, 𝟐𝒏 - 1]
19
IV. REPRESENTATIONS OF INFORMATION
A coding with n bits allows for encoding any relative integer belonging to the
range : [-(𝟐𝒏−𝟏 -1), + (𝟐𝒏−𝟏 -1)].
20
IV. REPRESENTATIONS OF INFORMATION
2. Coding of signed numbers
B. Restricted complement
RC(0)=1, RC(1)=0
Example :
(−5)10 = (1111010)𝑅𝐶 // on 7 bits
A coding with n bits allows for encoding any relative integer belonging to the
range : [-(𝟐𝒏−𝟏 -1), + (𝟐𝒏−𝟏 -1)].
21
IV. REPRESENTATIONS OF INFORMATION
2. Coding of signed numbers
C. True Complement
TC(A) = RC(A) + 1
Example :
(−5)10 = (1111011) 𝑇𝐶 // on 7 bits
A coding with n bits allows for encoding any relative integer belonging to the
range : [-(𝟐𝒏−𝟏 ), + (𝟐𝒏−𝟏 -1)].
22
V. SUBTRACTION BY THE COMPLEMENT METHOD
1. Restricted Complement
Example:
Perform the following operation using the RC technique on 8 bits :
(63)10 - (28)10 = (63)10 + 𝑅𝐶(28)
= (00100011)𝑅𝐶
= (+35)10
Remark:
If the operation generates a carry, it will be added to the result.
23
V. SUBTRACTION BY THE COMPLEMENT METHOD
2. True Complement
Example:
Perform the following operation using the TC technique on 8 bits :
(63)10 - (28)10 = (63)10 + 𝑇𝐶 28
= (00100011) 𝑇𝐶
= (+35)10
Remark:
If the operation generates a carry, it will be ignored.
24
V. SUBTRACTION BY THE COMPLEMENT METHOD
Remark:
If the operation does not generate a carry, it means the number is negative. You
simply need to find the Restricted complement/True complement of this result to
obtain the desired value.
25
VI. PROBLEMS RELATED TO NUMBER LENGTH
Example :
Perform the following operation using the TC technique on 8 bits :
(+49)10 + (88)10 =(10001001) 𝑇𝐶 → Overflow
Example :
Perform the following operation using the RC technique on 6 bits :
(−21)10 + (−17)10 = (101010)10 + (101110)10 = (011001)𝑅𝐶 → Overflow
26
VII. REPRESENTATION OF REAL NUMBERS
Floating point
Definition :
A floating-point number is generally defined by: ± m . 𝑏 𝑒
Sign + or –
Mantissa m
Exponent e
Base b
27
VII. REPRESENTATION OF REAL NUMBERS
IEEE754 standard
Normalized floating-point coding
Standardized Mantissa (M) : the point is placed after the most significant bit at
1 (coded on q bits).
28
VII. REPRESENTATION OF REAL NUMBERS
29
VII. REPRESENTATION OF REAL NUMBERS
Example :
(+35,5)10 = (? )𝐼𝐸𝐸𝐸 754 𝐷𝑃
BE= E+ 𝟐𝒑−𝟏 -1 // p=11
30
VIII. NUMERIC AND ALPHANUMERIC CHARACTER
REPRESENTATIONS
31
VIII. NUMERIC AND ALPHANUMERIC CHARACTER
REPRESENTATIONS
2. Gray Code
Definition:
Also known as reflected binary code. In this code, to move from one
number to the next, a single bit is inverted so that it is the rightmost
possible bit leading to a new number.
Use cases :
- Design of logic circuits.
- Binary numeric progression while avoiding transitional states.
32
VIII. NUMERIC AND ALPHANUMERIC CHARACTER
REPRESENTATIONS
33
VIII. NUMERIC AND ALPHANUMERIC CHARACTER
REPRESENTATIONS
3. ASCII Code
Definition:
American Standard Code for Information Interchange : character encoding
standard in computing.
34
VIII. NUMERIC AND ALPHANUMERIC CHARACTER
REPRESENTATIONS
The first version of the ASCII table
35
VIII. NUMERIC AND ALPHANUMERIC CHARACTER
REPRESENTATIONS
3. ASCII Code
B. Second ASCII version (ISO 8859 standard)
At the end of the 1980s, the ISO-8859 encodings were defined, which are various
extensions of the ASCII encoding to encode accented Latin letters (French, Greek,
…).
4. Unicode
Definition:
Unicode (1990’s) is a family of encodings, a different standard to ASCII, which has
the advantage of offering a unified version of the different character encodings that
complement ASCII.
With UTF (Unicode Transformation Format)-32, it’s possible to represent 232
different characters, which results in a very large number, more than sufficient to
encode the scripts and characters of hundreds of languages.
36