BigDecimal除法运算需要設置小数位

来源:互联网 发布:如何装饰淘宝店铺 编辑:程序博客网 时间:2024/05/22 03:45
 
不然可能会报
-------------------------------------------------------------------------------------------------
Non-terminating decimal expansion; no exact representable decimal result.错误

正確的做法

--------------------------------------------------------------------------------------------------

b1.divide(b2,scale,BigDecimal.ROUND_HALF_UP).doubleValue();

原创粉丝点击