As far as I know, the precise result of an arithmetic operation on floating point numbers cannot be counted on to match the exact result you expect from regular mathematics. This is due to the limited precision of floating-point variables. There is no way that I know of to predict the outcome of lines 2, 3, or 4 without a compiler, other than to spend a long time computing the float binary notation and the double binary notation for the numbers involved, and learning and applying the algorithms for division, multiplication and addition of those bit
patterns. Suffice it to say that you can only be certain of the following:
1 - 1.0f / 3.0f * 3.0f is
approximately equal to 0
1 - 1.0f / 3.0f * 3.0d is
approximately equal to 0
1 - 1.0d / 3.0d * 3.0d is
approximately equal to 0
You saw from compiling the code that some of two of those are exactly equal to 0, but without compiling the code, you can not safely assume that any of them are exactly equal to 0 or unequal to 0. Real exam questions would
not expect you to be able to determine which floating-point results are precisely equal and which are not, but it is good to know
when the results can be precisely predicted and when they cannot.