mirror of https://github.com/apache/poi.git
Bug 63805: BigDecimal: use enum args instead of integers (deprecated in Java 9)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1868897 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0629fd1acb
commit
468346fca8
|
@ -28,6 +28,7 @@ import java.awt.geom.Rectangle2D;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
@ -789,7 +790,7 @@ public class HemfPlusDraw {
|
||||||
|
|
||||||
|
|
||||||
static double round10(double d) {
|
static double round10(double d) {
|
||||||
return new BigDecimal(d).setScale(10, BigDecimal.ROUND_HALF_UP).doubleValue();
|
return new BigDecimal(d).setScale(10, RoundingMode.HALF_UP).doubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int readRectS(LittleEndianInputStream leis, Rectangle2D bounds) {
|
static int readRectS(LittleEndianInputStream leis, Rectangle2D bounds) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
|
||||||
import org.apache.poi.util.HexDump;
|
import org.apache.poi.util.HexDump;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -152,7 +153,7 @@ public final class TestExpandedDouble {
|
||||||
BigDecimal bd = new BigDecimal(hd.getSignificand()).divide(new BigDecimal(BigInteger.ONE.shiftLeft(gg)));
|
BigDecimal bd = new BigDecimal(hd.getSignificand()).divide(new BigDecimal(BigInteger.ONE.shiftLeft(gg)));
|
||||||
int excessPrecision = bd.precision() - 23;
|
int excessPrecision = bd.precision() - 23;
|
||||||
if (excessPrecision > 0) {
|
if (excessPrecision > 0) {
|
||||||
bd = bd.setScale(bd.scale() - excessPrecision, BigDecimal.ROUND_HALF_UP);
|
bd = bd.setScale(bd.scale() - excessPrecision, RoundingMode.HALF_UP);
|
||||||
}
|
}
|
||||||
return bd.unscaledValue().toString();
|
return bd.unscaledValue().toString();
|
||||||
}
|
}
|
||||||
|
@ -189,7 +190,7 @@ public final class TestExpandedDouble {
|
||||||
}
|
}
|
||||||
int excessPrecision = bd.precision() - nDec;
|
int excessPrecision = bd.precision() - nDec;
|
||||||
if (excessPrecision > 0) {
|
if (excessPrecision > 0) {
|
||||||
bd = bd.setScale(bd.scale() - excessPrecision, BigDecimal.ROUND_HALF_UP);
|
bd = bd.setScale(bd.scale() - excessPrecision, RoundingMode.HALF_UP);
|
||||||
}
|
}
|
||||||
return bd.unscaledValue();
|
return bd.unscaledValue();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue