Professional Documents
Culture Documents
William Stallings
Computer Organization
and Architecture
10th Edition
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)
4 7 2 2 5 6
100s 10s 1s tenths hundredths thousandths
102 101 100 10–1 10–2 10–3
position 2 position 1 position 0 position –1 position –2 position –3
( . . . a3a2a1a0.a-1a-2a-3 . . . )r
P o s it io n 4 3 2 1 0 –1
Va lu e in
e x p o n e n t ia l 74 73 72 71 70 7–1
fo rm
D e c im a l
2401 343 49 7 1 1/7
v a lu e
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:
Decimal notation to
binary notation:
Integer and fractional parts are
handled separately
Converting Between
Binary and Decimal
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
For the integer part, recall that in binary notation, an integer represented by
bm-1bm-2 . . . b2b1b0 bi = 0 or 1
N = 2 * N1 + R0 R0 = 0 or 1
Next, we divide the quotient N1 by 2. Assume that the new quotient is N2 and the new
remainder R1. Then
N1 = 2 * N2 + R1 R1 = 0 or 1
so that
N2 = 2N3 + R2
we have
Continued . . .
N = (N3 * 23) + (R2 * 22) + (R1 * 21) + R0
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Integers
Because N >N1 > N2 . . . , continuing this sequence will
eventually produce a quotient Nm-1 = 1 (except for the
decimal integers 0 and 1, whose binary equivalents are 0 and
1, respectively) and a remainder Rm-2, which is 0 or 1. Then
5
Quotient Remainder
= 2 1 11 =
2 5 1
2
2 = 1 0
2 5 = 2 1
2
1 = 0 1
2 2 = 1 0
1011 2 = 11 10 2
(a) 1110 1 = 0 1
2
1011 2 = 1110
10 = 5 0
2 Quotient Remainder
5
21 = 10 1
= 2 1 2
2
2 10 = 5 0
= 1 0
2 2
1 = 0 1 5 = 2 1
2 2
10101 2 = 21 10
2 = 1 0
(b) 2110 2
1 = 0 1
Figure 9.1 Examples of Converting fr om Decimal 2
Notation to Binary Notation for Integers
101012 = 21 10
(b) 2110
Quotient Remainder
11 = 5 1
2
5 = 2 1
2
2 = 1 0
2
1 = 0 1
2
1011 2 = 11 10
(a) 11 10
Quotient Remainder
21 = 10 1
2
10 = 5 0
2
5 = 2 1
2
2 = 1 0
2
1 = 0 1
2
10101 2 = 21 10
(b) 21 10
Figure 9.2
0.81 2 = 1.62 1
0.62 2 = 1.24 1
0.24 2 = 0.48 0
0.48 2 = 0.96 0
0.25
Product
2 = 0.5
Integer Part
0
0.01 2
Decimal Notation
0.5 2 = 1.0 1 To
(b) 0.25 10 = 0.01 2 (exactly)
Binary Notation
Figure 9.2 Examples of Converting fr om Decimal
Notation to Binary Notation for Fractions
For Fractions
Product Integer Part 0.110011 2
0.81 2 = 1.62 1
0.62 2 = 1.24 1
0.24 2 = 0.48 0
0.48 2 = 0.96 0
0.96 2 = 1.92 1
0.92 2 = 1.84 1
0.5 2 = 1.0 1
Because 16 symbols are used, the notation is called hexadecimal and the 16
symbols are the hexadecimal digits
Thus
+
( bas e 1 0 ) ( bas e 1 6 )
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
Table 9.3 8 1000 8
9 1001 9
10 1010 A
Decimal, Binary, 11
12
1011
1100
B
C
and Hexadecimal 13
14
1101
1110
D
E
15 1111 F
16 0001 0000 10
17 0001 0001 11
18 0001 0010 12
31 0001 1111 1F
100 0110 0100 64
255 1111 1111 FF
Chapter 9
Convertingbetween
The decimal system binary and decimal
Integers
Positional number Fractions
systems
Hexadecimal notation
The binary system