Lines 21-26
Link Here
|
21 |
|
21 |
|
22 |
import java.math.BigDecimal; |
22 |
import java.math.BigDecimal; |
23 |
import java.math.BigInteger; |
23 |
import java.math.BigInteger; |
|
|
24 |
import java.math.RoundingMode; |
24 |
|
25 |
|
25 |
import org.apache.poi.util.HexDump; |
26 |
import org.apache.poi.util.HexDump; |
26 |
import org.junit.Test; |
27 |
import org.junit.Test; |
Lines 152-158
Link Here
|
152 |
BigDecimal bd = new BigDecimal(hd.getSignificand()).divide(new BigDecimal(BigInteger.ONE.shiftLeft(gg))); |
153 |
BigDecimal bd = new BigDecimal(hd.getSignificand()).divide(new BigDecimal(BigInteger.ONE.shiftLeft(gg))); |
153 |
int excessPrecision = bd.precision() - 23; |
154 |
int excessPrecision = bd.precision() - 23; |
154 |
if (excessPrecision > 0) { |
155 |
if (excessPrecision > 0) { |
155 |
bd = bd.setScale(bd.scale() - excessPrecision, BigDecimal.ROUND_HALF_UP); |
156 |
bd = bd.setScale(bd.scale() - excessPrecision, RoundingMode.HALF_UP); |
156 |
} |
157 |
} |
157 |
return bd.unscaledValue().toString(); |
158 |
return bd.unscaledValue().toString(); |
158 |
} |
159 |
} |
Lines 189-195
Link Here
|
189 |
} |
190 |
} |
190 |
int excessPrecision = bd.precision() - nDec; |
191 |
int excessPrecision = bd.precision() - nDec; |
191 |
if (excessPrecision > 0) { |
192 |
if (excessPrecision > 0) { |
192 |
bd = bd.setScale(bd.scale() - excessPrecision, BigDecimal.ROUND_HALF_UP); |
193 |
bd = bd.setScale(bd.scale() - excessPrecision, RoundingMode.HALF_UP); |
193 |
} |
194 |
} |
194 |
return bd.unscaledValue(); |
195 |
return bd.unscaledValue(); |
195 |
} |
196 |
} |