public class doublePrecision { public static void main(String[] args) { double total = 0; total += 5.6; total += 5.8; System.out
/* 0.8 1.2 0.7 1.3 0.7000000000000002 2.3 0.7999999999999998 4.2 */ double adjust = fToInt + 1.0 - orgV; // The following two lines works for me. String s = String.format("%.2f", adjust); double val = Double.parseDouble(s); System.out.println(val); // output: 0.8, 0.7, 0.7, 0.8