[Python-Dev] Mixing float and Decimal -- thread reboot
alexander.belopolsky at gmail.com
Wed Mar 24 19:26:12 CET 2010
On Wed, Mar 24, 2010 at 1:39 PM, Raymond Hettinger
<raymond.hettinger at gmail.com> wrote:
> IMO, their least useful feature is the property of being not equal
> to themselves -- that causes more problems than it solves
> because it impairs a programmer's ability to reason about
> their programs.
I agree. An often cited rationale for IEEE 754 behavior is that it
eliminates branching in some high performance numerical algorithms.
While this is likely to be true, I have never seen it benefiting real
life applications, certainly not those written in Python.
I wonder why Python did not follow Java model where Float NaN objects
unlike raw float NaNs compare equal to themselves. One reason may
be that Python does not have raw floats, but if someone needs IEEE 754
NaNs, one can use numpy scalars or add arithmetics to ctypes numerical
Mark, I wonder if you could describe an algorithm off the top of your
head that relies on NaN == NaN being false.
More information about the Python-Dev