{"id":53654,"date":"2024-12-03T16:53:49","date_gmt":"2024-12-03T08:53:49","guid":{"rendered":"https:\/\/fwq.ai\/blog\/53654\/"},"modified":"2024-12-03T16:53:49","modified_gmt":"2024-12-03T08:53:49","slug":"%e5%a6%82%e4%bd%95%e4%bf%9d%e7%95%99%e5%b0%8f%e6%95%b0%e4%bd%8d%e6%95%b0%e8%80%8c%e4%b8%8d%e5%bd%b1%e5%93%8d%e6%95%b4%e6%95%b0%e6%98%be%e7%a4%ba%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/53654\/","title":{"rendered":"\u5982\u4f55\u4fdd\u7559\u5c0f\u6570\u4f4d\u6570\u800c\u4e0d\u5f71\u54cd\u6574\u6570\u663e\u793a\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u4fdd\u7559\u5c0f\u6570\u4f4d\u6570\u800c\u4e0d\u5f71\u54cd\u6574\u6570\u663e\u793a\uff1f<\/h1>\n<p>\u5c0f\u4f19\u4f34\u4eec\u6709\u6ca1\u6709\u89c9\u5f97\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u5f88\u6709\u610f\u601d\uff1f\u6709\u610f\u601d\u5c31\u5bf9\u4e86\uff01\u4eca\u5929\u5c31\u7ed9\u5927\u5bb6\u5e26\u6765<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u5982\u4f55\u4fdd\u7559\u5c0f\u6570\u4f4d\u6570\u800c\u4e0d\u5f71\u54cd\u6574\u6570\u663e\u793a\uff1f\u300b<\/span>\uff0c\u4ee5\u4e0b\u5185\u5bb9\u5c06\u4f1a\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\uff0c\u82e5\u662f\u5728\u5b66\u4e60\u4e2d\u5bf9\u5176\u4e2d\u90e8\u5206\u77e5\u8bc6\u70b9\u6709\u7591\u95ee\uff0c\u6216\u8bb8\u770b\u4e86\u672c\u6587\u5c31\u80fd\u5e2e\u5230\u4f60\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241203\/1733194847674e745f71fc4.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4fdd\u7559\u5c0f\u6570\u4f4d\u6570\u800c\u4e0d\u5f71\u54cd\u6574\u6570\u663e\u793a\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4fdd\u7559\u5c0f\u6570\u4f4d\u6570\u800c\u4e0d\u5f71\u54cd\u6574\u6570\u663e\u793a\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5c0f\u6570\u70b9\u4fdd\u7559\u4f4d\u6570\uff1a\u5de7\u5999\u5904\u7406\u5c0f\u6570\u4e0e\u6574\u6570<\/strong><\/p>\n<p>\u95ee\u9898\u4e2d\u63d0\u5230\uff0c\u5e0c\u671b\u4fdd\u7559\u516d\u4f4d\u5c0f\u6570\uff0c\u4f46\u4f7f\u7528tofixed\u65f6\uff0c\u6574\u6570\u4e5f\u4f1a\u4fdd\u7559\uff0c\u5982\u4f55\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u5462\uff1f<\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u501f\u52a9 math.round() \u51fd\u6570\u6765\u5de7\u5999\u5730\u5904\u7406\u8fd9\u4e2a\u95ee\u9898\u3002math.round() \u51fd\u6570\u53ef\u4ee5\u5c06\u6570\u5b57\u56db\u820d\u4e94\u5165\u5230\u6700\u63a5\u8fd1\u7684\u6574\u6570\u3002\u901a\u8fc7\u5bf9\u6570\u5b57\u4e58\u4ee5\u4e00\u4e2a\u9002\u5f53\u7684\u57fa\u6570\uff08\u5982 1000000\uff09\uff0c\u7136\u540e\u9664\u4ee5\u76f8\u540c\u7684\u57fa\u6570\uff0c\u5373\u53ef\u5b9e\u73b0\u6240\u9700\u7684\u5c0f\u6570\u4f4d\u4fdd\u7559\uff1a<\/p>\n<pre>Math.round(num * 1000000) \/ 1000000<\/pre>\n<p>\u8fd9\u4e2a\u65b9\u6cd5\u53ef\u4ee5\u6ee1\u8db3\u95ee\u9898\u4e2d\u7684\u8981\u6c42\uff1a<\/p>\n<ul>\n<li>\u6574\u6570\u663e\u793a\u6b63\u5e38 (\u4f8b\u5982\uff1a1111.1 \u663e\u793a\u4e3a 1111.1)<\/li>\n<li>\u5c0f\u6570\u4fdd\u7559\u6240\u9700\u4f4d\u6570 (\u4f8b\u5982\uff1a0.0003452 \u663e\u793a\u4e3a 0.000345)<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u5229\u7528 math.round() \u51fd\u6570\u7684\u56db\u820d\u4e94\u5165\u7279\u6027\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u5c0f\u6570\u548c\u6574\u6570\u7684\u81ea\u52a8\u8f6c\u6362\u3002<\/p>\n<p>\u597d\u4e86\uff0c\u672c\u6587\u5230\u6b64\u7ed3\u675f\uff0c\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u300a\u5982\u4f55\u4fdd\u7559\u5c0f\u6570\u4f4d\u6570\u800c\u4e0d\u5f71\u54cd\u6574\u6570\u663e\u793a\uff1f\u300b\uff0c\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u7ed9\u5927\u5bb6\u5206\u4eab\u66f4\u591a\u6587\u7ae0\u77e5\u8bc6\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u53f0\u53575\u7ea7\u5f3a\u9707\u53f0\u79ef\u753518\u5382\u758f\u6563\u90e8\u5206\u5458\u5de5\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4fdd\u7559\u5c0f\u6570\u4f4d\u6570\u800c\u4e0d\u5f71\u54cd\u6574\u6570\u663e\u793a\uff1f \u5c0f\u4f19\u4f34\u4eec\u6709\u6ca1\u6709\u89c9\u5f97\u5b66\u4e60\u6587\u7ae0\u5f88\u6709\u610f\u601d\uff1f\u6709\u610f\u601d\u5c31\u5bf9\u4e86\uff01\u4eca\u5929\u5c31\u7ed9\u5927\u5bb6\u5e26\u6765\u300a\u5982\u4f55\u4fdd\u7559\u5c0f\u6570\u4f4d\u6570\u800c\u4e0d\u5f71\u54cd\u6574\u6570\u663e\u793a\uff1f\u300b\uff0c\u4ee5\u4e0b\u5185\u5bb9\u5c06\u4f1a\u6d89\u53ca\u5230\uff0c\u82e5\u662f\u5728\u5b66\u4e60\u4e2d\u5bf9\u5176\u4e2d\u90e8\u5206\u77e5\u8bc6\u70b9\u6709\u7591\u95ee\uff0c\u6216\u8bb8\u770b\u4e86\u672c\u6587\u5c31\u80fd\u5e2e\u5230\u4f60\uff01 \u5c0f\u6570\u70b9\u4fdd\u7559\u4f4d\u6570\uff1a\u5de7\u5999\u5904\u7406\u5c0f\u6570\u4e0e\u6574\u6570 \u95ee\u9898\u4e2d\u63d0\u5230\uff0c\u5e0c\u671b\u4fdd\u7559\u516d\u4f4d\u5c0f\u6570\uff0c\u4f46\u4f7f\u7528tofixed\u65f6\uff0c\u6574\u6570\u4e5f\u4f1a\u4fdd\u7559\uff0c\u5982\u4f55\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u5462\uff1f \u6211\u4eec\u53ef\u4ee5\u501f\u52a9 math.round() \u51fd\u6570\u6765\u5de7\u5999\u5730\u5904\u7406\u8fd9\u4e2a\u95ee\u9898\u3002math.round() \u51fd\u6570\u53ef\u4ee5\u5c06\u6570\u5b57\u56db\u820d\u4e94\u5165\u5230\u6700\u63a5\u8fd1\u7684\u6574\u6570\u3002\u901a\u8fc7\u5bf9\u6570\u5b57\u4e58\u4ee5\u4e00\u4e2a\u9002\u5f53\u7684\u57fa\u6570\uff08\u5982 1000000\uff09\uff0c\u7136\u540e\u9664\u4ee5\u76f8\u540c\u7684\u57fa\u6570\uff0c\u5373\u53ef\u5b9e\u73b0\u6240\u9700\u7684\u5c0f\u6570\u4f4d\u4fdd\u7559\uff1a Math.round(num * 1000000) \/ 1000000 \u8fd9\u4e2a\u65b9\u6cd5\u53ef\u4ee5\u6ee1\u8db3\u95ee\u9898\u4e2d\u7684\u8981\u6c42\uff1a \u6574\u6570\u663e\u793a\u6b63\u5e38 (\u4f8b\u5982\uff1a1111.1 \u663e\u793a\u4e3a 1111.1) \u5c0f\u6570\u4fdd\u7559\u6240\u9700\u4f4d\u6570 (\u4f8b\u5982\uff1a0.0003452 \u663e\u793a\u4e3a 0.000345) \u901a\u8fc7\u5229\u7528 math.round() \u51fd\u6570\u7684\u56db\u820d\u4e94\u5165\u7279\u6027\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u5c0f\u6570\u548c\u6574\u6570\u7684\u81ea\u52a8\u8f6c\u6362\u3002 \u597d\u4e86\uff0c\u672c\u6587\u5230\u6b64\u7ed3\u675f\uff0c\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u300a\u5982\u4f55\u4fdd\u7559\u5c0f\u6570\u4f4d\u6570\u800c\u4e0d\u5f71\u54cd\u6574\u6570\u663e\u793a\uff1f\u300b\uff0c\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u7ed9\u5927\u5bb6\u5206\u4eab\u66f4\u591a\u6587\u7ae0\u77e5\u8bc6\uff01 \u53f0\u53575\u7ea7\u5f3a\u9707\u53f0\u79ef\u753518\u5382\u758f\u6563\u90e8\u5206\u5458\u5de5<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-53654","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53654","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=53654"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53654\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=53654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=53654"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=53654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}