A double cannot represent every decimal number exactly. It stores values in binary, which means numbers like 0.1 cannot be represented perfectly - they get rounded. You get about 15-17 substantial digits of precision.
After that, small errors creep in. If you add 0.1 ten million times, the result might not exactly equal 1,000,000.0. Never compare two double values with ==. Instead, check if the difference is smaller than a tiny value like 0.000001.