|
|
|
|
|
by account42
1419 days ago
|
|
Associativity and communtativity are different things. @hi + @lo + @hi means (@hi + @lo) + @hi @hi + @hi + @lo means (@hi + @hi) + @lo Just because you can write this without the parentheses does not mean you can ignore them. To get from one to the other need not just the commutativity rule relied on by the diffing algorithm but also the associativity rule: (@hi + @lo) + @hi =assoc=> @hi + (@lo + @hi) =comm=> @hi + (@hi + @lo) =assoc=> (@hi + @hi) + @lo Here the third (associativity) change introduces the overflow, not the commutativity change which should always be safe for both integers and floating point numbers. |
|
His example included SUM(b + c) and SUM(c + b) as equivalent. As such it probably is[1] but extend it to 3 numbers and you can't rearrange, as I think we agree.
[1] assuming b and c are numbers not strings, as + is string concat in some dialects