# Why float('Nan') == float('Nan') is False

Joe Pfeiffer pfeiffer at cs.nmsu.edu
Wed Feb 13 20:11:43 EST 2019

```songbird <songbird at anthive.com> writes:

> Chris Angelico wrote:
>> On Thu, Feb 14, 2019 at 7:12 AM Test Bot <onlinejudge95 at gmail.com> wrote:
>>>
>>> This definition of NaN is much better in mentally visualizing all the so
>>> called bizarreness of IEEE. This also makes intuitive that no 2 NaN will be
>>> equal just as no 2 infinities would be equal. I believe in a hypothesis(of
>>> my own creation) that any arithmetic on a data type of NaN would be similar
>>> to any set of operations on the set of Infinities.
>>>
>>
>> Why would no two infinities be equal? In mathematics, there's one
>> best-known infinity (aleph null, aka the number of counting numbers),
>> and many many infinities are provably equal to it. (Others are
>> provably NOT equal to it, like the number of real numbers.) There's
>> nothing wrong with saying "there are as many prime numbers as there
>> are odd numbers", or equivalently that "the size/cardinality of the
>> set of primes is equal to the size of the set of odd numbers" [1]. And
>> both Python and IEEE agree:
> ...
>> [1] I'm sure someone will point out something pedantically wrong in
>> what I said, but certainly the sets have the same cardinality.
>
>   all such proofs i have ever seen are based upon the
> assumptions that there are infinite numbers of such
> things like primes.
>
>   this only makes sense in theory.
>
>   alas, we don't really know if the universe is infinitely
> subdivisible (as the reals seem to represent) or infinitely
> large (even if it isn't infinitely subdivisible)...  so to
> me every one of those proofs is conditional upon assumptions
> (which also drags the p = np question into such assumptions).
>
>   it's fun to think about.  :)

It doesn't depend upon assumptions, it depends on definitions and
logic.  You don't need to assume there are an infinite number of primes,
it's been proven.  It doesn't matter whether the universe is infinitely
subdivisible or infinitely large, the set of real number is (assuming
I'm interpreting your "subdivisible" correctly).  I've got no idea what
P and NP have to do with this.
```