Floating-PointArithmetic

Floating-PointArithmetic

ID:38508311

大小:267.50 KB

页数:15页

时间:2019-06-13

Floating-PointArithmetic_第1页
Floating-PointArithmetic_第2页
Floating-PointArithmetic_第3页
Floating-PointArithmetic_第4页
Floating-PointArithmetic_第5页
资源描述:

《Floating-PointArithmetic》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、Floating-PointArithmeticReading:StudyChapter3.6-3.7Skim3.8-3.10if((A+A)-A==A){SelfDestruct()}Whatistheproblem?ManynumericapplicationsrequirenumbersoveraVERYlargerange.(e.g.nanosecondstocenturies)Mostscientificapplicationsrequirerealnumbers(e.g.)Butsof

2、arweonlyhaveintegers.We*COULD*implementthefractionsexplicitly(e.g.½,1023/102934)We*COULD*usebiggerintegersFloatingpointisabetteranswerformostapplications.RecallScientificNotationLet’sstartourdiscussionoffloatingpointbyrecallingscientificnotationfromhig

3、hschoolNumbersrepresentedinparts:42=4.200x1011024=1.024x103-0.0625=-6.250x10-2Arithmeticisdoneinpieces10241.024x103-42-0.042x1039820.982x1039.820x102Beforeadding,wemustmatchtheexponents,effectively“denormalizing”thesmallermagnitudenumberWethen“normaliz

4、e”thefinalresultsothereisonedigittotheleftofthedecimalpointandadjusttheexponentaccordingly.SignificantDigitsExponentMultiplicationinScientificNotationIsstraightforward:MultiplytogetherthesignificantpartsAddtheexponentsNormalizeifrequiredExamples:10241.

5、024x103x0.06256.250x10-2646.400x101424.200x101x0.06256.250x10-22.62526.250x10-12.625x100(Normalized)Inmultiplication,howfaristhemostyouwillevernormalize?Inaddition?FP==“Binary”ScientificNotationIEEEsingleprecisionfloating-pointformat0x42280000inhexadec

6、imalExponent:Unsigned“Bias127”8-bitinteger E=Exponent+127Exponent=10000100(132)–127=5Significand:Unsignedfixedbinarypointwith“hidden-one”Significand=“1”+0.01010000000000000000000=1.3125PuttingitalltogetherN=-1S(1+F)x2E-127=-10(1.3125)x25=42100001000101

7、00000000000000000000“F”Significand(Mantissa)-1“E”Exponent+127“S”Sign BitExampleNumbersOneSign=+,Exponent=0,Significand=1.0-10(1.0)x20=1 S=0,E=0+127,F=1.0–‘1’ 00111111100000000000000000000000 0x3f800000One-halfSign=+,Exponent=-1,Significand=1.0 -10(1.0)

8、x2-1=½ S=0,E=-1+127,F=1.0–‘1’ 00111111000000000000000000000000 0x3f000000MinusTwoSign=-,Exponent=1,Significand=1.0 11000000000000000000000000000000 0xc0000000ZerosHowdoyourepresent0?ZeroSign=?,Exponent=?,Significand=?Here’swherethehidde

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
相关文章
更多
相关标签