Advertisement
Whisket

Fast atan Lookup

May 22nd, 2020
1,775
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement