admin 管理员组

文章数量: 1184232


2024年2月20日发(作者:currenttime什么意思)

(*ibeta==2&&!i)--(*maxexp);if(i>20)--(*maxexp);if(a!=y)*maxexp-=2;*xmax=one-(*epsneg);if((*xmax)*one!=*xmax)*xmax=one-beta*(*epsneg);*xmax/=(*xmin*beta*beta*beta);i=(*maxexp)+(*minexp)+3;for(j=1;j<=i;j++){if(*ibeta==2)*xmax+=*xmax;else*xmax*=beta;}}Sometypicalvaluesreturnedbymachararegiveninthetable,-compliantmachinesreferredtointhetableincludemostUNIXworkstations(SUN,DEC,MIPS),withfloatingco-processorsaregenerallyIEEE-compliant,exceptthatsomecompilersunderflowintermediateresultsungracefully,yieldingirnd=,asinthecaseofaVAX(fourthcolumn),thatrepresentationswitha“phantom”leading1bitinthemantissaachieveasmallerepsforthesamewordlength,butcannotunderflEFERENCESANDFURTHERREADING:Goldberg,D.1991,ACMComputingSurveys,vol.23,pp.5–,W.J.1988,ACMTransactionsonMathematicalSoftware,vol.14,pp.303–311.[1]Malcolm,M.A.1972,CommunicationsoftheACM,vol.15,pp.949–951.[2]IEEEStandardforBinaryFloating-PointNumbers,ANSI/IEEEStd754–1985(NewYork:IEEE,1985).[3]20.2GrayCodesAGraycodeisafunctionG(i)oftheintegersi,thatforeachintegerN≥0isone-to-onefor0≤i≤2N−1,andthathasthefollowingremarkableproperty:ThebinaryrepresentationofG(i)andG(i+1)pleofaGraycode(infact,themostcommonlyusedone)isthesequence0000,0001,0011,0010,0110,0111,0101,0100,1100,1101,1111,1110,1010,1011,1001,and1000,fori=0,...,orithmforgeneratingthiscodeissimplytoformthebitwiseexclusive-or(XOR)ofiwithi/2(integerpart).Thinkabouthowthecarriesworkwhenyouaddonetoanumberinbinary,lalsoseethatG(i)andG(i+1)differinthebitpositionoftherightmostzerobitofi(prefixingaleadingzeroifnecessary).Thespellingis“Gray,”not“gray”:ThecodesarenamedafteroneFrankGray,whofiencoderisawheelwithconcentriccodedstripeseachofwhichis“read”byafiious,butwrong,waytobuildashaftencoderistohaveonestripe(theinnermost,say)conductingonhalfthewheel,butinsulatingontheotherhalf;thenextstripeisconductinginquadrants1and3;thenextstripeisconductinginoctants1,3,5, or call 1-800-872-7423 (North America only),readable files (including this one) to any serveror send email to directcustserv@ (outside North America).computer, is strictly prohibited. To order Numerical Recipes booksor CDROMs, visit websitePermission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machine-Copyright (C) 1988-1992 by Cambridge University ms Copyright (C) 1988-1992 by Numerical Recipes Software.

Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)

20.2GrayCodes895MSB443XOR3i2XOR2G(i)1XOR10XOR0LSB(a)MSB443XOR3G(i)2XOR2i1XOR10XOR0LSB(b)-bitoperationsforcalculatingtheGraycodeG(i)fromi(a),ortheinverse(b).LSBandMSBindicatetheleastandmostsignificantbits,7;sonthismethodisbad,isthatthereisnowaytoguaranteethatallthebrromposition7(0111)to8(1000),onemightpassspuriouslyandtransientlythrough6(0110),14(1110),and10(1010),Graycodeontheencodingstripesguaranteesthatthereisnotransientstatebetween7(0100inthesequenceabove)and8(1100).Ofcoursewethenneedcircuitry,oralgorithmics,totranslatefromG(i)20.2.1(b)aisthateachoutputbitshouldbetheXORofallmoresignifiitsofGraycodeinversionrequiresN−1steps(orgatedelays)inthecircuit.(Nevertheless,thisistypicallyveryfastincircuitry.)Inaregisterwithword-widebinaryoperations,wedon’thavetodoNconsecutiveoperations,butonlylntricksinvolvessequentialright-shiftsby1,2,4,8,...bitsuntilthewordlengthis or call 1-800-872-7423 (North America only),readable files (including this one) to any serveror send email to directcustserv@ (outside North America).computer, is strictly prohibited. To order Numerical Recipes booksor CDROMs, visit websitePermission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machine-Copyright (C) 1988-1992 by Cambridge University ms Copyright (C) 1988-1992 by Numerical Recipes Software.

Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)

apieceofcodefordoingbothG(i)edlongigray(unsignedlongn,intis)Forzeroorpositivevaluesofis,returntheGraycodeofn;ifisisnegative,returntheinverseGraycodeofn.{intish;unsignedlongans,idiv;if(is>=0)Thisistheeasydirection!returnn^(n>>1);ish=1;Thisisthemorecomplicateddirection:Inhierarchicalans=n;stages,startingwithaone-bitrightshift,causeeachfor(;;){bittobeXORedwithallmoresignifi^=(idiv=ans>>ish);if(idiv<=1||ish==16)returnans;ish<<=1;Doubletheamountofshiftonthenextcycle.}}Innumericalwork,Graycodescanbeusefulwhenyouneedtodosometaskthatdependsintimatelyonthebitsofi,,ifthereareeconomiesinrepeatingthetaskforvaluesdifferingbyonlyonebit,nexampleofthisin§7.7,EFERENCESANDFURTHERREADING:Horowitz,P.,andHill,W.1989,TheArtofElectronics,2nded.(NewYork:CambridgeUniversityPress),§,atorialAlgorithms,vol.4ofTheArtofComputerProgramming(Reading,MA:Addison-Wesley),§7.2.1.[bealwaysso?]20.3CyclicRedundancyandOtherChecksumsWhenyousendasequenceofbitsfrompointAtopointB,nformofinsuranceisthe“paritybit,”itybitischosensoastomakethetotalnumberofone-bits(versuszero-bits)eitheralwayseven(“evenparity”)oralwaysodd(“oddparity”).rorsaresufficientlyrare,anddonotoccurcloselybunchedintime,useofparityprovidessuffiunately,inrealsituations,asinglenoise“event”heparitybithastwopossiblevalues(0and1),itgives,onaverage,onlya50%obability,50%,mmunicationsprotocols[1]useamultibitgeneralizationoftheparitybitcalleda“cyclicredundancycheck”calapplicationstheCRCis16bitslong(twobytesortwocharacters),sothatthechanceofarandomerrorgoingundetectedis1in216=er,M-bitCRCshavethemathematical or call 1-800-872-7423 (North America only),readable files (including this one) to any serveror send email to directcustserv@ (outside North America).computer, is strictly prohibited. To order Numerical Recipes booksor CDROMs, visit websitePermission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machine-Copyright (C) 1988-1992 by Cambridge University ms Copyright (C) 1988-1992 by Numerical Recipes Software.

Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)


本文标签: 意思 作者