I recently read about this issue in the Nyhoffs’ book “Processing: An Introduction to Programming”.
Basically they write that “computers sometimes produce inaccurate results when fractions are involved.”
They explain this is because computers do not use a decimal (base-10) system, but rather they use a binary system (base-2). If you have access to their book, see pp 61-62 for full explanation.
Or check out this explanation of conversion from decimal to binary:
And if you’re very curious, there’s a long wikipedia on the topic: