Computer Architecture
Dr. Rahma Bouaziz, maître-assistant, FSG
A.U. 2023_2024
Chapter 2 – Part 2
Numbering system and
coding
Convert an Integer from Decimal to Another Base
For each digit position:
1. Divide decimal number by the base (e.g. 2)
2. The remainder is the lowest-order digit
3. Repeat first two steps until no divisor remains
Example for (13)10:
Quotient Remainder Coefficient
13/2 = 6 , 1 a0 = 1
6/2 = 3 , 0 a1 = 0
3/2 = 1 , 1 a2 = 1
1/2 = 0 , 1 a3 = 1
Answer (13)10 = (a3 a2 a1 a0)2 = (1101)2
MSB LSB
10/10/2023 3
1
, Example : decimal --> binary
10/10/2023 4
Convert a Fraction from Decimal to Another Base
For each digit position:
1. Multiply decimal number by the base (e.g. 2)
2. The integer is the highest-order digit
3. Repeat first two steps until fraction becomes zero
Example for (0.625)10:
Integer Fraction Coefficient
0.625 x 2 = 1 + 0.250 a-1 = 1
0.250 x 2 = 0 + 0.500 a-2 = 0
0.500 x 2 = 1 + 0 a-3 = 1
Answer (0.625)10 = (0.a-1 a-2 a-3 )2 = (0.101)2
MSB LSB
10/10/2023 5
Example: (143,526)10=(?)2
10/10/2023 6
2