Documente Academic
Documente Profesional
Documente Cultură
Outline
Positional Number Systems
Conversion between Positional Number
Systems
Non-positional Number Systems
Summary
Introduction
A number system defines how a number can
in different systems.
For
b is the base.
decem (ten).
Base b = 10.
Ten symbols:
S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
bini (double).
Base b = 2.
Ten symbols:
S = {0, 1}
(11001)2 = (25)
? 10
Introduction to Computer Science, Fall, 2010
10
? 10
(101.11)2 = (5.75)
11
12
(base 16)
S = {0, 1, , 8, 9, A, B, C, D, E, F}
as hexadecimal digits.
13
(base 16)
Integer values
(2AE)16 = (686)
? 10
Introduction to Computer Science, Fall, 2010
14
(base 8)
(eight).
Base b = 8.
Ten symbols:
S = {0, 1, 2, 3, 4, 5, 6, 7}
15
(base 8)
(1256)8 = (686)
? 10
16
17
18
conversions:
Binary/Hex/Octal
Decimal.
Decimal Binary/Hex/Octal.
Binary Hex/Octal
19
(110.11)2 = (6.75)10
Introduction to Computer Science, Fall, 2010
20
10
Decimal-Others Conversion
Decimal Binary/Hex/Octal (Integral part)
21
Decimal-Others Conversion
Decimal Binary/Hex/Octal
22
11
Decimal-Others Conversion
Decimal
Binary/Hex/Octal
=
17
21 + 1
20
35 = 17
2+1
2 + 1
1 + 1
0
=
8
2
2
2
= (8
2 + 1)
2+1
(35)10 = (100011)2
23
Decimal-Others Conversion
Decimal
Binary/Hex/Octal
(126)10 = (7E)
? 16
(126)10 = (176)
? 8
24
12
Decimal-Others Conversion
Decimal Binary/Hex/Octal (Fractional part)
25
Decimal-Others Conversion
Decimal Binary/Hex/Octal (Fractional part)
26
13
Decimal-Others Conversion
Decimal Binary/Hex/Octal (Fractional part)
0.625 = 2-1
(21
0.625) = 2-1
(1.25)
= 2-1
(1 + 0.25)
= 2-1
(1 + 2-1
(21
0.25))
= 2-1
(1 + 2-1
(0 + 0.5))
= 2-1
(1 + 2-1
(0 + 2-1
(21
0.5)))
-1
-1
-1
=2
(1 + 2
(0 + 2
(1 + 0)))
(0.625)10 = (0.101)2
B. Forouzan and F. Mosharraf, Foundations of Computer Science, 2nd ed., 2008.
27
Decimal-Others Conversion
Decimal Binary/Hex/Octal (Fractional part)
(178.6)10 = (B2.9)
? 16
(0.634)10 = (0.5044)
? 8
(maximum of four digits)
28
14
Decimal-Others Conversion
Decimal Binary/Hex/Octal
An alternative method: (usu. for small values)
To break the number as the sum of numbers
that are equivalent to the binary place values
shown.
29
Decimal-Others Conversion
Decimal Binary/Hex/Octal
An alternative method: (usu. for small values)
30
15
Binary-Hexadecimal Conversion
four-bit grouping
(10011100010)2 (?)16
31
Binary-Hexadecimal Conversion
Binary Hex
(10011100010)2 (100 1110 0010)2 (4E2)16
Hex Binary
32
16
Binary-Hexadecimal Conversion
Binary Hex
? 2 (6AB)16
(11010101011)2 (110 1010 1011)
Hex Binary
33
Binary-Octal Conversion
three-bit grouping
34
17
Binary-Octal Conversion
Binary Octal
(101110010)2 (101 110 010)2 (562)8
Octal Binary
35
Binary-Octal Conversion
Binary Octal
? 2 (3463)8
(11100110011)2 (011 100 110 011)
Octal Binary
36
18
Octal-Hex Conversion
Convert with the aid of binary systems
37
Number of Digits
Quiz:
38
19
Number of Digits
How can we know the number of digits
39
Number of Digits
Quiz:
40
20
41
There are some exceptions to the addition rule we just mentioned, as shown in the
following example.
Introduction to Computer Science, Fall, 2010
42
21
43
44
22
45
46
23
Summary
Number systems
Positional vs. Non-positional
Positional systems
Decimal
Binary
conversion
Octal
Hexadecimal
Non-positional systems
Roman numeral
47
24