This is called floating point errors and it is a byproduct of how number systems on computers work. Here is a great informative video on why this happens.
If you’re interested in computer science do yourself a favor and subscribe, they do great videos all the time