What is the best way to smooth a float value over ?

There’s a way to approximate the moving average idea without storing more than one value. Rather than storing the last N values and computing a moving average, you can do this cheap way by just storing one previous value instead. It’s not as accurate, but often good enough depending on how the values are changing over .

If you want to smooth as if you had a 10-sample moving average, you could do this

Smoothed = (NewValue + (PreviousValue * 9.0f)) / 10.0f
3 Likes