This is due to floating point precision.
You can read more about it here
In short, unless you are certain that the number can be accurately represented (e.g. whole numbers), you are best advised to not do “==” comparisons with floating point numbers.
An alternative is to see if the number “is close” to the number you desired: if abs(a - b) < 0.001 then ...
. Although I’d look into other ways of detecting these scenarios instead.