Re:Can we trust floating-point numbers? (2006) [pdf]
by zwegner on Tuesday September 16, 2014 @04:13PM
(#8326828)
Actually commutativity doesn't hold either, because of dealing with NaNs (at least on x86, on a quick search I can't find a reference for whether this behavior is part of IEEE 754 or just implementation defined). Operations with two NaNs will give the first operand. You can see this with a quick test program:
Of course, this probably doesn't matter for most applications.
[ Parent
| on HN ]
Re:Can we trust floating-point numbers? (2006) [pdf]
by stephencanon on Tuesday September 16, 2014 @04:16PM
(#8326842)
IEEE-754 says that the result “should” be one of the two input NaNs. A platform could choose to e.g. take the NaN with the smaller payload to make * and + commutative, or it could simply define away NaN payloads entirely.