8 bit AVR microcontrollers are great in many aspects, but when things start circling around floating point arithmetic’s it may get nasty. All thing began when Alan was working on a simple Arduino project where he was reading accelerometer values and updating led stripe according to it. But it turned out that direct mapping jitterred so logical step was to add smoothing algorithm.
As smoothing algorithm he has chosen Exponential moving average which is simple to implement. As AVRs don’t have hardware division instruction compiler makes it do in software resulting in slow performance. So instead of using floating point calculation Alan wrote a fixed point algorithm version that resulted in 6 timer faster performance. Instead of leaving this as goal he dug deeper with assembly language what gave up to 10 times difference comparing to floating point version. After his research Alan made clear conclusions – avoid using division where possible. This results in slow performance no matter if you’re using floating point or integer arithmetic’s. So this is great guide especially when projects require some intense calculus.