|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.ruoyi.common.utils;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 精确的浮点数运算
|
|
|
|
@ -90,7 +91,7 @@ public class Arith
|
|
|
|
|
{
|
|
|
|
|
return BigDecimal.ZERO.doubleValue();
|
|
|
|
|
}
|
|
|
|
|
return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
|
return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -108,6 +109,6 @@ public class Arith
|
|
|
|
|
}
|
|
|
|
|
BigDecimal b = new BigDecimal(Double.toString(v));
|
|
|
|
|
BigDecimal one = new BigDecimal("1");
|
|
|
|
|
return b.divide(one, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
|
return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|