{"id":1584,"date":"2019-04-28T23:30:14","date_gmt":"2019-04-28T15:30:14","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=1584"},"modified":"2022-05-29T17:07:48","modified_gmt":"2022-05-29T09:07:48","slug":"bc","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/bc","title":{"rendered":"bc\u547d\u4ee4 – \u6570\u5b57\u8ba1\u7b97\u5668"},"content":{"rendered":"\n

bc\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201cBinary Calculator\u201d\u7684\u7f29\u5199\uff0c\u4e2d\u6587\u8bd1\u4e3a\u4e8c\u8fdb\u5236\u8ba1\u7b97\u5668\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u6570\u5b57\u8ba1\u7b97\u3002Bash\u89e3\u91ca\u5668\u4ec5\u80fd\u591f\u8fdb\u884c\u6574\u6570\u8ba1\u7b97\uff0c\u800c\u4e0d\u652f\u6301\u6d6e\u70b9\u8fd0\u7b97\uff0c\u56e0\u6b64\u6709\u65f6\u8981\u7528\u5230bc\u547d\u4ee4\u8fdb\u884c\u9ad8\u7cbe\u5ea6\u7684\u6570\u5b57\u8ba1\u7b97\u5de5\u4f5c\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>bc [\u9009\u9879]<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n

-i<\/td>\u5f3a\u5236\u8fdb\u5165\u4ea4\u4e92\u5f0f\u6a21\u5f0f<\/td><\/tr>
-l<\/td>\u5b9a\u4e49\u4f7f\u7528\u7684\u6807\u51c6\u6570\u5b66\u5e93 <\/td><\/tr>
-w<\/td>\u5b9a\u4e49\u4f7f\u7528\u7684\u6807\u51c6\u6570\u5b66\u5e93 <\/td><\/tr>
-q<\/td>\u6253\u5370\u6b63\u5e38\u7684GNU bc\u73af\u5883\u4fe1\u606f <\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u8ba1\u7b97\u5f97\u51fa\u6307\u5b9a\u7684\u6d6e\u70b9\u6570\u4e58\u6cd5\u7ed3\u679c\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# bc<\/strong>\n1.2345*3<\/strong>\n3.7035<\/pre>\n\n\n\n

\u8bbe\u5b9a\u8ba1\u7b97\u7cbe\u5ea6\u4e3a\u5c0f\u6570\u70b9\u540e3\u4f4d\uff0c\u53d6\u6d6e\u70b9\u6570\u9664\u6cd5\u7ed3\u679c\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# bc<\/strong>\nscale=3\n3\/8<\/strong>\n.375<\/pre>\n\n\n\n

\u5206\u522b\u8ba1\u7b97\u6574\u6570\u7684\u5e73\u65b9\u4e0e\u5e73\u65b9\u6839\u7ed3\u679c\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# bc<\/strong>\n10^10<\/strong>\r\n10000000000\r\nsqrt(100)<\/strong>\r\n10.000\r<\/pre>\n","protected":false},"excerpt":{"rendered":"

bc\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201cBinary Calculator\u201d\u7684\u7f29\u5199\uff0c\u4e2d\u6587\u8bd1\u4e3a\u4e8c\u8fdb\u5236\u8ba1\u7b97\u5668\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u6570\u5b57\u8ba1\u7b97 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1584"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=1584"}],"version-history":[{"count":7,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1584\/revisions"}],"predecessor-version":[{"id":10193,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1584\/revisions\/10193"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=1584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=1584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=1584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}