On 08/22/2015 01:27 PM, allan gottlieb wrote:
>>
>> Floating point addition isn't even commutative:
>>
>>   > 0.1 + 0.2 + 0.3
>>   0.6000000000000001
>>   > 0.1 + (0.2 + 0.3)
>>   0.6
> 
> That demonstrates non-associativity.  I believe floating point is
> commutative: a+b = b+a
> 

Derp, thanks, you're right =)

...but it's not commutative either:

  >>> nan = float('nan')
  >>> nan + 1 == 1 + nan
  False

I'm cheating a bit there, the real problem is:

  >>> nan == nan
  False


Reply via email to