How serious this problem is, the foreign net friend that has the right to register a domain name directly to explain this question ... 0.30000000000000004.com
//js addition calculation//Call: Accadd (ARG1,ARG2)//return value: Exact result of Arg1 plus arg2functionAccadd (arg1,arg2) {varr1,r2,m; Try{r1=arg1.tostring (). Split (".") [1].length}Catch(e) {r1=0} Try{r2=arg2.tostring (). Split (".") [1].length}Catch(e) {r2=0} m=math.pow (10, Math.max (R1,R2))return((arg1*m+arg2*m)/m). ToFixed (2);} //JS Subtraction Calculation//Call: Subtr (ARG1,ARG2)//return value: The exact result of Arg1 minus arg2functionSUBTR (arg1,arg2) {varR1,r2,m,n; Try{r1=arg1.tostring (). Split (".") [1].length}Catch(e) {r1=0} Try{r2=arg2.tostring (). Split (".") [1].length}Catch(e) {r2=0} m=math.pow (10, Math.max (R1,R2)); //Last modify by Deeka //Dynamic Control accuracy lengthN= (R1>=R2)?R1:R2; return((arg1*m-arg2*m)/m). ToFixed (2);} //JS Division function//Call: Accdiv (ARG1,ARG2)//return value: Arg1 divided by the exact result of Arg2functionAccdiv (arg1,arg2) {varT1=0,t2=0, R1,R2; Try{t1=arg1.tostring (). Split (".") [1].length}Catch(e) {}Try{t2=arg2.tostring (). Split (".") [1].length}Catch(e) {} with(Math) {R1=number (Arg1.tostring (). Replace (".", "")) R2=number (Arg2.tostring (). Replace (".", "")) return(R1/R2) *pow (10,T2-T1); } } //js multiplication function//Call: Accmul (ARG1,ARG2)//return value: arg1 times the exact result of Arg2functionAccmul (arg1,arg2) {varM=0,s1=arg1.tostring (), s2=arg2.tostring (); Try{M+=s1.split (".") [1].length}Catch(e) {}Try{M+=s2.split (".") [1].length}Catch(e) {}returnNumber (S1.replace (".", "")) *number (S2.replace (".", ""))/math.pow (10,m)}
JS accuracy Problem 0.1+0.2=0.30000000000000004