A double gives a slightly more accurate representation of rational and irrational numbers because it has more bits dedicated to its precision than a float does, a double has 52 of its 64 to give precision whereas a float only has 23. The rest of the bits are the exponent and the sign bit. when you do (float) 5/3 the result is cast into a float before being assigned to your double so you lose precision this way. You will always have some degree of error when representing irrational numbers with floats or doubles.