fast sqrt of type float

来源:互联网 发布:哪里的mac pro最便宜 编辑:程序博客网 时间:2024/05/19 22:51
float invSqrt(float x)
{
float xhalf=0.5f*x;
int i=*(int *)&x;
i=0x5f3759df-(i>>1);
x=*(float*)&i;
x=x*(1.5f-xhalf*x*x);
return x;
}
原创粉丝点击