Double的失精度有点严重!
public static void main(String[] args) {
BigDecimal nodePoolMemory = new BigDecimal("15.3");
BigDecimal nodeMemory = new BigDecimal(15.3D);
BigDecimal subtract1 = nodePoolMemory.subtract(nodeMemory);
System.out.println(subtract1);
BigDecimal nodePoolMemory1 = new BigDecimal("15.3");
BigDecimal nodeMemory1 = BigDecimal.valueOf(15.3D);
BigDecimal subtract11 = nodePoolMemory1.subtract(nodeMemory1);
System.out.println(subtract11);
}
public static void main(String[] args) {
System.out.println(0.3+0.6);
}