I started wondering why floating numbers sometimes behave in such a strange way. I found out that it is because a number has to be represented with either 32 or 64 bits, so at some point the number needs to be simplified and rounded up.
So I experimented a bit on Python to get a better idea of how floats behave:
1-0.000000000000000001 == 1
returns True
as expected.
However 0.000000000000000001 == 0
and 0.9999999999999999 == 1
return False
.
Remarkably 1-0.000000000000000001 == 0.9999999999999999
also returns False
Is there something I am missing?