title: lerp for integers or in fixed point math
body: <p>Is there an elegant way to do linear interpolation using integers? (To average ADC measurements in microcontroller, ADC measurements are 12bit, microcontroller works fine with 32bit integers). Coefficient f is in [0, 1] range.</p>
  
  <pre><code>float lerp(float a, float b, float f)
  {
      return a + f * (b - a);
  }
  </code></pre>