/* Taken from here; https://stackoverflow.com/questions/42537957/fast-accurate-atan-arctan-approximation-algorithm */ #define A 0.0776509570923569 #define B -0.287434475393028 #define C (M_PI_4 - A - B) double FastArcTan(double x) { double xx = x * x; return ((A*xx + B)*xx + C)*x; }