steve+comp.lang.python at pearwood.info
Fri Oct 26 04:44:37 CEST 2012
On Thu, 25 Oct 2012 22:04:52 -0400, Terry Reedy wrote:
> It is a consequence of the following, which some people (but not all)
> believe is mandated by the IEEE standard.
> >>> nan = float('nan')
> >>> nan is nan
The IEEE 754 standard says nothing about object identity. It only
discusses value equality.
> >>> nan == nan
IEEE 754 states that all NANs compare unequal to everything, including
NANs with the same bit value. It doesn't make an exception for
comparisons with itself.
I'm not entirely sure why you suggest that there is an argument about
what IEEE 754 says about NANs. As far as I can see, the argument is
whether or not language designers should pick and choose which bits of
the standard they want to follow, thus taking a step backwards to the
chaos of numerical computing prior to the IEEE 754 standard.
Seriously, there are some real horror stories about numerical computing
back in the Bad Old Days. Like computers where 1.0/x could give a divide-
by-zero error even though x == 0 returned False.
More information about the Python-list