正在加载图片...
28 Chapter 2 Number Systems and Codes Table 2-3 Binary addition and Cin or bin x V Cout bout subtraction table 0 0 0 0 0 0 0 1 0 0 0 0 1 1 00 0 0 1 0 0 1 1 1 1 1 1 2.4 Addition and Subtraction of Nondecimal Numbers Addition and subtraction of nondecimal numbers by hand uses the same tech- nique that we learned in grammar school for decimal numbers;the only catch is binary addition Table 2-3 is the addition and subtraction table for binary digits.To add two binary numbers Xand y,we add together the least significant bits with an initial carry (c producing carry (and sum (s)bits according to the table.We continue processing bits from right to left,adding the carry out of each column into the next column's sum. Two examples of decimal additions and the corresponding binary additions are shown in Figure,arrow to indicate acarry of The same examples are repeated below along with two more,with the carries shown as a bit string C: 101111000 001011000 190 10111110 173 10101101 Y+141 +10001101 +44 +00101100 X+Y331 101001011 X+Y217 11011001 011111110 c 000000000 X 127 01111111 X 170 10101010 +63 +00111111 +85 +01010101 X+Y190 10111110 X+y255 11111111 binary subtraction Binary subtraction is performed similarly,using borrows (bin and bout) instead of carries between steps,and producing a difference bit d.Two examples minuend of decim subtractions and the corresponding binary subtractions are shown in subtrahend Figure 2-2.As in decimal subtraction,the binary minuend values in the columns are modified when borrows occur,as shown by the colored arrows and bits.The Copyright 1999 by John F.Wakerly Copying Prohibited 28 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 2.4 Addition and Subtraction of Nondecimal Numbers Addition and subtraction of nondecimal numbers by hand uses the same tech￾nique that we learned in grammar school for decimal numbers; the only catch is that the addition and subtraction tables are different. Table 2-3 is the addition and subtraction table for binary digits. To add two binary numbers X and Y, we add together the least significant bits with an initial carry (cin) of 0, producing carry (cout) and sum (s) bits according to the table. We continue processing bits from right to left, adding the carry out of each column into the next column’s sum. Two examples of decimal additions and the corresponding binary additions are shown in Figure 2-1, using a colored arrow to indicate a carry of 1. The same examples are repeated below along with two more, with the carries shown as a bit string C: Binary subtraction is performed similarly, using borrows (bin and bout) instead of carries between steps, and producing a difference bit d. Two examples of decimal subtractions and the corresponding binary subtractions are shown in Figure 2-2. As in decimal subtraction, the binary minuend values in the columns are modified when borrows occur, as shown by the colored arrows and bits. The Table 2-3 Binary addition and subtraction table. cin or bin xy cout s bout d 0 00 0 0 0 0 0 01 0 1 1 1 0 10 0 1 0 1 0 11 1 0 0 0 1 00 0 1 1 1 1 01 1 0 1 0 1 10 1 0 0 0 1 11 1 1 1 1 C X Y 190 +141 101111000 10111110 + 10001101 C X Y 173 + 44 001011000 10101101 + 00101100 X + Y 331 101001011 X + Y 217 11011001 C X Y 127 + 63 011111110 01111111 + 00111111 C X Y 170 + 85 000000000 10101010 + 01010101 X + Y 190 10111110 X + Y 255 11111111 binary addition binary subtraction minuend subtrahend
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有