正在加载图片...
24 Chapter 2 Number Systems and Codes Table 2-1 3-Bit Binary,decimal 4-Bit Binary Decimal Octal String Hexadecimal String 0 0 0 000 0 0000 numbers. 1 001 0001 10 2 2 010 2 0010 1 3 3 011 3 0011 4 100 4 0100 101 5 101 0101 6 6 110 6 0110 111 7 111 0111 1000 8 10 1000 1001 9 11 9 1001 1010 10 12 A 1010 1011 11 B 1011 1100 14 1100 1101 3 15 D 1101 1110 14 6 E 1110 1111 15 1 1111 If a binary number contains digits to the right of the binary point,we can convert them to octal or hexadecimal by starting at the binary point and working right.Both the left-hand and right-hand sides can be padded with zeroes to get multiples of three or four bits,as shown in the example below: 10.10110010112=010.1011001011002=2.5454g =0010.1011001011002=2.B2C16 octal or hexadecimal to Converting in the reverse direction,from octal or hexadecimal to binary,is binary comversion very easy.We simply replace each octal or hexadecimal digit with the corre- sponding 3-or 4-bit string,as shown below 13573=0010111011112 2046.17g=010000100110.0011112 BEAD16=10111110101011012 9F.46C16=1001111.0100011011002 The octal number system was quite popular 25 years ago because of certain minicomputers that had their front-panel lights and switches arranged in groups of three.However,the octal number system is not used much today,because of byte the preponderance of machines that process 8-bit bytes.It is difficult to extract individual byte values in multibyte quantities in the octal representation,for Copyright 1999 by John F.Wakerly Copying Prohibited 24 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 If a binary number contains digits to the right of the binary point, we can convert them to octal or hexadecimal by starting at the binary point and working right. Both the left-hand and right-hand sides can be padded with zeroes to get multiples of three or four bits, as shown in the example below: Converting in the reverse direction, from octal or hexadecimal to binary, is very easy. We simply replace each octal or hexadecimal digit with the corre￾sponding 3- or 4-bit string, as shown below: The octal number system was quite popular 25 years ago because of certain minicomputers that had their front-panel lights and switches arranged in groups of three. However, the octal number system is not used much today, because of the preponderance of machines that process 8-bit bytes. It is difficult to extract individual byte values in multibyte quantities in the octal representation; for Table 2-1 Binary, decimal, octal, and hexadecimal numbers. Binary Decimal Octal 3-Bit String Hexadecimal 4-Bit String 0 0 0 000 0 0000 1 1 1 001 1 0001 10 2 2 010 2 0010 11 3 3 011 3 0011 100 4 4 100 4 0100 101 5 5 101 5 0101 110 6 6 110 6 0110 111 7 7 111 7 0111 1000 8 10 — 8 1000 1001 9 11 — 9 1001 1010 10 12 — A 1010 1011 11 13 — B 1011 1100 12 14 — C 1100 1101 13 15 — D 1101 1110 14 16 — E 1110 1111 15 17 — F 1111 10.10110010112 = 010 . 101 100 101 1002 = 2.54548 = 0010 . 1011 0010 11002 = 2.B2C16 13578 = 001 011 101 1112 2046.178 = 010 000 100 110 . 001 1112 BEAD16 = 1011 1110 1010 11012 9F.46C16 = 1001 111 . 0100 0110 11002 octal or hexadecimal to binary conversion byte
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有