You're comparing 2 values of different types: a
is of type float
, 0.8
is of type double
.
before the comparison, the float
value is converted to double
... but converting from double
to float
and back doesn't necessarily yield the same value
if (0.8 == (double)(float)0.8) /* ... */