Why float('Nan') == float('Nan') is False
avigross at verizon.net
Wed Feb 13 14:00:57 EST 2019
I won't speak for the IEEE but NOT A NUMBER does not tell you what something
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.
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:
> >>> float('Nan') == float('Nan')
If you think that's odd, how about this?
>>> n = float('nan')
>>> n is n
>>> n == n
> Why ?
IEEE says so.
Grant Edwards grant.b.edwards Yow! Like I always say
at -- nothing can beat
gmail.com the BRATWURST here in
More information about the Python-list