On 4 October 2016 at 21:32, Arek Bulski firstname.lastname@example.org wrote:
I had a bug where nan floats failed to compare equal because there seems to be more than one nan value and comparison seems to be binary based.
"NaN != NaN" is part of the definition of IEEE 754 floats: https://en.wikipedia.org/wiki/NaN#Floating_point
That's why it returns False even if you compare a specific NaN instance with itself:
>>> x = float("nan") >>> x == x False
If you need a kinda-like-NaN value that provides reflexive equality, then Python's None singleton is a better fit.