System.out.println(1.01 - .43); >0.5800000000000001 System.out.println(1.00 - 4*0.2); >0.19999999999999996 just rounding? no! public static void main(String[] args) { double funds = 1.00; int itemsBought = 0; for (double price = .10; funds >= price; price += .10) { funds -= price; itemsBought++; } System.out.println(itemsBought + " items bought."); System.out.println("Change $" + funds); } >3 items bought. >Change $0.3999999999999999 Answer should be: >4 items bought. >Change $0 In decimal math, there are many numbers that can’t be represented with a fixed number of decimal digits, e.g. 1/3 = 0.3333333333……. In base 2, 1/2 = 0.1, 1/4 = 0.01, 1/8 = 0.001, etc. .2 equals 2/10 equals 1/5, resulting in the binary fractional number 0.001100110011001… Floating point numbers only have 32 or 64 bits of precision, so the digits are cut off at some point, and the resulting number is 0.199999999999999996 in decimal, not 0.2.