@msporek his explanation is right. Here is in detail at bit-level why it turns out false or true in both cases.
First, let's do 0.1 + 0.1
manually using the IEEE 754 floating point model:
Dec IEEE 754 52-bit mantisse
----------------------------------------------------
0.1 = 1.1001100110011001100110011001100110011001100110011010 * 2^-4
0.1 = 1.1001100110011001100110011001100110011001100110011010 * 2^-4
+ -------------------------------------------------------------------
0.2 = 11.0011001100110011001100110011001100110011001100110100 * 2^-4
= 1.1001100110011001100110011001100110011001100110011010 * 2^-3
This is a perfect match, which means that converting 0.2 to IEEE 754 and the sum of 0.1 and 0.1 in IEEE 754 are bitwise equal. Now let's look at: 0.2 + 0.1
Dec IEEE 754 52-bit mantisse
----------------------------------------------------
0.2 = 1.1001100110011001100110011001100110011001100110011010 * 2^-3
0.1 = 1.1001100110011001100110011001100110011001100110011010 * 2^-4
+ -------------------------------------------------------------------
0.2 = 1.1001100110011001100110011001100110011001100110011010 * 2^-3
0.1 = 0.1100110011001100110011001100110011001100110011001101 * 2^-3
+ -------------------------------------------------------------------
0.3 = 10.0110011001100110011001100110011001100110011001100111 * 2^-3
= 1.00110011001100110011001100110011001100110011001100111 * 2^-2
= 1.0011001100110011001100110011001100110011001100110100 * 2^-2
^^^
These bits
Now, look at the last bits of the result of the addition: it is 100. While 0.3 should have had a 011 as last bits. (We will verify this with a test program below).
You might think now that a CPU has FPUs with 80 bits mantisse, that is right, and behavior is very situation and hardware dependent, I think. Chances are that it gets rounded to 52 bits of precision.
Extra check using a test program to produce the IEEE 754 representation in memory:
Now doing it with the computer gives this as result which is perfectly in agreement with what I did by hand:
Dec IEEE 754 52-bit mantisse
----------------------------------------------------
0.3 = 1.0011001100110011001100110011001100110011001100110011 * 2^-2
0.2 + 0.1 = 1.0011001100110011001100110011001100110011001100110100 * 2^-2
Indeed: the last three bits are different.