On 12/19/07, Andrew MacLeod <[EMAIL PROTECTED]> wrote: > Daniel Berlin wrote: > > > > Here is the easy one: > > > > z_5 = a_3 + b_3 > > x_4 = z_5 + c_3 > > > > DEBUG(x, x_4) > > > > > > Reassoc may transform this into: > > > > > > z_5 = c_3 + b_3 > > x_4 = z_5 + a_3 > > > > DEBUG(x, x_4) > > > > Now x has the wrong value. > > > ?? > > x_4 looks like it has the value 'a_3 + b_3 + c_3' in both examples to > me, although computed in different orders... > > so isn't that still the right value?
Yes, sorry, you have to add one more set of adds below and move one so you can make it have a different value You get the general idea though :) Reassoc knows they are all only used in each other, and that it is okay to change their intermediate value as long as the last thing int he chain retains its value (which it does since they are all commutative operations) > > Andrew >