For Programmers: Free Programming Magazines  


Home > Archive > Functional > May 2007 > Commutativity of IEEE 754 addition









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Commutativity of IEEE 754 addition
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>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com