This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.

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.