The addition of JavaScript will have an error, it will be more obvious when the two floating-point numbers are added. This function returns more accurate addition result, here is a description of how the next JS to decimal addition precision processing
The code is as follows: ZF = Accadd (ZF, parsefloat ("12.11")); The addition function, which is used to get the exact addition result//description: The addition of JavaScript will have errors, it will be more obvious when the two floating-point numbers are added. This function returns a more precise addition result. Call: Accadd (ARG1,ARG2)//return value: Arg1 plus arg2 exact result function Accadd (arg1,arg2) {var r1,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; }