quake3中求1/sqrt(x)的算法源代码如下(未作任何修改): float Q_rsqrt( float number ) { long i; float x2, y; const float threehalfs = 1.5F; x2 = number * 0.5F; y = number; i = * ( long * ) &y; // evil floating point bit level hacking i = ); // what the fuck? y = * ( floa…
Implement int sqrt(int x). Compute and return the square root of x. class Solution { public: int sqrt(int x) { // Start typing your C/C++ solution below // DO NOT write int main() function ) ; ) ; ; int large=x; ; while(small<large){ int a = x/temp;…