p = p + v * dt;
v = v + a * dt;
How is this "single assignment"? Aren't v and p assigned values already before those lines? Or do they have some default initial value for their type that doesn't count as an assignment? p = p + v * dt;
v = v + a * dt;
How is this "single assignment"? Aren't v and p assigned values already before those lines? Or do they have some default initial value for their type that doesn't count as an assignment? v = v + a * dt;
p = p + v * dt;
is typically more accurate. The first form is Forward Euler integration [1], while my suggestion is Semi-implicit Euler [2].[1]: https://en.wikipedia.org/wiki/Euler_method [2]: https://en.wikipedia.org/wiki/Semi-implicit_Euler_method
What does the "single assignment" bit get you that a compiler with an SSA pass doesn't?
x = 5;
int* p = &x;
x = 6; // new binding of x
printf("%i\n",*p);
prints "6". If new bindings lived at different addresses, it would print "5".E.g. you can turn a C program into SSA, but if you have aliasing issues, it's not gonna fix them...
p[t+dt] = p[t]+v[t]*dt
v[t+dt] = v[t]+a[t]*dt
?