|
@@ -2,17 +2,26 @@ package com.jkcredit.invoice.util;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
+/**
|
|
|
+ * @Description 金额加减运算
|
|
|
+ * @Author mashengyi
|
|
|
+ * @Date 2022/2/8 18:52
|
|
|
+ * @Param
|
|
|
+ * @Return
|
|
|
+ * @Exception
|
|
|
+ *
|
|
|
+ */
|
|
|
public class MathUtil {
|
|
|
|
|
|
public static double add(Double a,Double b){
|
|
|
- BigDecimal a1 = new BigDecimal(a);
|
|
|
- BigDecimal b1 = new BigDecimal(b);
|
|
|
+ BigDecimal a1 = BigDecimal.valueOf(a);
|
|
|
+ BigDecimal b1 = BigDecimal.valueOf(b);
|
|
|
return a1.add(b1).doubleValue();
|
|
|
}
|
|
|
|
|
|
public static double sub(Double a,Double b){
|
|
|
- BigDecimal a1 = new BigDecimal(a);
|
|
|
- BigDecimal b1 = new BigDecimal(b);
|
|
|
+ BigDecimal a1 = BigDecimal.valueOf(a);
|
|
|
+ BigDecimal b1 = BigDecimal.valueOf(b);
|
|
|
return a1.subtract(b1).doubleValue();
|
|
|
}
|
|
|
}
|