{"id":52468,"date":"2024-12-03T09:23:02","date_gmt":"2024-12-03T01:23:02","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52468\/"},"modified":"2024-12-03T09:23:02","modified_gmt":"2024-12-03T01:23:02","slug":"%e5%a6%82%e4%bd%95%e8%87%aa%e5%8a%a8%e5%8e%bb%e6%8e%89%e5%b0%8f%e6%95%b0%e6%9c%ab%e7%ab%af%e7%9a%84%e9%9b%b6%ef%bc%8c%e5%b9%b6%e4%bf%9d%e7%95%99%e6%8c%87%e5%ae%9a%e4%bd%8d%e6%95%b0%e7%9a%84%e5%b0%8f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52468\/","title":{"rendered":"\u5982\u4f55\u81ea\u52a8\u53bb\u6389\u5c0f\u6570\u672b\u7aef\u7684\u96f6\uff0c\u5e76\u4fdd\u7559\u6307\u5b9a\u4f4d\u6570\u7684\u5c0f\u6570\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u81ea\u52a8\u53bb\u6389\u5c0f\u6570\u672b\u7aef\u7684\u96f6\uff0c\u5e76\u4fdd\u7559\u6307\u5b9a\u4f4d\u6570\u7684\u5c0f\u6570\uff1f<\/h1>\n<p>\u4eca\u65e5\u4e0d\u80af\u57cb\u5934\uff0c\u660e\u65e5\u4f55\u4ee5\u62ac\u5934\uff01\u6bcf\u65e5\u4e00\u53e5\u52aa\u529b\u81ea\u5df1\u7684\u8bdd\u54c8\u54c8~\u54c8\u55bd\uff0c\u4eca\u5929\u6211\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u7bc7<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u5982\u4f55\u81ea\u52a8\u53bb\u6389\u5c0f\u6570\u672b\u7aef\u7684\u96f6\uff0c\u5e76\u4fdd\u7559\u6307\u5b9a\u4f4d\u6570\u7684\u5c0f\u6570\uff1f\u300b<\/span>\uff0c\u4e3b\u8981\u5185\u5bb9\u662f\u8bb2\u89e3<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u53ef\u4ee5\u6536\u85cf\u6216\u8005\u6709\u66f4\u597d\u7684\u5efa\u8bae\u5728\u8bc4\u8bba\u63d0\u51fa\uff0c\u6211\u90fd\u4f1a\u8ba4\u771f\u770b\u7684\uff01\u5927\u5bb6\u4e00\u8d77\u8fdb\u6b65\uff0c\u4e00\u8d77\u5b66\u4e60\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241120\/1732108024673ddef8cc946.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u81ea\u52a8\u53bb\u6389\u5c0f\u6570\u672b\u7aef\u7684\u96f6\uff0c\u5e76\u4fdd\u7559\u6307\u5b9a\u4f4d\u6570\u7684\u5c0f\u6570\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u81ea\u52a8\u53bb\u6389\u5c0f\u6570\u672b\u7aef\u7684\u96f6\uff0c\u5e76\u4fdd\u7559\u6307\u5b9a\u4f4d\u6570\u7684\u5c0f\u6570\uff1f\u63d2\u56fe\" \/><\/p>\n<h2>\u5c0f\u6570\u70b9\u4fdd\u7559\u6307\u5b9a\u4f4d\u6570\uff0c\u6574\u6570\u4f4d\u7701\u7565\u96f6<\/h2>\n<p><strong>\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u5982\u4f55\u81ea\u52a8\u53bb\u6389\u5c0f\u6570\u672b\u7aef\u7684\u96f6\uff0c\u8ba9\u6574\u6570\u6b63\u5e38\u663e\u793a\uff0c\u5c0f\u6570\u4fdd\u7559\u6307\u5b9a\u4f4d\u6570\uff1f\u6bd4\u5982\uff0cnumber\uff081111.1\uff09\u663e\u793a\u4e3a 1111.1\uff0cnumber\uff080.0003452\uff09\u663e\u793a\u4e3a 0.000345\u3002<\/p>\n<p><strong>\u7b54\u6848\uff1a<\/strong><\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528 math.round() \u65b9\u6cd5\uff1a<\/p>\n<pre>math.round(num * 10^n) \/ 10^n<\/pre>\n<p>\u5176\u4e2d\uff0c<strong>num<\/strong> \u662f\u8981\u4fdd\u7559\u5c0f\u6570\u7684\u6570\u5b57\uff0c<strong>n<\/strong> \u662f\u8981\u4fdd\u7559\u7684\u5c0f\u6570\u4f4d\u6570\u3002<\/p>\n<p>\u5177\u4f53\u5e94\u7528\u5230\u95ee\u9898\u4e2d\uff1a<\/p>\n<pre>Math.round(num * 1000000)\/1000000<\/pre>\n<p>\u8fd9\u4f1a\u5c06\u5c0f\u6570\u4fdd\u7559 6 \u4f4d\uff0c\u5982\u679c\u6570\u5b57\u662f\u6574\u6570\uff0c\u5219\u4f1a\u6b63\u5e38\u663e\u793a\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\u4e86\uff0c\u662f\u5426\u6709\u987a\u5229\u5e2e\u52a9\u4f60\u89e3\u51b3\u95ee\u9898\uff1f\u82e5\u662f\u80fd\u7ed9\u4f60\u5e26\u6765\u5b66\u4e60\u4e0a\u7684\u5e2e\u52a9\uff0c\u8bf7\u5927\u5bb6\u591a\u591a\u652f\u6301\u7c73\u4e91\uff01\u66f4\u591a\u5173\u4e8e\u6587\u7ae0\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u4e5f\u53ef\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u3002<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u5982\u4f55\u5904\u7406\u4ee3\u7801\u4e2d\u7684\u7701\u7565\u53f7\uff1a\u63d0\u53d6\u6570\u636e\u7684\u5173\u952e\u7ec6\u8282\u7f3a\u5931\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u81ea\u52a8\u53bb\u6389\u5c0f\u6570\u672b\u7aef\u7684\u96f6\uff0c\u5e76\u4fdd\u7559\u6307\u5b9a\u4f4d\u6570\u7684\u5c0f\u6570\uff1f \u4eca\u65e5\u4e0d\u80af\u57cb\u5934\uff0c\u660e\u65e5\u4f55\u4ee5\u62ac\u5934\uff01\u6bcf\u65e5\u4e00\u53e5\u52aa\u529b\u81ea\u5df1\u7684\u8bdd\u54c8\u54c8~\u54c8\u55bd\uff0c\u4eca\u5929\u6211\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u7bc7\u300a\u5982\u4f55\u81ea\u52a8\u53bb\u6389\u5c0f\u6570\u672b\u7aef\u7684\u96f6\uff0c\u5e76\u4fdd\u7559\u6307\u5b9a\u4f4d\u6570\u7684\u5c0f\u6570\uff1f\u300b\uff0c\u4e3b\u8981\u5185\u5bb9\u662f\u8bb2\u89e3\u7b49\u7b49\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u53ef\u4ee5\u6536\u85cf\u6216\u8005\u6709\u66f4\u597d\u7684\u5efa\u8bae\u5728\u8bc4\u8bba\u63d0\u51fa\uff0c\u6211\u90fd\u4f1a\u8ba4\u771f\u770b\u7684\uff01\u5927\u5bb6\u4e00\u8d77\u8fdb\u6b65\uff0c\u4e00\u8d77\u5b66\u4e60\uff01 \u5c0f\u6570\u70b9\u4fdd\u7559\u6307\u5b9a\u4f4d\u6570\uff0c\u6574\u6570\u4f4d\u7701\u7565\u96f6 \u95ee\u9898\uff1a \u5982\u4f55\u81ea\u52a8\u53bb\u6389\u5c0f\u6570\u672b\u7aef\u7684\u96f6\uff0c\u8ba9\u6574\u6570\u6b63\u5e38\u663e\u793a\uff0c\u5c0f\u6570\u4fdd\u7559\u6307\u5b9a\u4f4d\u6570\uff1f\u6bd4\u5982\uff0cnumber\uff081111.1\uff09\u663e\u793a\u4e3a 1111.1\uff0cnumber\uff080.0003452\uff09\u663e\u793a\u4e3a 0.000345\u3002 \u7b54\u6848\uff1a \u53ef\u4ee5\u4f7f\u7528 math.round() \u65b9\u6cd5\uff1a math.round(num * 10^n) \/ 10^n \u5176\u4e2d\uff0cnum \u662f\u8981\u4fdd\u7559\u5c0f\u6570\u7684\u6570\u5b57\uff0cn \u662f\u8981\u4fdd\u7559\u7684\u5c0f\u6570\u4f4d\u6570\u3002 \u5177\u4f53\u5e94\u7528\u5230\u95ee\u9898\u4e2d\uff1a Math.round(num * 1000000)\/1000000 \u8fd9\u4f1a\u5c06\u5c0f\u6570\u4fdd\u7559 6 \u4f4d\uff0c\u5982\u679c\u6570\u5b57\u662f\u6574\u6570\uff0c\u5219\u4f1a\u6b63\u5e38\u663e\u793a\u3002 \u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\u4e86\uff0c\u662f\u5426\u6709\u987a\u5229\u5e2e\u52a9\u4f60\u89e3\u51b3\u95ee\u9898\uff1f\u82e5\u662f\u80fd\u7ed9\u4f60\u5e26\u6765\u5b66\u4e60\u4e0a\u7684\u5e2e\u52a9\uff0c\u8bf7\u5927\u5bb6\u591a\u591a\u652f\u6301\u7c73\u4e91\uff01\u66f4\u591a\u5173\u4e8e\u6587\u7ae0\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u4e5f\u53ef\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u3002 \u5982\u4f55\u5904\u7406\u4ee3\u7801\u4e2d\u7684\u7701\u7565\u53f7\uff1a\u63d0\u53d6\u6570\u636e\u7684\u5173\u952e\u7ec6\u8282\u7f3a\u5931\uff1f<\/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-52468","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52468","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=52468"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52468\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}