Quote Originally Posted by reubenpatterson View Post
, but when I put the calculations first, the finalPos is already calculated incorrectly (because the formula breaks down) and the subtraction is done from that bad value, not the previous good value.
Store the previous value before calculation and use it if the test fails, otherwise use the new one.