Professional Documents
Culture Documents
Number Systems
83 = (8 * 10) + 3
The number 4728 means four thousands, seven hundreds, two tens, plus
eight:
83 = (8 * 101) + (3 * 100)
A number with both an integer and fractional part has digits raised to both
positive and negative powers of 10:
+ (6 * 10-3)
Used by Used in
System Base Symbols humans? computers?
Decimal 10 0, 1, … 9 Yes No
Binary 2 0, 1 No Yes
Octal 8 0, 1, … 7 No No
Hexa- 16 0, 1, … 9, No No
decimal A, B, … F
+
Quantities/Counting (1 of 3)
Hexa-
Decimal Binary Octal decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
p. 33
+
Quantities/Counting (2 of 3)
Hexa-
Decimal Binary Octal decimal
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
+
Quantities/Counting (3 of 3)
Hexa-
Decimal Binary Octal decimal
16 10000 20 10
17 10001 21 11
18 10010 22 12
19 10011 23 13
20 10100 24 14
21 10101 25 15
22 10110 26 16
23 10111 27 17 Etc.
+
Conversion Among Bases
The possibilities:
Decimal Octal
Binary Hexadecimal
+ The Binary System
Only two digits, 1 and 0
The digits 1 and 0 in binary notation have the same meaning as in decimal notation:
02 = 010
12 = 110
To represent larger numbers each digit in a binary number has a value depending on
its position:
and so on. Again, fractional values are represented with negative powers of the radix:
= 24 + 6 + 0.875 + 0.03125
= 30.9062510
Decimal Octal
Binary Hexadecimal
+ Decimal to Binary Conversion
(Whole Part: Repeated Division)
Stop when the quotient becomes zero, but use the corresponding
remainder.
Result = 1 1 0 0 0 0 12
1 0 1 1 1 1 0 1 = 189
To convert the decimal 189 / 2 = 94 r 1
number 189 to binary 94 / 2 = 47 r 0
you must divide the 47 / 2 = 23 r 1
number by 2. Starting 23 / 2 = 11 r 1
from the right, place a 11 / 2 = 5 r 1
1 if there is a 5/2= 2r1
remainder or a 0 if no 2/2= 1r0
remainder. 1 / 2 = cannot
divide further -
carry the 1 Press any key to continue…
Decimal to Binary Conversion Example
Use the chart to record the division
0 1 0 0 1 0 1 1 = 75
To convert the decimal 75 / 2 = 37 r 1
number 75 to binary 37 / 2 = 18 r 1
you must divide the 18 / 2 = 9 r 0
number by 2. Starting 9/2= 4r1
from the right, place a 4/2= 2r0
1 if there is a 2/2= 1r0
remainder or a 0 if no 1 / 2 = cannot divide
remainder. further - carry the 1
Fill in to make 8 bits with 0
Press any key to continue…
Decimal to Binary Conversion Example
Use the chart to record the division
1 1 1 1 0 0 1 0 = 242
To convert the decimal 242 / 2 = 121 r 0
number 242 to binary 121 / 2 = 60 r 1
you must divide the 60 / 2 = 30 r 0
number by 2. Starting 30 / 2 = 15 r 0
from the right, place a 15 / 2 = 7 r 1
1 if there is a 7/2= 3r1
remainder or a 0 if no 3/2= 1r1
remainder. 1 / 2 = cannot
divide further -
carry the 1 Press any key to continue…
+ Counting in Binary
6 0110 • Etc….
7 0111
12510 = 11111012
Figure 9.2
Examples of
Converting
from
Decimal Notation
To
Binary Notation
For Fractions
Decimal Octal
Binary Hexadecimal
+
Binary to Decimal
Technique
Multiply each bit by 2n, where n is the “weight” of the bit
The weight is the position of the bit, starting from 0 on the right
Add the results
+
Example
Bit “0”
1010112 => 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
4310
+
Binary to Decimal Conversion
101101012
= 128 + 32 + 16 + 4 + 1
= 18110
0 1 1 0 1 0 1
26 25 24 23 22 21 20
64 32 16 8 4 2 1
0 + 32 + 16 + 0 + 4 + 0 + 1 = 5310
\01101012 = 5310
+ 31
a) 0110 2 = ?
b) 11010 2 = ?
c) 0110101 2 = ?
d) 11010011 2 = ?
e) 10.1011 2 = ?
+ 32
a) 0110 2 = ? 6 10
b) 11010 2 = ? 26 10
c) 0110101 2 = ? 53 10
d) 11010011 2 = ? 211 10
+
Dec → Binary : Examples
A. 101101
B. 1000101
C. 1100011
D. 1
+
Octal to Binary
Decimal Octal
Binary Hexadecimal
+
Octal to Binary
Technique
Convert each octal digit to a 3-bit equivalent binary representation
+
Use the Table for conversion
Hexa-
Decimal Binary Octal decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
p. 33
+
Example
7058 = ?2
7 0 5
7058 = 1110001012
+
Converting Octal to Binary
435208 = 1000111010100002
STEP ONE: Take each octal digit and
convert each digit to a binary triplet. Keep
leading zeros:
4 3 5 2 0
100 011
0 101 010
0 000
39
+
Binary to Octal
Decimal Octal
Binary Hexadecimal
+
Binary to Octal
Technique
Group bits in threes, starting on right
Convert to octal digits
+
Example
10110101112 = ?8
1 3 2 7
10110101112 = 13278
+Converting Binary to Octal
start
100011001010012
STEP ONE: Take the binary number and
from right to left, group all placeholders in
triplets. Add leading zeros, if necessary:
43
+
0010 001 100 101 0012 = 214518
A. 111110110
B. 1000001
C. 10000010
D. 1100010
A. 766
B. 202
C. 101
D. 142
A. 25248
B. 3322108
A. 25248 = 010101010100
B. 3322108 = 011011010010001000
Decimal Octal
Binary Hexadecimal
+
Octal to Decimal
Technique
Multiply each bit by 8n, where n is the “weight” of the bit
The weight is the position of the bit, starting from 0 on the right
Add the results
+
Example
7248 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810
+
Octal to Decimal
Decimal Octal
Binary Hexadecimal
+ Decimal to Octal
Step 1: Take the given decimal number
Step 2: If the number is less than 8 the octal number is the same
Step 3: If the number is greater than 7 then Divide the number
with 8
Step 5: Carry on the step 3 and 4 with the qoutient till it is less
than 8
8 | 128
8 | 16 -- 0
8 | 2 -- 0
8 | 0 --2
8 | 58
8 | 7 -- 2
8 | 0 --7
8 | 451
8 | 56 -- 3
8 | 7 -- 0
8 | 0 -- 7
A. 901
B. 321
C. 112
D. 25.625
A. 901 = 1605
B. 321 = 501
C. 112 = 160
D. 25.625 = 31.50
777
345
777 = 511
345 = 229
Because 16 symbols are used, the notation is called hexadecimal and the 16
symbols are the hexadecimal digits
Thus
Decimal Octal
Binary Hexadecimal
+
Binary to Hexadecimal
Technique
Group bits in fours, starting on right
Convert to hexadecimal digits
+
Example
10101110112 = ?16
10 1011 1011
2 B B
10101110112 = 2BB16
+ Binary/Hex Conversions
Table 9.3
Decimal, Binary,
and Hexadecimal
Decimal Octal
Binary Hexadecimal
+ Hexadecimal to Binary Conversions
B. 11100111
C. 01101110
+
Exercise 2 Hexadecimal
Decimal Octal
Binary Hexadecimal
+
Hexadecimal to Decimal
Technique
Multiply each bit by 16n, where n is the “weight” of the bit
The weight is the position of the bit, starting from 0 on the right
Add the results
+
Example
(1D9)16 =
(80E1)16 =
(10CE)16 =
+ Use this table
Hex Binary Hex Binary
0 0000 8 1000
1 0001 9 1001
2 0010 A 1010
3 0011 B 1011
4 0100 C 1100
5 0101 D 1101
6 0110 E 1110
7 0111 F 1111
Solutions
(1D9)16 = (473)10
(80E1)16 = (32993)10
(10CE)16 = (4302)10
+
Decimal to Hexadecimal
Decimal Octal
Binary Hexadecimal
+
Decimal to Hexadecimal
Steps
5. The hex value is the digit sequence of the remainders from the
last to firs
+
Decimal to Hexadecimal
Convert the number 256 DECIMAL to HEXADECIMAL
256 / 16 16 0
16 / 16 1 0
1 / 16 0 1
ANSWER 100
+
Decimal to Hexadecimal
Convert the number 921 DECIMAL to HEXADECIMAL
921 / 16 57 9
57 / 16 3 9
3 / 16 0 3
ANSWER 399
+
Decimal to Hexadecimal
Convert the number 188 DECIMAL to HEXADECIMAL
REMAINDER
DIVISION RESULT
(in HEX)
11 / 16 0 B (11 decimal)
ANSWER BC
+
Decimal to Hexadecimal
Convert the number decimals to Hexadecimal:
100 =
590 =
998 =
+ Use this table
Hex Binary Hex Binary
0 0000 8 1000
1 0001 9 1001
2 0010 A 1010
3 0011 B 1011
4 0100 C 1100
5 0101 D 1101
6 0110 E 1110
7 0111 F 1111
100 = 64
590 = 24E
998 = 3E6
+
Decimal to Hexadecimal
Technique
Group bits in fours, starting on right
Convert to hexadecimal digits
+
Recap - Fractions
pp. 46-50
+
Recap - Fractions
Binary to decimal
10.1011 => 1 x 2-4 = 0.0625
1 x 2-3 = 0.125
0 x 2-2 = 0.0
1 x 2-1 = 0.5
0 x 20 = 0.0
1 x 21 = 2.0
2.6875
pp. 46-50
+
Recap - Fractions
Decimal to binary .14579
x 2
3.14579 0.29158
x 2
0.58316
x 2
1.16632
x 2
0.33264
x 2
0.66528
x 2
1.33056
11.001001... etc.
p. 50
+
Home Exercise
Complete the table below
Hexa-
Decimal Binary Octal decimal
29.8
101.1101
3.07
C.82
+
Exercise – Convert …
Answer
Hexa-
Decimal Binary Octal decimal
29.8 11101.110011… 35.63… 1D.CC…
5.8125 101.1101 5.64 5.D
3.109375 11.000111 3.07 3.1C
12.5078125 1100.10000010 14.404 C.82
+
Summary Conversion
The possibilities:
Decimal Octal
Binary Hexadecimal
+ Summary
Number Systems
Chapter 9
Convertingbetween types
The decimal system of number systems
Positional number
systems
The binary system