Chapter2--Number-Systems-and-Codes

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

1InformationNumericData→NumberSystemsNonnumericData→CodesChapter2NumberSystemsandCodes2◆GeneralNumberSystems◆DifferentNumberSystemConversions◆AdditionandSubtractionofNondecimalNumbers◆RepresentationofSigned-Numbers◆AdditionandSubtractionofSigned-Numbers◆BCDCodeandGrayCode3GeneralNumberSystems◆DecimalNumberSystems◆BinaryNumberSystems◆OctalNumberSystems◆HexadecimalNumberSystems4PositionalNumberSystemsAnumberisrepresentedbyastringofdigits,whereeachdigitpositionhasanassociatedweigh,thevalueofanumberisaweightedsumofthedigits.5Anyrnumbersystemcanberepresentedasfollowingformat(ap-1ap-2...a1a0.a-1a-2...a-n)r=ap-1×rp-1+ap-2×rp-2+...+a1×r1+a0×r0+a-1×r-1+a-2×r-2...+a-n×r-n-1=-n=arpiii6r-BaseorRadixofrNumberSystemri-Weighofibitai-rNumberSystemDigitsap-1-MSB(MostSignificantBit)a-n-LSB(LeastSignificantBit)----1-1-21012nr=-n(aaaaaaa)=.arLLpippii7◆DecimalNumberSystems10-BaseorRadixofDecimalNumberSystem10i-Weighofibitdi-DecimalSystemDigits:0~9123.4510=1×102+2×101+3×100+4×10-1+5×10-2----1-1-21012n10=-n(ddddddd)=d0.1LLpippii82-BaseorRadixofBinaryNumberSystem2i-Weighofibitbi-BinarySystemDigits:0、1101.012=1×22+0×21+1×20+0×2-1+1×2-2=5.7510◆BinaryNumberSystems----1-1-21012n2=-n(bbbbbbb)=.b2LLpippii98-BaseorRadixofOctalNumberSystem8i-Weightofibitoi-OctalSystemDigits:0~7436.58=4×82+3×81+6×80+5×8-1=286.62510◆OctalNumberSystems----1-1-21012n8=-n(ooooooo)=.o8LLpippii1016-BaseorRadixofHexadecimalNumberSystem16i-Weighofibithi-HexadecimalSystemDigits:0~9,A~F1CE816=1×163+12×162+14×161+8×160=740010◆HexadecimalNumberSystems----1-1-21012n16=-n(hhhhhhh)=h6.1LLpippii11ExampleWhatisthepossibleradixofthenumber-systeminoperationof302/20=12.1?(3r2+2)/2r=r+2+r-1r(r-4)=0r=0(Discard),r=412GeneralNumber-SystemConversionsConvertanumberinaradixtoequivalentnumberinanotherradix.◆AnyRadix(Radix-r)toDecimal(Radix-10)Sum-of-Weightsmethod13Example.101.012=1×22+0×21+1×20+0×2-1+1×2-2=5.25106531.58=6×83+5×82+3×81+1×80+5×8-1=3417.625107F.816=7×161+15×160+8×16-1=127.51014◆Decimal(Radix-10)toAnyRadix(Radix-r)■IntegerPart—SuccessiveDivisionRadixTheintegerpartisdividedbyr(radix)untilthequotientis0.RemaindersfromMSBtoLSBformanyrintegerpart.15N10=(ap-1ap-2...a1a0)r=ap-1×rp-1+ap-2×rp-2+...+a1×r1+a0×r0=((···((ap-1)r+ap-2)r+···+a2)r+a1)r+a0DivideN10byrremainder1=a0Q1=(···((ap-1)r+ap-2)r+···a2)r+a116DivideQ1byrremainder2=a1Q2=(···((ap-1)r+ap-2)r+···a3)r+a2DivideQ2byrremainder3=a2Q3=(···((ap-1)r+ap-2)r+···a4)r+a317Example.17310=()2012345672173b=1286b=0243b=1221b=1210b=025b=122b=021b=1017310=(10101101)2LSBMSB18■DecimalsPart—SuccessiveMultiplicationRadixThedecimalspartismultipliedbyr(radix)untildecimalfractionis0.0orthedesiredprecision(nbitdecimals’precisionisr-nforradix-r).ThecarrydigitsfromMSBtoLSBformanyrdecimalspart.19N10=(0.a-1a-2...a-n)r=a-1×r-1+a-2×r-2...+a-n×r-n=r-1(a-1+a-2×r-1+···+a-n×r-(n-1))MultiplyN10byrP1=a-1+a-2×r-1+···+a-n×r-(n-1)F1=r-1(a-2+a-3×r-1+···+a-n×r-(n-2))20MultiplyF1byrP2=a-2+a-3×r-1+···+a-n×r-(n-2)F2=r-1(a-3+a-4×r-1+···+a-n×r-(n-3))MultiplyF2byrP3=a-3+a-4×r-1+···+a-n×r-(n-3)F3=r-1(a-4+a-5×r-1+···+a-n×r-(n-3))21Example.0.62510=()2Carriesb-i0.625×2MSBb-1=1←1.250.25×2b-2=0←0.50.5×2LSBb-3=1←1.00.62510=(0.101)222Example.0.2410=()810-28-n≤10-2,n=3Carrieso-i0.24×8MSBo-1=1←1.920.92×8o-2=7←7.360.36×8LSBo-3=2←2.880.2410=(0.172)823Example.108.812510=()8Integer10810=()80128108o=4813o=581o=1010810=(154)8LSBMSB24Decimal0.812510=()8Carrieso-i0.8125×8MSBo-1=6←6.50.5×8LSBo-2=4←4.00.812510=(0.64)8108.812510=(154.64)825◆BinarytoOctal(Hexadecimal)1.Partitionthebinarynumberintogroupsofthree(four),startingatthebinarypointandgoingleftandright.2.Eachgroupofthree(four)correspondstoasingleoctal(hexadecimal)digit.26Example.1011010.101112=()8=()16001011010.101110↓↓↓↓↓(132.56)801011010.10111000↓↓↓↓(5A.B8)1627◆Octal(Hexadecimal)toBinaryEachoctal(hexadecimal)digitcorrespondstothree(four)bitbinarydigits.2374.168=(010,011,111,100.001,110)24C.9FA16=(0100,1100.1001,1111,1010)228ExampleWhatistheresultofoperation721/20inthe8-radixnumbersystem?7218/208=1110100012/24=11101.00012=35.04829AdditionandSubtractionofNondecimalNumbers◆BinaryAddition0+0=0Sumof0withacarryof00+1=1Sumof1withacarryof01+0=1Sumof1withacarryof01+1=10Sumof0withacarryof130Example.101111.12+100011.012CarriesC101111000AugendX101111.10247.510AddendY+100011.012+35.2510———————————SumX+Y1010010.11282.751031◆BinarySubtraction0-0=0Differenceof0withaborrowof01-1=0Differenceof0withaborrowof01-0=1Differenceof1withaborrowof010-1=1Differenceof1withaborrowof1Subtractthesubtrahendfromtheminuend.IfaborrowoutoftheMSBoccurs,resultisoutofrange.32Example.111001012–001011102BorrowsB001111100MinuendX11100101222910SubtrahendY-001011102-4610—————————DifferenceX-Y1011011121831033Example.10002–11112BorrowsB11110MinuendX10002810SubtrahendY-11112-1510———————DifferenceX-Y10012-710X-Y=10012=910≠-71034BorrowsB00000MinuendY111121510SubtrahendX-10002-810———————DifferenceY-X01112710X–Y=-(Y–X)=-01112=-71035◆OctalAdditionExample.41638+75208CarriesC10100AugendX41638216310AddendY+75208+392010————————————SumX+Y13703860831036◆Octal

1 / 103
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功