function decimalLength(num) {
var str = Number(num).toString();
var index = str.indexOf('.');
return index == -1 ? 0 : str.substr(index + 1).length;
}
function suffixInteger(num, length) {
var str = Number(num).toString();
var decimalLen = decimalLength(num);
str += Math.pow(10, length - decimalLen)
.toString()
.substr(1);
return Number(str.replace('.', ''));
}
export const add = function (num1, num2) {
var r1 = decimalLength(num1);
var r2 = decimalLength(num2);
var max = Math.max(r1, r2);
var n1 = suffixInteger(num1, max);
var n2 = suffixInteger(num2, max);
return Number(((n1 + n2) / Math.pow(10, max)).toFixed(max));
};