This is due to the internal representation of floating point numbers and rounding (see Wikipedia
conditions compares the single precision (
) value with a double precision constant value. So the compiler converts the single precision value to double precision. The
condition compares with a single precision constant (which should always be true).
The second value 0.5 can be represented exactly by floating point values. But this is not true for 0.1. When converting from single precision to double, the additional available bits will be cleared. But the double constant value 0.1 has some of these bits set. So the values are not binary identical.
You may use the converter at this page
] to see the binary representation of single precision numbers and the corresponding double precision decimal.