[Python-Dev] Python-Dev Digest, Vol 69, Issue 143

Mark Dickinson dickinsm at gmail.com
Fri Apr 17 17:42:10 CEST 2009

On Fri, Apr 17, 2009 at 3:58 PM, Scott David Daniels
<Scott.Daniels at acm.org> wrote:
> Non-associativity is what makes for floating point headaches.
> To my knowledge, floating point is at least commutative.

Well, mostly. :-)

>>> from decimal import Decimal
>>> x, y = Decimal('NaN123'), Decimal('-NaN456')
>>> x + y
>>> y + x

Similar effects can happen with regular IEEE 754 binary doubles,
but Python doesn't expose NaN payloads or signs, so we don't
see those effects witihin Python.


More information about the Python-Dev mailing list