On Thu, Jan 17, 2019 at 03:05:17PM -0600, David Rock wrote: > In [7]: nan == nan > Out[7]: False > > In [8]: a = 1.1 > > In [9]: a ==a > Out[9]: True
> both a and nan are floats, so why does a == a work, but nan == nan > doesn’t? They both "work", because they both do what they are designed to do. Equality between two floats works something like this: if either number is a NAN: return False if both numbers are 0.0 or -0.0: return True if both numbers have the same bit-pattern: return True otherwise return False -- Steve _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor