计算机应用基础英文版课件:2-Data representation in computers_第1页
计算机应用基础英文版课件:2-Data representation in computers_第2页
计算机应用基础英文版课件:2-Data representation in computers_第3页
计算机应用基础英文版课件:2-Data representation in computers_第4页
计算机应用基础英文版课件:2-Data representation in computers_第5页
已阅读5页,还剩57页未读 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

计算机应用基础FundamentalsofComputerandComputingFundamentalsofComputerandComputingChapter#1

ProblemsolvinginCSChapter#2

Datarepresentationincomputers

Chapter#3

HardwareChapter#4

OperatingsystemChapter#5

NetworkandinternetChapter#6

DatabasemanagementsystemChapter#7

ComputingasadisciplineChapter#8

AlgorithmandprogrammingThefocusofthischapter:

Whyisbinaryrepresentionadoptedincomputers?Howisdatastoredincomputermemory?Howiscomputationcarriedout?Howtodealwithcharactersincomputer?Howtorepresentmultimedeainformation?Howtoencodeandrecognizebarcodes?Whyisstandardizationofinformationneeded?Chapter#2Datarepresentationincomputers

2.1Numbersystemsandtheirconversion

Howisdatastoredincomputer

Numbersystems

Conversionbetweennumbersystems

2.2Binaryrepresentationandarithmetic

2.3Encodingofcharacter

2.4Encodingofmultimediainformation

2.5Barcodeand

RFIDChapter#2DatarepresentationincomputersComputersaremultimediadevices,dealingwithmanycategoriesofinformation.Computersstore,present,andhelpmodify:NumbersTextAudioImagesandgraphicsVideoDataandComputersInformationcanberepresentedinoneoftwoways:analogordigital.AnalogdataAcontinuousrepresentation,analogoustotheactualinformationitrepresents.DigitaldataAdiscreterepresentation,breakingtheinformationupintoseparateelements.

AnalogandDigitalInformationComputerscannotworkwellwithanaloginformation,sowedigitizeinformationbybreakingitintopiecesandrepresentingthosepiecesseparately.Whydoweusebinary?Moderncomputersaredesignedtouseandmanagebinaryvaluesbecausethedevicesthatstoreandmanagethedataarefarlessexpensiveandfarmorereliableiftheyonlyneedtorepresentoneoftwopossiblevalues.AnanalogandadigitalsignalAnalogandDigitalInformationHighvoltageLowvoltageBinarycomputershavestorageunitscalledbinarydigitsorbitsbit:ThesmallestelementEitherbe0(LowVoltage)or1(HighVoltage)Byte:Thesmalleststorageunit1Byte=8bitsStorageunit

(B,KB,MB,GB,TB):1KB=210B=1024B;1MB=220B=1024KB=10242B;1GB=230B=1024MB=10242KB=10243B;1TB=240B=1024GB=10242MBComputerStorage1Onebitcanbeeither0or1.Therefore,onebitcanrepresentonlytwothings.

32Torepresentmorethantwothings,weneedmultiplebits.2bitscanrepresent4things:00,01,10,11.Ifwewanttorepresentmorethanfourthings,weneedmorethantwobits.3bitscanrepresent8things.

CodeofnumericaldataIngeneral,nbitscanrepresent2nthingsbecausethereare2ncombinationsof0and1thatcanbemadefromnbits.Notethateverytimeweincreasethenumberofbitsby1,wedoublethenumberofthingswecanrepresent.EightDiagrams

2.1Numbersystemsandtheirconversion

Howisdatastoredincomputer

Numbersystems

Conversionbetweennumbersystems

2.2BinaryrepresentationandarithmeticChapter#2Datarepresentationincomputers1.

Numbersystemandbase

Numbersystem

Base

ThebaseofanumberdeterminesthenumberofdigitsandthevalueofdigitpositionsHowtoexpresstheamount?NumbersystemDecimalnumbers,e.g.,642TimeThereare12monthsinoneyearThereare7daysinoneweekThereare60minutesinonehour2.Categories

Decimalconsistsof10digits0,1,2,3,4,5,6,7,8,9Base10

Binaryconsistsof2digits0,1Base2

Octal

consistsof8digits0,1,2,3,4,5,6,7Base8

Hexadecimalconsistsof16digits0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,FBase16Numbersystem

Numbersystem

Base

ThebaseofanumberdeterminesthenumberofdigitsandthevalueofdigitpositionsCarryCarrywillbeperformedwhenthesumoftwonumbersisgreaterthanthelargestdigitinthenumbersystembeingused.Arithmeticofnumbers

Decimalconsistsof10digits0,1,2,3,4,5,6,7,8,9Base10

Binaryconsistsof2digits0,1Base2Binary:CarryValues 111111 1010111

+100101110100010

111 1010111

-111011

0011100 BorrowValuesArithmeticofnumbers(1)Subscript(101)2(101)8(101)10(101)16(N)rDigits

Binary

Octal

Decimal

HexadecimalNumbersystemHowtodistinguish

