{"id":232,"date":"2023-10-11T08:31:50","date_gmt":"2023-10-11T00:31:50","guid":{"rendered":"https:\/\/wp.minicoda.com\/?p=232"},"modified":"2024-10-25T16:11:28","modified_gmt":"2024-10-25T08:11:28","slug":"%e6%b5%ae%e7%82%b9%e6%95%b0","status":"publish","type":"post","link":"https:\/\/wp.minicoda.com\/index.php\/%e6%b5%ae%e7%82%b9%e6%95%b0\/","title":{"rendered":"\u6d6e\u70b9\u6570"},"content":{"rendered":"\n<p>  \u6d6e\u70b9\u6570\u76f8\u6bd4\u5b9a\u70b9\u6570\u6216\u8005\u6574\u6570\uff0c\u4e3a\u4e86\u5904\u7406\u5c0f\u6570\u70b9\u5f15\u5165\u4e86\u6307\u6570\uff0c\u5bfc\u81f4\u5c0f\u6570\u70b9\u7684\u4f4d\u7f6e\u6839\u636e\u4e0d\u540c\u6d6e\u70b9\u6570\u800c\u4e0d\u540c\uff0c\u6545\u540d\u4e3aFloating Point Number. \u4e00\u822c\u800c\u8a00\uff0cIEEE754\u6807\u51c6\u88ab\u5927\u90e8\u5206\u7f16\u7a0b\u8bed\u8a00\u7684\u6d6e\u70b9\u6570\u4f7f\u7528\uff0c\u5b83\u8282\u7701\u4e86\u6d6e\u70b9\u6570\u7684\u4fdd\u5b58\u7a7a\u95f4\u3002\u5982\u4e0d\u7136\uff0c\u6d6e\u70b9\u6570\u53ef\u80fd\u6309\u6bcf\u4e00\u4f4dASCII\u7801\u4fdd\u5b58\uff0c\u5305\u62ec\u6574\u6570\u90e8\u5206\u3001\u5c0f\u6570\u70b9\u548c\u5c0f\u6570\u90e8\u5206\uff0c\u5360\u7528\u7a7a\u95f4\u4e0d\u53ef\u63a7\u5236\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5c0f\u6570\u70b9\u4f4d\u7f6e\u6d6e\u52a8\u7684\u539f\u56e0<\/h2>\n\n\n\n<p>  \u6d6e\u70b9\u6570\u6574\u6570\u90e8\u5206\u957f\u5ea6\u4e0d\u4e00\uff0c\u4e3a\u4e86\u7edf\u4e00\u6574\u6570\u90e8\u5206\u548c\u6307\u6570\u90e8\u5206\uff0c\u628a\u6240\u6709\u6574\u6570\u90fd\u8f6c\u6362\u62100.xx\u683c\u5f0f\uff0c\u9020\u6210\u5c0f\u6570\u70b9\u4f4d\u7f6e\u4e0d\u4e00\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6d6e\u70b9\u6570\u548c\u6574\u6570<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6d6e\u70b9\u6570\u7684\u4f4d\u7ea7\u5b58\u50a8\u548c\u6574\u6570\u5b8c\u5168\u4e0d\u540c\uff0c\u6574\u65701\u548c\u6d6e\u70b9\u65701.0\u5b58\u50a8\u4e5f\u622a\u7136\u4e0d\u540c\u3002\u901a\u8fc7\u8c03\u8bd5\u5668\u67e5\u770bint\u53d8\u91cf\u548cfloat\u53d8\u91cf\u7684\u5185\u5b58\u5b58\u50a8\uff0c\u6216\u8005\u5199\u4e00\u6bb5dump\u5b57\u8282\u4ee3\u7801\u6bd4\u8f83\u5176\u533a\u522b\uff0c\u8fd8\u6709\u4e00\u79cd\u65b9\u5f0f\uff0cC\/C++ %a\u683c\u5f0f\u4e32\u53ef\u7528\u5341\u516d\u8fdb\u5236\u5f62\u5f0f\u8868\u8fbe\u6d6e\u70b9\u6570(\u5176\u4ed6\u7f16\u7a0b\u8bed\u8a00\u53ef\u80fd\u4e0d\u9002\u7528)\u3002<\/li>\n\n\n\n<li>\u4e0d\u540c\u6d6e\u70b9\u6570\u4f4d\u7ea7\u5b58\u50a8\u4e5f\u4e0d\u76f8\u540c\uff0cfloat\u548cdouble\u662f\u4e0d\u540c\u7684\u3002<\/li>\n\n\n\n<li>\u6d6e\u70b9\u6570\u548c\u6574\u6570\u8fd0\u7b97\uff0c\u6574\u6570\u4f1a\u9ed8\u8ba4\u5148\u8f6c\u6362\u6210\u6d6e\u70b9\u6570\u3002<br>f = f + i;<br>cvtsi2ss xmm0,dword ptr [i]<br>addss xmm0,dword ptr [f]<br>movss dword ptr [f],xmm0<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6d6e\u70b9\u6570\u6307\u4ee4<\/h2>\n\n\n\n<p>  \u65e9\u671f\u8ba1\u7b97\u673a\u6839\u672c\u6ca1\u6709\u6d6e\u70b9\u6570\u5904\u7406ALU\uff0c\u6d6e\u70b9\u6570\u9760\u8f6f\u4ef6\u6574\u6570\u53bb\u6a21\u62df\uff0c\u6027\u80fd\u6781\u4f4e\u3002\u540e\u6765\uff0c\u52a0\u5165\u4e86\u6d6e\u70b9\u6570FPU\uff0c\u6d6e\u70b9\u6570\u5904\u7406\u901f\u5ea6\u6781\u5927\u63d0\u5347\uff0c\u6bd4\u5982xmm\u5bc4\u5b58\u5668\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>double f = 2.25;  \/\/ IEEE 754\u5185\u5b58\u5b58\u50a8<\/li>\n\n\n\n<li>00501056 movsd xmm0,mmword ptr [__real@4002000000000000 (0502108h)]<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7cbe\u786e\u6027<\/h2>\n\n\n\n<p>  \u6d6e\u70b9\u6570\u7684\u8868\u8fbe\u65b9\u5f0f\u5229\u7528\u6574\u6570\u4f4d\u548c\u5c0f\u6570\u4f4d\u8ba1\u7b97\u76842<sup>n<\/sup>\u6570\u503c(n\u53ef\u6b63\u53ef\u8d1f)\u8ba1\u7b97\uff0c\u5fc5\u7136\u51fa\u73b0\u4e0d\u51c6\u786e\u30021.5\u53ef\u7cbe\u786e\u8868\u793a\uff0c0.3\u5374\u65e0\u6cd5\u7cbe\u786e\u8868\u793a\u3002\u6709\u7684\u4e66\u7c4d\u4e0a\u63d0\u5230\uff0c\u6d6e\u70b9\u6570\u4e0d\u8981\u7528==\u6216!=\u5224\u65ad\uff0c\u5176\u5b9e\u662f\u8003\u8651\u6709\u4e0d\u7cbe\u786e\u8868\u8fbe\u7684\u53ef\u80fd\u3002\u5728\u5546\u4e1a\u94f6\u884c\u91d1\u878d\u9886\u57df\uff0c\u8fd9\u662f\u4e0d\u80fd\u5bb9\u5fcd\u7684\u3002\u5e02\u9762\u4e0a\uff0c\u53ea\u8981\u662f\u7528IEEE 754\u6807\u51c6\u8868\u8fbe\u7684\u6d6e\u70b9\u6570\uff0c\u8fd0\u7b97\u4e00\u5b9a\u662f\u4e0d\u7cbe\u786e\u7684\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>COBOL\u7f16\u7a0b\u8bed\u8a00\u662f\u4e0a\u53e4\u65f6\u671f\u53ef\u4ee5\u5904\u7406\u5c0f\u6570\u7cbe\u786e\u5ea6\u5f88\u597d\u7684\u4e00\u95e8\u8bed\u8a00\uff0c\u56e0\u4e3a\u5b83\u771f\u7684\u7528\u6a21\u62df\u7684\u5f62\u5f0f\u4fdd\u5b58\u5c0f\u6570\u70b9\u548c\u5c0f\u6570\u4f4d\uff0c\u800c\u975eIEEE 754\u8fd9\u79cd\u538b\u7f29\u7248\u3002<\/li>\n\n\n\n<li>C#\u5f15\u5165\u4e86decimal\u7c7b\u578b\u5904\u7406\u5c0f\u6570\u70b9\u66f4\u7cbe\u786e\u3002\u5982\u4e0b\u4e24\u79cd\u4e0d\u540c\u7c7b\u578b\u53d8\u91cf\u8f93\u51fa\u7684\u7ed3\u679c\u7b2c\u4e00\u4e2a\u4f1a\u66f4\u7cbe\u786e\u3002<br>decimal d = 3.14159265124m;<br>float f = 3.14159265123f;<br><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6d6e\u70b9\u6570\u7684\u7c7b\u578b<\/h2>\n\n\n\n<p>  \u5c3d\u7ba14\u5b57\u8282\u7684\u6d6e\u70b9\u6570\u53ef\u8868\u8fbe\u76f8\u5f53\u5927\u7684\u6570\u503c\uff0c\u4f46\u5bf9\u4e8e\u4eba\u7c7b\u800c\u8a00\uff0c\u603b\u4e0d\u591f\u7528\u3002\u4e00\u822c\u800c\u8a00\uff0c\u6d6e\u70b9\u6570\u67093\u79cd\u7c7b\u578b\uff0c\u5355\u7cbe\u5ea6\u7684float\u548c\u53cc\u7cbe\u5ea6\u7684double\u4ee5\u53ca\u66f4\u957f\u7684long double, \u53ef\u53c2\u8003\uff1a<a href=\"https:\/\/wp.minicoda.com\/index.php\/2023\/10\/06\/%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b%e5%a4%a7%e5%b0%8f\/\" data-type=\"link\" data-id=\"https:\/\/wp.minicoda.com\/index.php\/2023\/10\/06\/%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b%e5%a4%a7%e5%b0%8f\/\">\u6570\u636e\u7c7b\u578b\u5927\u5c0f<\/a><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>C\u8bed\u8a00\u4e3a\u4e86\u533a\u5206float\u548cdouble, \u8f93\u5165\u65f6\u7528%f\u4ee3\u8868float, %lf\u4ee3\u8868double, \u4f46\u5bf9\u4e8e\u8f93\u51fa%f\u548c%lf\u4f5c\u7528\u76f8\u540c\u3002<\/li>\n\n\n\n<li>C\u8bed\u8a00\u4e2dfloat\u7c7b\u578b\u662f\u9ed8\u8ba4\u8f6c\u6362\u6210double\u53bb\u5904\u7406\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/li>\n\n\n\n<li>C99\u5f15\u5165\u4e86long double (%Lf), \u6ce8\u610f\u5e76\u4e0d\u610f\u5473long double\u4e00\u5b9a\u6bd4double\u8981\u957f\uff0c\u6839\u636e\u7f16\u8bd1\u5668\u9009\u62e9\u3002<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"515\" height=\"137\" src=\"https:\/\/wp.minicoda.com\/wp-content\/uploads\/2023\/10\/image-3.png\" alt=\"\" class=\"wp-image-235\" style=\"width:720px;height:192px\" srcset=\"https:\/\/wp.minicoda.com\/wp-content\/uploads\/2023\/10\/image-3.png 515w, https:\/\/wp.minicoda.com\/wp-content\/uploads\/2023\/10\/image-3-300x80.png 300w\" sizes=\"auto, (max-width: 515px) 100vw, 515px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u6d6e\u70b9\u6570\u76f8\u6bd4\u5b9a\u70b9\u6570\u6216\u8005\u6574\u6570\uff0c\u4e3a\u4e86\u5904\u7406\u5c0f\u6570\u70b9\u5f15\u5165\u4e86\u6307\u6570\uff0c\u5bfc\u81f4\u5c0f\u6570\u70b9\u7684\u4f4d\u7f6e\u6839\u636e\u4e0d\u540c\u6d6e\u70b9\u6570\u800c\u4e0d\u540c\uff0c\u6545\u540d\u4e3aFloating Point Number. \u4e00\u822c\u800c\u8a00\uff0cIEEE754\u6807\u51c6\u88ab\u5927\u90e8\u5206\u7f16\u7a0b\u8bed\u8a00\u7684\u6d6e\u70b9\u6570\u4f7f\u7528\uff0c&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[80,8],"tags":[81,9],"class_list":["post-232","post","type-post","status-publish","format-standard","hentry","category-80","category-8","tag-81","tag-9"],"views":124,"_links":{"self":[{"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/posts\/232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/comments?post=232"}],"version-history":[{"count":6,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/posts\/232\/revisions"}],"predecessor-version":[{"id":3136,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/posts\/232\/revisions\/3136"}],"wp:attachment":[{"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/media?parent=232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/categories?post=232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/tags?post=232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}