Lect 3
Lect 3
Lect 3
0, 1, 2, 3, 4, 5, 6, 7
Base 8
Representing Binary numbers in compact form
Weightage of each number increases by a factor
of “8” as its placement moves to the left
Example:
(127.4)8 (Don’t call it one twenty seven point four, but one,
two, seven, point four)
Not commonly used in the presence of
Hexadecimal Number System
Counting in Octal
Assume Zeros
2 010
Example:
3 011
( 1 0 1 1 0 . 0 1 )2 4 100
5 101
6 110
( 2 6 . 2 )8
7 111
Works both ways (Binary to Octal & Octal to Binary)
Octal to Binary Conversion
1726
001 111 010 110
Decimal-Octal Conversion
Repeated Division by 8
Repeated Division by 8
Sum-of-Weights
Sum-of-Weights
4037
(4 x 83) + (0 x 82) + (3 x 81) + (7 x 80)
(4 x 512) + (0 x 64) + (3 x 8) + (7 x 1)
2048 + 0 + 24 + 7
2079
Hexadecimal Number System
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Base 16
Example:
(B65F)
16
0 0000 0 8 1000 8
1 0001 1 9 1001 9
2 0010 2 10 1010 A
3 0011 3 11 1011 B
4 0100 4 12 1100 C
5 0101 5 13 1101 D
6 0110 6 14 1110 E
7 0111 7 15 1111 F
Counting in Hexadecimal
Decimal Hexa- Decimal Hexa- Decimal Hexa-
Decimal Decimal Decimal
16 10 24 18 32 20
17 11 25 19 33 21
18 12 26 1A 34 22
19 13 27 1B 35 23
20 14 28 1C 36 24
21 15 29 1D 37 25
22 16 30 1E 38 26
23 17 31 1F 39 27
Binary-Hexadecimal Conversion
Hex Binary
0 0000
Binary to Hexadecimal Conversion 1 0001
11010110101110010110 2 0010
3 0011
1101 0110 1011 1001 0110 4 0100
5 0101
D 6 B 9 6 6 0110
7 0111
Hexadecimal to Binary Conversion 8 1000
9 1001
FD13 A 1010
B 1011
1111 1101 0001 0011 C 1100
D 1101
E 1110
F 1111
Binary − Hexadecimal Conversion
Hex Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
Assume Zeros 6 0110
Example:
7 0111
8 1000
( 1 0 1 1 0 . 0 1 )2 9 1001
A 1010
B 1011
C 1100
D 1101
(1 6 . 4 )16 E 1110
F 1111
Works both ways (Binary to Hex & Hex to Binary)
Decimal-Hexadecimal Conversion
Repeated Division by 16
Repeated Division by 16
2096 131 0
131 8 3
8 0 8
Hexadecimal-Decimal Conversion
Sum-of-Weights
Sum-of-Weights
CA02
(C x 163) + (A x 162) + (0 x 161) + (2 x 160)
(12 x 163) + (10 x 162) + (0 x 161) + (2 x 160)
(12 x 4096) + (10 x 256) + (0 x 16) + (2 x 1)
49152 + 2560 + 0 + 2
51714
Octal − Hexadecimal Conversion
Convert to Binary as an intermediate step
Example:
( 2 6 . 2 )8
( 0 1 0 1 1 0 . 0 1 0 )2
(1 6 . 4 )16
Works both ways (Octal to Hex & Hex to Octal)
Base-5 Systems
Quinary System
Base (Radix): “5”
Symbols: 0, 1, 2, 3, 4
Weightage of each number increases by a factor of “5”
as its placement moves to the left
Example:
(4021.2)5 (Don’t call it four thousand and twenty one point
two, but four, zero, two, one, point two)
02/11/23 23
Conversion between Number Systems
Conversion of decimal integer
Repeated division
Examples:
57
Binary
Quinary
Octal
Hexadecimal
57/2 = 28: rem= 1=a0 57/5=11: rem=2 57/8=7: rem=1
28/2 = 14: rem= 0=a1 11/5 = 2: rem=1 (71)8
14/2 = 7: rem= 0=a2 (212)5
7/2 = 3: rem= 1=a3 57/16=3: rem=9
3/2 = 1: rem= 1=a4 (39)16
1/2 = 0: rem= 1=a5
(111001)2
02/11/23 24
Conversion between Number Systems
…continued
2
Conversion of decimal fraction 0.625 x 2 = 1.250: a-1 = 1
Repeated multiplication 0.250 x 2 = 0.50: a-2 = 0
0.500 x 2 = 1.0: a-3 = 1
Examples: (0.101)2
0.625
Binary 0.625 x 5 = 3.125: a-1 = 3
Quinar 0.125 x 5 = 0.625: a-2 = 0
0.625 x 5 = 3.125:a-3= 3
Octal
(0.303)5
Hexadecimal
02/11/23 25
Conversion between Number Systems
…continued
4
Conversion to binary number system:
(48.5625)10 = (?)2
Repeated division Repeated multiplication
48/2 = 24: a0 = 0 0.5625 x 2 = 1.1250: a-1 = 1
24/2 = 12: a1 = 0 0.1250 x 2 = 0.2500: a-2 = 0
12/2 = 6: a2 = 0 0.2500 x 2 = 0.5000: a-3 = 0
6/2 = 3: a3 = 0 0.5000 x 2 = 1.0000: a-3 = 1
3/2 = 1: a4 = 1 (0.1001)2
1/2 = 0: a5 = 1
(110000)2
(48.5625)10 = (110000.1001)2
02/11/23 26
Conversion between Number Systems
…continued
5
Conversion to quinary number system:
(48.5625)10 = (?)5
Repeated division Repeated multiplication
48/5 = 9: a0 = 3 0.5625 x 5 = 2.8125: a-1 = 2
9/5 = 1: a1 = 4 0.8125 x 5 = 4.0625: a-2 = 4
1/5 = 0: a2 = 1 0.0625 x 5 = 0.3125: a-3 = 0
(143)5 0.3125 x 2 = 1.5625: a-4 = 1
(0.2401)5
(48.5625)10 = (143.2401)5
02/11/23 27
Conversion between Number Systems
…continued
6
Conversion to octal number system:
(48.5625)10 = (?)8
Repeated division Repeated multiplication
48/8 = 6: a0 = 0 0.5625 x 8 = 4.5000: a-1 = 4
6/8 = 0: a1 = 6 0.5000 x 8 = 4.0000: a-2 = 4
(60)8 0.0000 x 8 = 0.0000: a-3 = 0
(0.440)8
(48.5625)10 = (60.44)8
02/11/23 28
Conversion between Number Systems
…continued
7
Conversion to hexadecimal number system:
(48.5625)10 = (?)16
Repeated division Repeated multiplication
48/16 = 3: a0 = 0 0.5625 x 16 = 9.000: a-1 = 9
3/16 = 0: a1 = 3 0.0000 x 16 = 0.000: a-2 = 0
(30)16 (0.90)16
(48.5625)10 = (30.90)16
02/11/23 29