If you need to represent fixed point Numbers, such as dollars and cents, use BigDecimal instead.
如果需要表示定点数(譬如,几美元和几美分),则使用BigDecimal。
Because BigDecimal objects are immutable, each of these methods produces a new BigDecimal object.
由于BigDecimal对象是不可变的,这些方法中的每一个都会产生新的BigDecimal对象。
For this reason, BigDecimal gives you explicit control over rounding when performing division operations.
出于这个原因,在进行除法运算时,BigDecimal可以让您显式地控制舍入。
应用推荐