-
I'm having trouble understanding why this 3-line commit produces answer changes for the As a workaround, I can just get rid of |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It looks like an order of operations thing: algebraically equivalent code like this often leads to roundoff-level differences due to a different order of operations. In this case, I bet you could get bfb results if, in the baseline, you put parentheses around |
Beta Was this translation helpful? Give feedback.
It looks like an order of operations thing: algebraically equivalent code like this often leads to roundoff-level differences due to a different order of operations. In this case, I bet you could get bfb results if, in the baseline, you put parentheses around
cpool_to_reproductivec(p,k) - repr_grainc_to_seed(p,k)
, forcing the compiler to evaluate that difference and then add the result to the first term, as opposed to executing this as(t1 * reproductivec(p,k) + cpool_to_reproductivec(p,k)) - repr_grainc_to_seed(p,k)
. However, if you have already done the work to verify that the answer changes in your branch are solely due to this commit, then I don't think you need to go to the trouble o…