We Recommend

C++ The Core Language C++ The Core Language
C++: The Core Language is for C programmers transitioning to C++. It's designed to get readers up to speed quickly by covering an essential subset of the language. The subset consists of features without which it's just not C++, and a handful of others that make it a reasonably useful language.


Posted By

Feb30th1712 on 01/14/08


Tagged

c InvSqrt


Versions (?)


The famous InvSqrt()


Published in: C++ 


Unknown author

  1. float InvSqrt (float x)
  2. {
  3. float xhalf = 0.5F * x;
  4. int i = * (int *) &x;
  5. i = 0x5F3759DF - (i >> 1);
  6. x = * (float *) &i;
  7. x = x * (1.5F - xhalf * x * x);
  8. return x;
  9. }

Report this snippet 

You need to login to post a comment.