floating point doubles aren't stored the way you think they are. They're not in base-10. They're in base-2. Look up how floating point numbers work in modern computers.
Good rule of thumb: Avoid using floating point. It is almost always a nightmare waiting to happen.