{"id":68469,"date":"2019-12-13T16:30:50","date_gmt":"2019-12-13T08:30:50","guid":{"rendered":"http:\/\/www.xiaoyebailong.com\/?p=68469"},"modified":"2019-12-13T16:30:52","modified_gmt":"2019-12-13T08:30:52","slug":"js%e5%8a%a0%e5%87%8f%e4%b9%98%e9%99%a4%e8%ae%a1%e7%ae%97%ef%bc%8c%e4%bf%9d%e7%95%992%e4%bd%8d%e5%b0%8f%e6%95%b0","status":"publish","type":"post","link":"http:\/\/www.xiaoyebailong.com\/index.php\/2019\/12\/13\/68469.htm","title":{"rendered":"js\u52a0\u51cf\u4e58\u9664\u8ba1\u7b97\uff0c\u4fdd\u75592\u4f4d\u5c0f\u6570"},"content":{"rendered":"\n<p>\/\/\u52a0\u6cd5\u8fd0\u7b97    <\/p>\n\n\n\n<p>function floatAdd(arg1,arg2){    <\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\"> var r1,r2,m;    \n\n try{r1=arg1.toString().split(\".\")[1].length}catch(e){r1=0}    \n\n try{r2=arg2.toString().split(\".\")[1].length}catch(e){r2=0}    \n\n m=Math.pow(10,Math.max(r1,r2));    \n\n return (arg1*m+arg2*m)\/m;    <\/pre>\n\n\n\n<p>}    <\/p>\n\n\n\n<p>\/\/\u51cf\u6cd5\u8fd0\u7b97    <\/p>\n\n\n\n<p>function floatSub(arg1,arg2){    <\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">var r1,r2,m,n;    \n\ntry{r1=arg1.toString().split(\".\")[1].length}catch(e){r1=0}    \n\ntry{r2=arg2.toString().split(\".\")[1].length}catch(e){r2=0}    \n\nm=Math.pow(10,Math.max(r1,r2));    \n\n\/\/\u52a8\u6001\u63a7\u5236\u7cbe\u5ea6\u957f\u5ea6    \n\nn=(r1>=r2)?r1:r2;    \n\nreturn ((arg1*m-arg2*m)\/m).toFixed(n);    <\/pre>\n\n\n\n<p>}    <\/p>\n\n\n\n<p>\/\/\u4e58\u6cd5\u8fd0\u7b97    <\/p>\n\n\n\n<p>function floatMul(arg1,arg2)   {     <\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">var m=0,s1=arg1.toString(),s2=arg2.toString();     \n\ntry{m+=s1.split(\".\")[1].length}catch(e){}     \n\ntry{m+=s2.split(\".\")[1].length}catch(e){}     \n\nreturn Number(s1.replace(\".\",\"\"))*Number(s2.replace(\".\",\"\"))\/Math.pow(10,m);     <\/pre>\n\n\n\n<p>}     <\/p>\n\n\n\n<p>\/\/\u9664\u6cd5\u8fd0\u7b97  <\/p>\n\n\n\n<p>function floatp(arg1,arg2){     <\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">  var t1=0,t2=0,r1,r2;     \n\n  try{t1=arg1.toString().split(\".\")[1].length}catch(e){}     \n\n  try{t2=arg2.toString().split(\".\")[1].length}catch(e){}     \n\n\n\n  r1=Number(arg1.toString().replace(\".\",\"\"));  \n\n\n\n  r2=Number(arg2.toString().replace(\".\",\"\"));     \n\n  return (r1\/r2)*Math.pow(10,t2-t1);     <\/pre>\n\n\n\n<p>}<br>\n       document.write(floatSub(1981.62,1980));  <br>\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/\/\u52a0\u6cd5\u8fd0\u7b97 function floatAdd(arg1,arg2){ } \/\/\u51cf\u6cd5\u8fd0\u7b97 function floatSub(arg1,arg2){ } \/\/\u4e58\u6cd5\u8fd0\u7b97 function floatMul(arg1,arg2) { } \/\/&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,1],"tags":[],"topic":[],"class_list":["post-68469","post","type-post","status-publish","format-standard","hentry","category-htmlcss","category-technology"],"_links":{"self":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/68469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/comments?post=68469"}],"version-history":[{"count":1,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/68469\/revisions"}],"predecessor-version":[{"id":68470,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/68469\/revisions\/68470"}],"wp:attachment":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/media?parent=68469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/categories?post=68469"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/tags?post=68469"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/topic?post=68469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}