numbersystem?(2)Postfix101B101O

101D101HNumbersystem(S)R=KiRi

Ki{0,1,……,R-1}

ni=-m(25.6)1021015100610-1(52.6)858128068-1Whichisbigger?(25.6)10or(52.6)8

3.Power(1)Conceptn:Digitsofinteger–1m:DigitsofdecimalfractionR:Base Ri:Power(thepositionofthenumber)Numbersystem(2)Spreadnumbers(1234)10=1103+2102+3101+4100(3)PowersunderdifferentnumbersystemsInteger:fromrighttolefti=0,1,2,3……Decimalfraction

:fromlefttoright

i=-1,-2,-3…...PowerDecimal(D)10iOctal(O)Binary(B)Hexadecimal(H)16i8i2ii

(1234)16=1163+2162+3161+4160RiNumbersystem4.ComparisonofdifferentnumbersystemsNumbersystem

2.1Numbersystemsandtheirconversion

Howisdatastoredincomputer

Numbersystems

Conversionbetweennumbersystems

2.2Binaryrepresentationandarithmetic

2.3Encodingofcharacter

2.4Encodingofmultimediainformation

2.5Barcodeand

RFIDChapter#2DatarepresentationincomputersThreecasesNon-DecimaltoDecimalDecimaltoNon-DecimalNon-DecimaltoNon-DecimalConvertingnumberInteger:10010112

1001011266425322416238224212201Powercode1×26+0×25+0×24+1×23+0×22+1×21+1×20=75Spreadnumberbypower1BinaryDecimalDecimalfraction:0.10102

10102-10.52-20.252-30.1252-40.0625Powercode1×2-1+0×2-2+1×2-3+0×2-4=0.62510Non-DecimaltoDecimal2.OctalDecimal

(375.42)8

=(?)10(375.42)8 =3×82+7×81+5×80+4×8-1+2×8-2

=192

+56

+5+0.5+0.03 =(253.53)10253.53SpreadnumberbypowerNon-DecimaltoDecimal(ABC.DE)16=(?)10(ABC.DE)16=10×162+11×161+12×160+13×16-1+14×16-2

=2560

+176

+12+0.81+0.05=(2748.86)102748.86Spreadnumberbypower3.

HexadecimalDecimal

Non-DecimaltoDecimalDecimalinteger:numberis

dividedby2,theremaindersarranged

inreverseorder.example:75÷2=37…………137÷2=18…………118÷2=9…………09÷2=4…………14÷2=2…………02÷2=1…………01÷2=0…………1result: 7510=1001011

21.DecimalBinaryAlldecimalintegercanbeconvertedtobinaryexactly.

remainder(75)10=(?)21001011DecimaltoNon-DecimalDecimalfraction:

multiplybase2,arrangetheintegerpartinorder.Example:0.6531×2=1.3062……10.3062×2=0.6124……00.6124×2=1.2248……10.2248×2=0.4496……00.4496×2=0.8992……0……(0.6531)10≈(0.10100)2

Note:Ingeneral,decimalfraction

can’tbeconvertedtobinaryexactly.(0.6531)10=(?)2DecimaltoNon-Decimal(49.58)10=(?)2110001

0.58

21.16

20.32

20.64100Example:convert49.58tobinaryform.

Integerpart:Decimalfractionpart:

249224----1

212----026----023----021----10----1.DecimaltoNon-DecimalDecimalinteger:numberis

dividedby8,theremaindersarranged

inreverseorder.Decimalfraction:multiplybase8,arrangetheintegerpartinorder.

2.DecimalOctal

8

2538

31----5

8

3----7

0----3

0.53

84.24

81.92

87.36(253.53)10

=()8375.42DecimaltoNon-DecimalDecimalinteger:numberis

dividedby16,theremaindersarranged

inreverseorder.Decimalfraction:multiplybase16,arrangetheintegerpartinorder.

2.DecimalHexadecimal?DecimaltoNon-Decimal(1)BinaryOctal(10

111

011.110

1)2

=()8(2)OctalBinary(6754.32)8

=()2110111101100011010..2736423=8Keypoint:Groupsofthree

ConverteachgroupIflessthanthree,fillwith0Non-DecimaltoNon-Decimal(1)Binary

Hexadecimal(1011

1110

0110.11011)2

=()16(2)

HexadecimalBinary(A7B8.C9)16

=()2101001111011100011001001..BE6D824=16Keypoint:Groupsoffour

ConverteachgroupIflessthanfour,fillwith0Non-DecimaltoNon-Decimal

Octal

Hexadecimal?Non-DecimaltoNon-Decimal

2.1Numbersystemsandtheirconversion

2.2Binaryrepresentationandarithmetic

Integernumber

RealnumerLogicalRepresentation

Chapter#2DatarepresentationincomputersThetiptopdigitofbinarynumbershowthesign

“0”means“+” “1”means“–”

a=+10,b=–10,expressthemusing8-bitsbinary?00100100

a=+1001100100

