Quadrotor from scratch
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

18 lines
290 B

/* Implementation of fast inverse square root.
* See http://en.wikipedia.org/wiki/Fast_inverse_square_root
*/
float fisqrt(float n)
{
long i;
float x2, y;
x2 = n * 0.5f;
y = n;
i = *(long *)&y;
i = 0x5f3759df - (i>>1);
y = *(float *)&i;
y = y * (1.5f - (x2*y*y));
return y;
}