/** Addition operation, to avoid the data added after the decimal point to produce multiple digits and the loss of computational accuracy. * * @param num1 addend 1 | Num2 Addend 2*/function Numadd (NUM1, num2) {varBasenum, BaseNum1, baseNum2;Try{baseNum1= Num1.tostring (). Split (".")[1].length; } Catch(e) {baseNum1=0; } Try{baseNum2= Num2.tostring (). Split (".")[1].length; } Catch(e) {baseNum2=0; } Basenum= Math.pow (Ten, Math.max (BASENUM1, baseNum2)); return(NUM1 * basenum + num2 * basenum)/Basenum;};/** Addition operation to avoid the loss of multi-digit and computational precision when the data is reduced by a few points. * * @param num1 minuend | num2 meiosis*/function Numsub (NUM1, num2) {varBasenum, BaseNum1, baseNum2;varPrecision//accuracy Try{baseNum1= Num1.tostring (). Split (".")[1].length; } Catch(e) {baseNum1=0; } Try{baseNum2= Num2.tostring (). Split (".")[1].length; } Catch(e) {baseNum2=0; } Basenum= Math.pow (Ten, Math.max (BASENUM1, baseNum2)); Precision= (baseNum1 >= baseNum2)?basenum1:basenum2;return((NUM1 * basenum-num2 * basenum)/basenum). toFixed (precision);};/** Multiplication operation to avoid data multiplication after the decimal point to produce multiple digits and loss of computational precision. * * @param num1 by multiplier | Num2 Multiplier*/function Nummulti (NUM1, num2) {varBasenum =0; Try{basenum+ = Num1.tostring (). Split (".")[1].length; } Catch(e) {}Try{basenum+ = Num2.tostring (). Split (".")[1].length; } Catch(e) {}returnNumber (num1.tostring (). Replace (".","") * Number (num2.tostring (). Replace (".",""))/Math.pow (Ten, basenum);};/** * Division operation, to avoid dividing the data after the decimal point to produce multiple digits and calculate the loss of precision. * * @param NUM1 Dividend | NUM2 Divisor*/function Numdiv (NUM1, num2) {varBASENUM1 =0, baseNum2 =0; varbaseNum3, baseNum4;Try{baseNum1= Num1.tostring (). Split (".")[1].length; } Catch(e) {baseNum1=0; } Try{baseNum2= Num2.tostring (). Split (".")[1].length; } Catch(e) {baseNum2=0; } With (Math) {baseNum3= Number (num1.tostring (). Replace (".","")); BASENUM4= Number (num2.tostring (). Replace (".","")); return(BASENUM3/BASENUM4) * POW (Ten, BaseNum2-baseNum1); }};
(Jquery) avoids multiple digits and loss of computational precision after the data is added to the decimal point