b=-10Alsocalledoriginalcode.PositiveandNegativeNumberTherearetwooriginalcodesfor0[+0]original=00000000[-0]original=10000000Therangeoforiginalcode–(2n–1–1)~(2n–1–1)Totalnumberis2n–1Ifn=8,therangeis:-127~

+1271111111101111111OriginalCodePro:Simple&DirectCons:SubtractionoperationmayfailExample:

(-4)+(-3)=-7Originalcodeis

1000000000000100

plus

10000000000000111000000000000100+1000000000000011

100000000000001117OverflowSolution:ComplementCodeOriginalCode126171011543298126171011543298①Adjust7hoursclockwise②Adjust5hoursanticlockwise.126171011543298Correctclockfrom11’clockto6?ComplementCorrectclockfrom11’clockto6+711+7=12+6=6–511-5=6+7isacomplementof–5

whenthemodulusis12RemovethemodulusDefinition:Complement=Modulus+OriginalModulus-RnThecapacityofacounterRisthebaseandnisthenumberofdigitsComplementHowtogetthecomplementIfthenumberispositive,itscomplementcodeequalsitsoriginalcodeIfthenumberisnegative,thenStep1:GettheOriginalcode.Step2:Alldigitsareinreversebutthesign.

Step3:Plus1.

Complement

Q:a=+8,b=-8,whatis[a]comp

and[b]comp,wheren=8.

Solution:[a]comp

=[a]ori

=00001000Reversealldigitsbutthesign;00010001

get[b]ori:[b]ori:[b]comp

=1111

110

111111000Plus1;[b]comp:1110

011

0ComplementComplementofcomplement=originalThereareonlyonecomplementcodefor0[-0]complement=11111111+1=100000000=00000000=[+0]complementTherangeofcomplementcode–2n–1~(2n–1–1)Totalnumberis2nIfn=8,therangeis:-128~

+1271000000001111111ComplementAllarithmeticoperationsareexecutedincomplementcode.Subtractionisconvertedintoadditiona–b=a+(-b)Thesignistreatedthesameasotherdigits.Formulas:[a]comp+[b]comp=[a+b]comp[a]comp-[b]comp=[a-b]comp[[a]comp]comp=[a]oriArithmeticinComplementWhenn=8,a=4,b=16,computetheresultofa-b?[a-b]comp=[a]comp+[-b]comp[4]comp

=

00000100[–16]ori

=

10010000[–16]comp=

11110000[a-b]ori=[[a-b]comp]comp=100011001111010000000100+11110000Takethesignasavalue-12NegativevalueArithmeticinComplementWhenn=8,a=4,b=16,computetheresultofb-a?[b-a]comp=[b]comp+[-a]comp[16]comp

=

00010000[–4]ori

=

10000100[–4]comp=

11111100[b-a]ori=[[b-a]comp]comp=

00001100

1

0

0

0

0

110000010000+11111

10012overflowPositivevalueArithmeticinComplementPositivenumber:complement=originalNegativenumber:

Original:signbitis1,therestisitsabsolutevalueComplement:reversealldigitsexceptthesign,theplus1Complementofcomplement=originalSummaryforNumberRepresentation

2.1Numbersystemsandtheirconversion

2.2Binaryrepresentationandarithmetic

Integernumber

Realnumer

LogicalRepresentation

Chapter#2DatarepresentationincomputersAdecimalrealvalueisdefinedbytheformulasign*mantissa*10expFloatingpointnotation3.14159X1000.314159X1010.0314159X102M•REMantissaBaseexponentFloatingPointRepresentationFloatingpointnotationAnumericformatthatcanbeusedtorepresentverylarge

realnumbersandverysmallrealnumbers.Floating-pointnumbersarestoredintwoparts,amantissa

andanexponent.Mantissa:numericalvalueExponent:therealposition

signdigitssigndigitsmantissaexponentFloatingPointRepresentation1bit7bits1bit23bits32-bitsfloat:1.6875=(1.1011)2=(0.11011×21)2=(0.011011×22)2=(0.0011011×23)2000000010110110000000000000000000000001000110110000000000000000000000011000110110000000000000000NormalizeFloatingPointRepresentationThefirstbitofthemantissamustbe1topreventmultiplerepresentationsofthesamevalue.Normalize0.0001230.123*10-3(0.000101)2(0.101)2*2-3FloatingPointRepresentationExample:Howtorepresent1.6875incomputerasa32-bitsfloating-pointnumber?Assuming8bitsofexponentpartand24bitsofmantissapart.1.6875=(1.1011)2=(0.11011×21)200000001011011000000000000000000FloatingPointRepresentationExample:Howtorepresent-1.6875incomputerasa32-bitsfloating-pointnumber?Assuming8bitsofexponentpartand24bitsofmantissapart.-1.6875=(-1.1011)2=(-0.11011×21)200000001111011000000000000000000FloatingPointRepresentationIna32bitscomputer,if8bitsforexponentpartand24bitsformantissapart,therangeofnumberis1038~2-1500-1038~-2-150FloatingPointRepresentation

2.1Numbersystemsand

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论