public class doublePrecision { public static void main(String[] args) { double total = 0; total += 5.6; total += 5.8; System.out
Use a BigDecimal. It even lets you specify rounding rules (like ROUND_HALF_EVEN, which will minimize statistical error by rounding to the even neighbor if both are the same distance; i.e. both 1.5 and 2.5 round to 2).