Uploaded by Tiên Trần

Material - Numeral Convert

advertisement
Numeral Systems
1. Convert Base 10 {0; 1; 2; 3; 4; 5; 6; 7; 8; 9} à Base K
1.1. Base 10 à Base 2 {0; 1}
21.125 (10) à X (2)
Result: 21.125 (10) = 10101.001 (2)
1.2. Base 10 à Base 16 {0; 1; 2; 3; 4; 5; 6; 7; 8; 9; A; B; C; D; E; F}
923 (10) à Y (16)
923
16
B
57
9
16
3
16
3
0
Result: 923 (10) = 39B (16)
1.3. Base 10 à Base 8 {0; 1; 2; 3; 4; 5; 6; 7}
2. Convert Base 2 à Base 10
10110 (b) à X (d)
Result: 10110 (b) = 22 (d)
10.110 (b) à Y (d)
Result: 10.110 (b) = 2.75 (d)
3. Convert Base 2 ßà Base 16
3.1. Base 16 à Base 2
15AF (16) à X (2)
Result: 15AF (16) = 1010110101111 (2)
3.2. Base 2 à Base 16
1010110111111 (2) à Y (16)
Result: 1010110111111 (2) = 15BF (16)
4. Convert Base 2 ßà Base 8
1010110111 (2) à X (8)
Result: 1010110111 (2) = 1267 (8)
5. Addition
1110 (2) + 1000 (2) = ?
Result: 1110 (2) + 1000 (2) = 10110 (2)
11.011 (2) + 10.110 (2) = ?
+
1
1
1
.0
1
1
1
0
.1
1
0
1
0
.0
0
1
Result: 11.011 (2) + 10.110 (2) = 110.001 (2)
82BA (16) + B781 (16) = ?
+
1
8
2
B
A
B
7
8
1
3
A
3
B
Result: 82BA (16) + B781 (16) = 13A3B (16)
6. Multiple
1011 (2) x 10 (2) = ?
Result: 1011 (2) x 10 (2) = 10110 (2)
234A (16) x AB (16) = ?
2
x
3
4
A
A
B
E
1
8
4
2
1
6
0
E
4
1
7
9
2
6
Result: 234A (16) x AB (16) = 17926E (16)
7. Subtract
1010 (2) - 111 (2) = ?
_
1
0
1
0
0
1
1
1
0
0
1
1
Result: 1010 (2) - 111 (2) = 11 (2)
E
F121 (16) – B781 (16) = ?
_
F
1
2
1
B
7
8
1
3
9
A
0
Result: F121 (16) – B781 (16) = 39A0 (16)
8. Divide
11101 (2) : 101 (2) = ?
Result: 11101 (2) : 101 (2) = 101 (remainder = 100).
9. Two’s complement notation systems
Leftmost bit: sign bit
One’s complement: Changing all the 0s to 1s, all the 1s to 0s.
Two’s complement: Add 1 to the one’s complement.
-5 (10) à Binary?
Result: -1x27 + 1x26 + 1x25 + 1x24 + 1x23 + 0x22 + 1x21 + 1x20 = -5
5 – 5 = 5 + (-5) = 0
6 bit - sized interger.
001100 (12)
à
110100 (-12)
001001 (9)
à
110111 (-9)
+
_
1
1
0
1
0
0
(-12)
1
1
0
1
1
1
(-9)
1
0
1
0
1
1
(-21)
0
0
1
0
0
1
(9)
0
0
1
1
0
0
(12)
1
1
1
1
0
1
(-3)
+
0
0
1
0
0
1
(9)
1
1
0
1
0
0
(-12)
1
1
1
1
0
1
(-3)
Download