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 = 0x5f3759df - ( i >> ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed #ifndef Q3_VM
#ifdef __linux__
assert( !isnan(y) ); // bk010122 - FPE?
#endif
#endif
return y;
}

最新文章

  1. ios xcode 下 报出 ”xx“is missing from working copy 的问题
  2. Beta阶段站立会议-01
  3. java中快速排序的理解以及实例
  4. dom自定义属性 兼容 index值获取
  5. Linux环境安装Jenkins
  6. readonly=“readonly”与readonly=“true”
  7. jquery怎么实现跨域的访问呢?与别人提供的接口连接
  8. js隐藏
  9. 图像处理-07-图像的轮廓提取-Robert算子
  10. IO流-输入输出的简单实例
  11. mysql、nginx、php-fpm的启动与关闭
  12. tensorflow 经典教程及案例
  13. 实例:用户界面控件Kendo UI vs DevExpress对比评测一
  14. django引入模板时,部分css文件渲染不成功失灵引入不成功
  15. linux 单次定时任务
  16. Alpha冲刺8
  17. index-document-shard
  18. es内部的多线程异步并发控制
  19. redis 配置文件翻译
  20. tms web core介绍

热门文章

  1. 一句命令激活windows/office
  2. 常用的 Linux iptables 规则
  3. keepalived+nginx双机热备+负载均衡
  4. WideCharToMultiByte和MultiByteToWideChar函数的用法(转)
  5. 编译 Linux 3.5 内核烧写 Android 4.2.2 到 Tiny4412 开发板
  6. 如何在CentOS或者RHEL上启用Nux Dextop仓库 安装shutter截图工具
  7. 前端常用功能记录(三)—datatables表格初始化(转)
  8. C语言 · 瓷砖铺放
  9. E-trunk和Eth-trunk 区别
  10. JQuery Table 合并单元格-解决Bug版本