BigDecimal减法

扫码查看
本文介绍了BigDecimal减法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想减去2
$的 double 值的表示表示b $ b

While with new BigDecimal(0.9) it converts value to exact floating point representation of double value without using String representation,

...

注意:


  1. 此构造函数的结果可能有些不可预测。

...

例如:

BigDecimal bd1 = new BigDecimal(Double.toString(0.9));
BigDecimal bd2 = new BigDecimal(0.9);
System.out.println(bd1);
System.out.println(bd2);

输出:

0.9
0.90000000000000002220446049250313080847263336181640625

这篇关于BigDecimal减法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 02:51
查看更多