// 小数乘法加法运算
accMul: function (arg1, arg2) {
let ml = 0
let s1 = arg1.toString()
let s2 = arg2.toString()
try {
ml += s1.split('.')[1].length
} catch (e) {}
try {
ml += s2.split('.')[1].length
} catch (e) {}
return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, ml)
},
addNum: function (num1, num2) {
let sq1, sq2, ml
try {
sq1 = num1.toString().split('.')[1].length
} catch (e) {
sq1 = 0
}
try {
sq2 = num2.toString().split('.')[1].length
} catch (e) {
sq2 = 0
}
ml = Math.pow(10, Math.max(sq1, sq2))
return (num1 * ml + num2 * ml) / ml
},
// 加法
accSub: function (arg1, arg2) {
let r1, r2, ml, nl
try {
r1 = arg1.toString().split('.')[1].length
} catch (e) {
r1 = 0
}
try {
r2 = arg2.toString().split('.')[1].length
} catch (e) {
r2 = 0
}
ml = Math.pow(10, Math.max(r1, r2))
nl = (r1 >= r2) ? r1 : r2
return ((arg1 * ml - arg2 * ml) / ml).toFixed(nl)
},