Whisket

Fast atan Lookup

May 22nd, 2020
1,569
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     Taken from here;
  3.     https://stackoverflow.com/questions/42537957/fast-accurate-atan-arctan-approximation-algorithm
  4. */
  5. #define A 0.0776509570923569
  6. #define B -0.287434475393028
  7. #define C (M_PI_4 - A - B)
  8.  
  9. double FastArcTan(double x) {
  10.     double xx = x * x;
  11.     return ((A*xx + B)*xx + C)*x;
  12. }
RAW Paste Data