[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On 2/13/19 12:32 PM, Marko Rauhamaa wrote: > "Avi Gross" <avigross at verizon.net>: > >> A NaN is a bit like a black hole. Anything thrown in disappears and >> that is about all we know about it. No two black holes are the same >> even if they seem to have the same mass, spin and charge. All they >> share is that we don't know what is in them. > > Then, how do you explain: > > >>> float("nan") != float("nan") > True > > Why's that not False? > > > Marko > Because IEEE-754 decided that it was non-optional that (x != y) was equal to not (x == y). Which is not the case for the ordering operators, since ordering is inherently undefined. In part, these decisions were made to make it possible to detect a NaN in C in the absence of an isnan() function. If (x != x), then x must be a NaN. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix.

- Prev by Date:
**Why float('Nan') == float('Nan') is False** - Next by Date:
**How do/can I generate a PKCS#12 file the cryptography module?** - Previous by thread:
**Why float('Nan') == float('Nan') is False** - Next by thread:
**Why float('Nan') == float('Nan') is False** - Index(es):