Skip to content

Inexplicable answer change #2047

Closed Answered by billsacks
samsrabin asked this question in Q&A
Discussion options

You must be logged in to vote

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…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by samsrabin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants