| David Hopwood 2007-05-21, 10:05 pm |
| David Hopwood wrote:
> Alexander Schmolck wrote:
>
> It's not commutative for IEEE NaNs with "payloads". But most languages don't
> specify their floating point in such a way that the NaN payload information
> can be relied on, anyway.
>
> There is also a paper entitled "When floating-point addition isn't commutative":
>
> <http://portal.acm.org/citation.cfm?id=156301.156303>
>
> but I don't have an ACM subscription, so I don't know whether it is just
> referring to NaNs with payloads, or whether there are any other cases.
Oh, of course: for non-NaNs, correctly implemented IEEE arithmetic is
"exactly rounded". So addition of non-NaNs must be commutative for any
given rounding rule, since
toFloat(roundingRule, toReal(a) + toReal(b)) =
toFloat(roundingRule, toReal(b) + toReal(a)).
--
David Hopwood <david.hopwood@industrial-designers.co.uk>
|