Escolar Documentos
Profissional Documentos
Cultura Documentos
(DLD)
Lecture # 2
Number Systems
University of Management & Technology
NUMBER SYSTEM
NUMBER SYSTEM
Decimal (0-9)
Binary (0,1)
Octal (0-7)
Hexadecimal (0-15) {0-9, A, B, C, D, E, F}
A=10
B=11
C=12
D=13
E=14
F=15
Numbers
digit values: 0, 1, 2, , 7
digit values: 0, 1, 2, , 9
digit values: 0, 1, 2, , 9, A, B, , F
= 10, B = 11, , F = 15
NUMBER SYSTEM
Weights
102
101
100
Face Value
Weights
22
21
20
Face
Weights
24
23
22
21
20
value
(10111)2 =
= 16 + 0
= (23)
10
+ 4
+2
+1
DECIMAL TO BINARY
88
44
2
2
2
2
22
11
5
2
1
0
0
1
1
0
= (1011000)2
11
BINARY TO DECIMAL
= 16 + 0
+ 4
+2
+1
(23)10
12
CONVERT 75 TO BINARY
2
2
2
2
2
2
75
37
18
9
4
2
1
remainder
1
1
0
1
0
0
1001011
13
SUMMARY
Base10
Successive
Division
Base2
DECIMAL
BINARY
a) Divide the Decimal Number by 2; the remainder is the LSB of Binary
Number .
b) If the Quotient Zero, the conversion is complete; else repeat step (a)
using the Quotient as the Decimal Number. The new remainder is the
next most significant bit of the Binary Number.
Base2
BINARY
Weighted
Multiplication
Base10
DECIMAL
a) Multiply each bit of the Binary Number by it corresponding bitweighting factor (i.e. Bit-020=1; Bit-121=2; Bit-222=4; etc).
b) Sum up all the products in step (a) to get the Decimal Number.
15
PRACTICE EXAMPLES
a) 1310 = ?
b) 2210 = ?
c) 4310 = ?
d) 15810 = ?
16
16
17
0.56x2
0.12x2
0.24x2
0.48x2
0.96x2
0.92x2
Fractional Part
1.12
.12
0.24
.24
0.48
.48
0.96
.96
1.92
.92
1.84
.84
0.5610 = (0.100011)2
Integral Part
1
0
0
0
1
1
18
Integral Part
0.25
2
2
2
2
2
56
56
28
14
7
3
b. Fractional Part
Result
0.25x2
0.5x2
0
1
Fractional Part
0.5
1.0
Integral Part
.5
.0
0.2510 = 012
1 - 1
5610 = 1110002
(56.25)10 = (111000.01)2
19
LSB
theleast significant bit(LSB) is the
bitposition in abinaryintegergiving the units value,
that is, determining whether the number is even or
odd. the LSB is sometimes referred to as the rightmost bit, due to the convention inpositional notationof
writing less significant digits further to the right. it is
analogous to the least significantdigitof adecimal
integer, which is the digit in theones(right-most)
position.
Incomputing,
20
MSB
21
HEXADECIMAL
Hexadecimal
Weight
164
163
162
161
160
n
s
22
BINARY TO HEXADECIMAL
The following steps are used to convert
binary number to Hexadecimal:
Make
23
BINARY TO HEXADECIMAL
1101
13
0111
7
D
=(D7)16
24
FRACTIONAL BINARY TO
HEXADECIMAL
25
FRACTIONAL BINARY TO
HEXADECIMAL
Example: Convert the number 11010.112 to
Hexadecimal number system.
Binary Values
0 00 1
Hexadecimal N.S.
1010 .1 100
10
A
11010.112 = 1A.C16
. 12
C
26
HEXADECIMAL TO BINARY
Convert
(4F)16 to binary.
Hexadecimal values
Binary values
4
0100
15
1111
=(01001111)2
27
HEXADECIMAL TO DECIMAL
Convert (3A)16 to decimal.
(3A)16 =
3x16
+ Ax160
= 3x16
+ 10x1
(58)10
28
Integral Part
0.225
16 225
14 - 1
0.60x16
E
225
b. Fractional Part
Result
0.225x16
3.60
9.60
.60
0.60x16
Fractional Part
9.60
.60
Integral Part
9
.60
29
DECIMAL TO HEXADECIMAL
7551
471 - 15
29 - 7
1 - 13
F
D
= (1D7F)16
30
0.3x16
0.8x16
0.8x16
Fractional Part
4.8
12.8
12.8
.8
.8
.8
Integral Part
4
12
12
C
C
0.310 =0.4C16
Note: C is the repeating value. It will be taken
once conventionally.
31
Weights
84
83
82
81
80
32
OCTAL TO DECIMAL
Convert (452)8 to decimal.
(452)8 =
4x8
+ 5x81 + 2x80
= 256 + 40
+2
(298)10
33
DECIMAL TO OCTAL
119
14 - 7
1 - 6
= (167)8
34
0.225x8
0.80x8
0.40x8
0.20x8
0.60x8
1.80
6.40
3.20
1.60
4.80
Fractional Part
.80
.40
.20
.60
.80
Integral Part
1
6
3
1
4
0.22510 = .163148
35
a.
225
28 1
3 4
22510 = 3418
255
b. Fractional Part
0.225
0.22510 = .163148
225.25510 = 341.163148
36
OCTAL TO BINARY
Octal
values
Binary
values
101
111
011
=(101111011)2
37
2
5 .
5
7
421 421 . 4 21 421
010 101. 1 01 111
25.578 = 10101.1011112
38
BINARY TO OCTAL
The following steps are used to convert binary
number to octal:
Make Groups of three binary digits form right
to left.
Add Extra 0 from left side if digits are less
than three.
Convert each group into octal number system.
39
BINARY TO OCTAL
011
3
01 0
2
111
7
=(327)8
40
Steps:
41
01 1
3
010 . 1 10
2
11010.112 = 32.68
42
Base-2
Base-3
Base-4
Base-R
Base-2
Base-3
Decimal
Base-4
.
Base-R