// 求和
const add = function(num1, num2) {
	const num1Digits = (num1.toString().split('.')[1] || '').length;
	const num2Digits = (num2.toString().split('.')[1] || '').length;
	const baseNum = Math.pow(10, Math.max(num1Digits, num2Digits));
	return (num1 * baseNum + num2 * baseNum) / baseNum;
}

// 乘
const ride = function(num1, num2) {
	const num1Digits = (num1.toString().split('.')[1] || '').length;
	const num2Digits = (num2.toString().split('.')[1] || '').length;
	const baseNum = Math.pow(10, Math.max(num1Digits, num2Digits));
	return ((num1 * baseNum) / baseNum) * ((num2 * baseNum) / baseNum);
}

export {
	add,
	ride
}
