// 引入 Decimal.js 库
import Decimal from 'decimal.js';

// 封装加法函数
export const add = (num1, num2) => {
	const decimal1 = new Decimal(num1);
	const decimal2 = new Decimal(num2);
	return decimal1.plus(decimal2).toString();
}

// 封装减法函数
export const subtract = (num1, num2) => {
	const decimal1 = new Decimal(num1);
	const decimal2 = new Decimal(num2);
	return decimal1.minus(decimal2).toString();
}

// 封装乘法函数
export const multiply = (num1, num2) => {
	const decimal1 = new Decimal(num1);
	const decimal2 = new Decimal(num2);
	return decimal1.times(decimal2).toString();
}

// 封装除法函数
export const divide = (num1, num2) => {
	const decimal1 = new Decimal(num1);
	const decimal2 = new Decimal(num2);
	return decimal1.dividedBy(decimal2).toString();
}