← Back to context

Comment by sva_

24 days ago

> floating point accumulation doesn't commute

It is commutative (except for NaN). It isn't associative though.

I think it commutes even when one or both inputs are NaN? The output is always NaN.

  • NaNs are distinguishable. /Which/ NaN you get doesn't commute.

    • I guess at the bit level, but not at the level of computation? Anything that relies on bit patterns of nans behaving in a certain way (like how they propagate) is in dangerous territory.

      10 replies →

  • Unless you compile with fast-math ofc, because then the compiler will assume that NaN never occurs in the program.