正在加载图片...
26 Chapter 2 Number Systems and Codes A shortcut for converting whole numbers to radix 10 is obtained by rewrit- ing the expansion formula as follows D=(.(gp-)r+do2)r+).r+d)r+do That is,we start with a sum of 0:beginning with the leftmost digit,we multiply the sum by rand add the next digit to the sum,repeating until all digits have beer processed.For example,we can write F1AC16=((15)16+1·16+10)16+12 what happens if we divide the formula by r.Since the parenthesized part of the formula is evenly divisible by r,the quotient will be 0=(.(p-r+dp-2)r+.)r+d and the remainder will be do.Thus,do can be computed as the remainder of the long division of D by r.Furthermore,the quotient O has the same form as the original formula.Therefore,successive divisions bywill yied ig its of D from right to left,until all the digits of D have been derived.Examples are given below: 179+2=89 remainder 1 (LSB) +2=44 remainder 1 ÷2=22 remainder0 ÷2=1 1 remainder0 ÷2=5 remainder1 ÷2=2 remainder 1 +2=1 remainder 0 ÷2=0 remainder1(MSB) 17910=101100112 467+8=58 remainder 3 (least significant digit) +8=7remainder 2 +8=0 remainder 7 (most significant digit) 46710=723g 3417+16=213 remainder 9 (least significant digit) ÷l6=13 remainder5 +16=0 remainder 13 (most significant digit) 341710=D5916 Table 2-2 summarizes methods for converting among the most common radices. Copyright 1999 by John F.Wakerly Copying Prohibited 26 Chapter 2 Number Systems and Codes DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY Copyright © 1999 by John F. Wakerly Copying Prohibited A shortcut for converting whole numbers to radix 10 is obtained by rewrit￾ing the expansion formula as follows: D = ((· · ·((dp–1)·r + dp–2)·r + · · ·) · · ·r + d1)·r + d0 That is, we start with a sum of 0; beginning with the leftmost digit, we multiply the sum by r and add the next digit to the sum, repeating until all digits have been processed. For example, we can write F1AC16 = (((15)·16 + 1·16 + 10)·16 + 12 Although this formula is not too exciting in itself, it forms the basis for a very convenient method of converting a decimal number D to a radix r. Consider what happens if we divide the formula by r. Since the parenthesized part of the formula is evenly divisible by r, the quotient will be Q = (· · ·((dp–1)·r + dp–2)·r + · · ·)·r + d1 and the remainder will be d0. Thus, d0 can be computed as the remainder of the long division of D by r. Furthermore, the quotient Q has the same form as the original formula. Therefore, successive divisions by r will yield successive dig￾its of D from right to left, until all the digits of D have been derived. Examples are given below: 179 ÷ 2 = 89 remainder 1 (LSB) ÷2 = 44 remainder 1 ÷2 = 22 remainder 0 ÷2 = 11 remainder 0 ÷2 = 5 remainder 1 ÷2 = 2 remainder 1 ÷2 = 1 remainder 0 ÷2 = 0 remainder 1 (MSB) 17910 = 101100112 467 ÷ 8 = 58 remainder 3 (least significant digit) ÷8 = 7 remainder 2 ÷ 8 = 0 remainder 7 (most significant digit) 46710 = 7238 3417 ÷ 16 = 213 remainder 9 (least significant digit) ÷ 16 = 13 remainder 5 ÷ 16 = 0 remainder 13 (most significant digit) 341710 = D5916 Table 2-2 summarizes methods for converting among the most common radices. decimal to radix-r conversion
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有