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

Test Bot onlinejudge95 at gmail.com
Wed Feb 13 14:27:40 EST 2019


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.

On Thu, Feb 14, 2019, 12:33 AM Avi Gross <avigross at verizon.net wrote:

> I won't speak for the IEEE but NOT A NUMBER does not tell you what
> something
> IS.
>
> If "Hello, World!" is not a number as in an int or a float and we throw
> away
> the content and simply call it a NaN or something and then we notice that
> an
> object that is a list of fruits is also not a number so we call it a NaN
> too, then should  they be equal?
>
> 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.
>
> When variable "a" is a Nan then it is sort of a pointer to a concept. The
> pointer IS itself but the concepts may not be.
>
> -----Original Message-----
> From: Python-list <python-list-bounces+avigross=verizon.net at python.org> On
> Behalf Of Grant Edwards
> Sent: Wednesday, February 13, 2019 1:03 PM
> To: python-list at python.org
> Subject: Re: Why float('Nan') == float('Nan') is False
>
> On 2019-02-13, ast <none at gmail.com> wrote:
> > Hello
> >
> > >>> float('Nan') == float('Nan')
> > False
>
> If you think that's odd, how about this?
>
>     >>> n = float('nan')
>     >>> n
>     nan
>     >>> n is n
>     True
>     >>> n == n
>     False
>     >>>
>
> > Why ?
>
> IEEE says so.
>
> --
> Grant Edwards               grant.b.edwards        Yow! Like I always say
>                                   at               -- nothing can beat
>                               gmail.com            the BRATWURST here in
>                                                    DUSSELDORF!!
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list