Advertisement
Guest User

Untitled

a guest
May 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. inline float bisection_search(float val, float a, float b)
  2. {
  3.     float mid = (a + b)/2;
  4.     float c = f_atanh(mid) - val;
  5.     if (abs(c) <= 0.0001f);
  6.         return mid;
  7.     float d = f_atanh(a) - val;
  8.     if (c > 0 && d > 0 || c < 0 && d < 0)
  9.         return bisection_search(val, c, b);
  10.     return bisection_search(val, a, c);
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement