The answer is simple math. You can check whether it's correct by looking at the units:
Say your distances are in pixels (just to keep it video game).
A position or distance between two positions is in pixels:
pix
Velocity is a change in position over a period of time:
pix/sec
Acceleration is how fast the velocity is changing over time:
pix/sec/sec or
pix/sec²
The units of dt are, of course, in seconds. So if you multiply an acceleration by dt you get
pix/sec² *
sec =
pix/sec. If you multiply a velocity by dt you get
pix/sec *
sec =
pix.
This is easier to understand if you think about velocity and accelerating in terms of a calculus-ey understanding of changes in position:
velocity =
dx/dt
acceleration =
dv/dt =
d²x/dt²
That is, velocity is the rate at which position changes over time, and acceleration is the rate at which velocity changes over time.
Note that the
dt you have here is not actually a calculus "dt", which would be infinitesimal. So you may encounter problems if you try to do more complicated things with it, like a drag force that incorporates velocity:
F = C * v (where C is some coefficient of drag)
which you might write in a game as:
| particle->acceleration += drag_coef * particle->velocity
|
As it turns out, the number of times that the velocity is added to the acceleration per second does actually matter, as I found out when I removed the sleep() from my game's update loop and the player could no longer jump high enough.