正在加载图片...
Section 2.3 General Positional Number System Conversions 25 WHEN I'M 64 As you grow older,you'll find that the hexadecimal number system is useful for thcmper When tud40 Itodhhds The 16 as whi d under my breath,o ,Atag People get all excited about decennial birthdays like 20,30,40,50,.but you should be able to convince your friends that the decimal system is of no fundamental significance.More significant life changes occur around birthdays2,4,8,16,32,and 64.when you add a most significant bit to your age.Why do you think the Beatles sang"When I'm sixty-four"? example,what are the octal values of the four 8-bit bytes in the 32-bit number with octal representation 12345670123g? In the hexadecimal system,two digits represent an 8-bit byte,and 2n digits represent word each pair of digits utes exactly one byte.For example,the 32-bit hexadecimal number 5678ABCD consists of four bytes with values 5616,7816,AB16,and CD16.In this context,a 4-bit hexadecimal digit is sometimes called a nibble;a 32-bit(4-byte)number has eight nibbles.Hexa- nibble decimal numbers are often used to describe a computer's memory address space For example,a computer with 16-bit addresses might be described as having read/write memory installed at addresses 0-EFFF16 and read-only memory at addresses F000-FFFF6Many computer programming languages use the prefix Ox"to denote a hexadecimal number,for example,0xBFC0000. 0x prefix 2.3 General Positional Number System Conversions In general,conversion between two radices cannot be done by simple substitu tions;arithmetic operations are required.In this section,we show how to convert a number in any radix to radix 10 and vice versa,using radix-10 arithmetic. In Section 2.1,we indicated that the value ofa number in any radix is given radix-r to decima by the formula D=dr wherer is the radix of the number and there are p digits to the left of the radix point and n to the right.Thus.the value of the number can be found by convert- ing each digit of the number to its radix-10 equivalent and expanding the formula using radix-10 arithmetic.Some examples are given below 1CE816=116+12-12+1416+8160=740010 F1A316=15·16+1162+10-16+316=6185910 436.5g=482+38+680+581=286.62510 132.34=1·42+341+240+31-=30.7510 Copyright 1999 by John F.Wakerly Copying ProhibitedSection 2.3 General Positional Number System Conversions 25 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 example, what are the octal values of the four 8-bit bytes in the 32-bit number with octal representation 123456701238? In the hexadecimal system, two digits represent an 8-bit byte, and 2n digits represent an n-byte word; each pair of digits constitutes exactly one byte. For example, the 32-bit hexadecimal number 5678ABCD16 consists of four bytes with values 5616, 7816, AB16, and CD16. In this context, a 4-bit hexadecimal digit is sometimes called a nibble; a 32-bit (4-byte) number has eight nibbles. Hexa￾decimal numbers are often used to describe a computer’s memory address space. For example, a computer with 16-bit addresses might be described as having read/write memory installed at addresses 0–EFFF16, and read-only memory at addresses F000–FFFF16. Many computer programming languages use the prefix “0x” to denote a hexadecimal number, for example, 0xBFC0000. 2.3 General Positional Number System Conversions In general, conversion between two radices cannot be done by simple substitu￾tions; arithmetic operations are required. In this section, we show how to convert a number in any radix to radix 10 and vice versa, using radix-10 arithmetic. In Section 2.1, we indicated that the value of a number in any radix is given by the formula where r is the radix of the number and there are p digits to the left of the radix point and n to the right. Thus, the value of the number can be found by convert￾ing each digit of the number to its radix-10 equivalent and expanding the formula using radix-10 arithmetic. Some examples are given below: 1CE816 = 1·163 + 12·162 + 14·161 + 8·160 = 740010 F1A316 = 15·163 + 1·162 + 10·161 + 3·160 = 6185910 436.58 = 4·82 + 3·81 + 6·80 + 5·8–1 = 286.62510 132.34 = 1·42 + 3·41 + 2·40 + 3·4–1 = 30.7510 WHEN I’M 64 As you grow older, you’ll find that the hexadecimal number system is useful for more than just computers. When I turned 40, I told friends that I had just turned 2816. The “16” was whispered under my breath, of course. At age 50, I’ll be only 3216. People get all excited about decennial birthdays like 20, 30, 40, 50, ., but you should be able to convince your friends that the decimal system is of no fundamental significance. More significant life changes occur around birthdays 2, 4, 8, 16, 32, and 64, when you add a most significant bit to your age. Why do you think the Beatles sang “When I’m sixty-four”? nibble 0x prefix radix-r to decimal conversion D di r i ⋅ i n = – p – 1 = ∑
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有