[ Pobierz całość w formacie PDF ]
.6210 will be converted to an equivalentoctal number.The integer 21910 is divided by 8 repeatedly and the fraction 0.6210 ismultiplied by 8 repeatedly to a precision of three digits.219 8 = quotient = 27, remainder = 3 (3 is the low-order digit)27 8 = quotient = 3, remainder = 33 8 = quotient = 0, remainder = 30.62 8 = 4.96 4 (4 is the high-order digit)0.96 8 = 7.68 70.68 8 = 5.44 5Therefore, 219.6210 = 333.4758.Decimal to hexadecimal The decimal number 195.82812510 will be convertedto an equivalent hexadecimal number.The integer is divided by 16 repeatedly and thefraction is multiplied by 16 repeatedly.195 16 = quotient = 12, remainder = 3 (3 is the low-order digit)12 16 = quotient = 0, remainder = 12 (C)1.1 Number Systems 230.828125 16 = 13.250000 13 (D) (D is the high-order digit)0.250000 16 = 4.000000 4Therefore, 195.82812510 = C3.D416.Binary to octal When converting a binary number to octal, the binary number ispartitioned into groups of three bits as the number is scanned from right to left for inte-gers and scanned left to right for fractions.If the leftmost group of the integer does notcontain three bits, then leading zeroes are added to produce a 3-bit octal digit; if therightmost group of the fraction does not contain three bits, then trailing zeroes areadded to produce a 3-bit octal digit.The binary number 10110100011.111012 will beconverted to an octal number as shown below.0 1 0 1 1 0 1 0 0 0 1 1.1 1 1 0 1 02 6 4 3.7 2Binary to hexadecimal When converting a binary number to hexadecimal, thebinary number is partitioned into groups of four bits as the number is scanned fromright to left for integers and scanned left to right for fractions.If the leftmost group ofthe integer does not contain four bits, then leading zeroes are added to produce a 4-bithexadecimal digit; if the rightmost group of the fraction does not contain four bits,then trailing zeroes are added to produce a 4-bit hexadecimal digit.The binary number11010101000.11110101112 will be converted to a hexadecimal number as shownbelow.0 1 1 0 1 0 1 0 1 0 0 0.1 1 1 1 0 1 0 1 1 1 0 06 A 8.F 5 COctal to binary When converting an octal number to binary, three binary digits areentered that correspond to each octal digit, as shown below.2 7 5 4.3 60 1 0 1 1 1 1 0 1 1 0 0.0 1 1 1 1 0When converting from octal to binary-coded octal (BCO) and from octal to binary,the binary bit configurations are identical.This is because the octal number systemuses all eight combinations of three bits.24 Chapter 1 Number Systems and Number RepresentationsOctal to hexadecimal To convert from octal to hexadecimal, the octal number isfirst converted to BCO then partitioned into 4-bit segments to form binary-codedhexadecimal (BCH).The BCH notation is then easily changed to hexadecimal, asshown below.7 6 3 5.4 61 1 1 1 1 0 0 1 1 1 0 1.1 0 0 1 1 0 0 0F 9 D.9 8Hexadecimal to binary To convert from hexadecimal to binary, substitute thefour binary bits for the hexadecimal digits according to Table 1.10 as shown below.F A 9 7.B 61 1 1 1 1 0 1 0 1 0 0 1 0 1 1 1.1 0 1 1 0 1 1 0When converting from hexadecimal to BCH and from hexadecimal to binary, thebinary bit configurations are identical.This is because the hexadecimal number sys-tem uses all sixteen combinations of four bits.Hexadecimal to octal When converting from hexadecimal to octal, the hexadec-imal digits are first converted to binary.Then the binary bits are partitioned into 3-bitsegments to obtain the octal digits, as shown below.B 8 E.4 D1 0 1 1 1 0 0 0 1 1 1 0.0 1 0 0 1 1 0 1 05 6 1 6.2 3 2Conversion from radix 5 to radix 10 Equation 1.4 is reproduced below asEquation 1.8 for convenience and will be used to convert the following radix 5 numberto an equivalent radix 10 number: 2134.435.A =(1.8)an 1 rn 1 + & + a1r1 + a0r0 + a 1r 1 + a 2r 2 + & + a m r m2134.435 = (2 53) + (1 52) + (3 51) + (4 50).(4 5 1) + (3 5 2)= 250 + 25 + 15 + 4 + 0.8 + 0.12= 294.92101.1 Number Systems 25Convert from radix ri to any other radix rj To convert any nondecimal num-ber Ari in radix ri to another nondecimal number Arj in radix rj, first convert the num-ber Ari to decimal using Equation 1.4, then convert the decimal number to radix rj byusing repeated division and/or repeated multiplication.The radix 9 number 1259 willbe converted to an equivalent radix 7 number.First 1259 is converted to radix 10.1259 = (1 92) + (2 91) + (5 90)= 10410Then, convert 10410 to radix 7.104 7 = quotient = 14, remainder = 6 (6 is the low-order digit)14 7 = quotient = 2, remainder = 02 7 = quotient = 0, remainder = 2Verify the answer.1259 = 2067 = (2 72) + (0 71) + (6 70)= 10410Determine the value of an unknown radix The equation shown below has anunknown radix a.This example will determine the value of radix a.44a0.5 = 61044a = 3610(4 a1) + (4 a0) = (3 101) + (6 100)4a + 4 = 30 + 64a = 32a = 8Verify the answer.448 = (4 81) + (4 80)= 361026 Chapter 1 Number Systems and Number Representations1.2 Number RepresentationsComputers use both positive and negative numbers, and since a computer cannot rec-ognize a plus (+) or a minus ( ) sign, an encoding method must be established to rep-resent the sign of a number in which both positive and negative numbers aredistributed as evenly as possible.There must also be a method to differentiate between positive and negative num-bers; that is, there must be an easy way to test the sign of a number.Detection of anumber with a zero value must be straightforward.The leftmost (high-order) digit isusually reserved for the sign of the number.Consider the following number A withradix r :A = (an 1 an 2 an 3 & a2 a1 a0 )rwhere digit an 1 has the value shown in Equation 1.9.A = { 0 if A e" 0(1.9)r 1 if A eB= (eB eA)[( fA r ) fB ] reB for eA d" eB (1.25)=Before alignmentA = 0.1 0 0 1 0 0 1 0 26 +36.5B = 0.1 0 1 1 1 0 0 0 23 +5.75After alignmentA = 0.1 0 0 1 0 0 1 0 26 +36.5B = 0.0 0 0 1 0 1 1 1 26 +5.75Subtract fractionsA = 0.1 0 0 1 0 0 1 0 26+) B' + 1 = 0.1 1 1 0 1 0 0 1 261 ! 0.0 1 1 1 1 0 1 1 26 +30.75Postnormalize (SL1) 0.1 1 1 1 0 1 1 0 25 +30.75Figure 1.22 Example of floating-point subtraction requiring fraction alignment.44 Chapter 1 Number Systems and Number RepresentationsFloating-point multiplication Floating-point multiplication is slightly easierthan addition or subtraction, because the exponents do not have to be compared andthe fractions do not have to be aligned.For floating-point multiplication, the expo-nents are added and the fractions are multiplied.Both operations can be done in par-allel
[ Pobierz całość w formacie PDF ]