mirror of https://github.com/apache/poi.git
BigDecimal.valueOf
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1897674 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
26dc664dfb
commit
47236ba149
|
@ -54,8 +54,8 @@ public final class Standardize extends Fixed3ArgFunction implements FreeRefFunct
|
||||||
return ErrorEval.NUM_ERROR;
|
return ErrorEval.NUM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal result = new BigDecimal(xval.doubleValue() - mean.doubleValue())
|
BigDecimal result = BigDecimal.valueOf(xval.doubleValue() - mean.doubleValue())
|
||||||
.divide(new BigDecimal(stdev), MathContext.DECIMAL128);
|
.divide(BigDecimal.valueOf(stdev), MathContext.DECIMAL128);
|
||||||
return new NumberEval(result.doubleValue());
|
return new NumberEval(result.doubleValue());
|
||||||
} catch (EvaluationException e) {
|
} catch (EvaluationException e) {
|
||||||
return e.getErrorEval();
|
return e.getErrorEval();
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class FractionFormat extends Format {
|
||||||
@SuppressWarnings("squid:S2111")
|
@SuppressWarnings("squid:S2111")
|
||||||
public String format(Number num) {
|
public String format(Number num) {
|
||||||
|
|
||||||
final BigDecimal doubleValue = new BigDecimal(num.doubleValue());
|
final BigDecimal doubleValue = BigDecimal.valueOf(num.doubleValue());
|
||||||
|
|
||||||
final boolean isNeg = doubleValue.compareTo(BigDecimal.ZERO) < 0;
|
final boolean isNeg = doubleValue.compareTo(BigDecimal.ZERO) < 0;
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ public class FractionFormat extends Format {
|
||||||
if (wholePartFormatString == null || wholePartFormatString.isEmpty()){
|
if (wholePartFormatString == null || wholePartFormatString.isEmpty()){
|
||||||
final int fden = fract.getDenominator();
|
final int fden = fract.getDenominator();
|
||||||
final int fnum = fract.getNumerator();
|
final int fnum = fract.getNumerator();
|
||||||
BigDecimal trueNum = wholePart.multiply(new BigDecimal(fden)).add(new BigDecimal(fnum));
|
BigDecimal trueNum = wholePart.multiply(BigDecimal.valueOf(fden)).add(BigDecimal.valueOf(fnum));
|
||||||
sb.append(trueNum.toBigInteger()).append("/").append(fden);
|
sb.append(trueNum.toBigInteger()).append("/").append(fden);
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue