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

songbird songbird at anthive.com
Wed Feb 13 16:40:21 EST 2019


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.  :)


  songbird



More information about the Python-list mailing list