0.1 is a repeating fraction in binary. In IEEE floating point, it is rounded at 52 or 53 bits, so it must be either a bit too big or a bit too small.
Good binary fractions are sums of 1/2, 1/4, 1/8, 1/16, 1/32, ... 1/2^53 which are the individual bits of the fraction.
Sometimes the "bit too big" or "bit too small" works out the way you want, and sometimes not.
The second example shows an epsilon chosen for numbers near 1, which have about 14 places after the decimal (thus 1e-12).
If( .3 - .2 == .1, // "no"
"yes"
, // else
"no"
);
If( Abs( (.3 - .2) - .1 ) < 1e-12, // "yes"
"yes"
, // else
"no"
);
Old post
Craige