The Fast and the Furious World (of Trigonometric Functions on ATMega328)
Atan2 algorithms - speed vs accuracy Running trigonometric functions on an 8-bit AVR is inevitably going to be slow. Floating point operations come with speed overheads and the most accurate algorithms usually come at a further timing price. The arctangent function (atan/atan2) is ubiquitously useful, and especially so for Quadcopter's and robotics. Briefly, an atan2 function takes Y and X as arguments and works out which quadrant the tangent angle is in, and uses that to call a corresponding atan function. I have been investigated the timings of various trigonometric functions on an ATMega328p chip running at 16 MHz, and in particular exploring 4 atan2 implementations and their trade-offs for accuracy.