优化 Arith.round() 方法,去除不必要的中间变量

pull/500/head
EFT 2024-06-14 22:15:15 +08:00
parent 4f5bf990bf
commit 3a355a8607
1 changed files with 1 additions and 2 deletions

View File

@ -108,7 +108,6 @@ public class Arith
"The scale must be a positive integer or zero");
}
BigDecimal b = new BigDecimal(Double.toString(v));
BigDecimal one = BigDecimal.ONE;
return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue();
return b.divide(BigDecimal.ONE, scale, RoundingMode.HALF_UP).doubleValue();
}
}