Floating-point values are not exact; they're represented in a fixed number of bits which, for float, is smaller than the number of bits needed to represent Integer.MAX_VALUE exactly. Therefore, the float value will be "rounded" to the nearest representable value. double, though, does have enough bits to represent this value, so it will contain the exact value. Thus, the two variables will contain different numbers. For Long.MAX_VALUE, neither float nor double has enough bits to represent the value exactly; it's just luck, I think, that the rounded values are the same for both float and double.