Carmack在QUAKE3中使用的计算平方根的函数
2016-06-03 15:52
357 查看
// // Carmack在QUAKE3中使用的计算平方根的函数 // float CarmSqrt(float x){ union{ int intPart; float floatPart; } convertor; union{ int intPart; float floatPart; } convertor2; convertor.floatPart = x; convertor2.floatPart = x; convertor.intPart = 0x1FBCF800 + (convertor.intPart >> 1); convertor2.intPart = 0x5f3759df - (convertor2.intPart >> 1); return 0.5f*(convertor.floatPart + (x * convertor2.floatPart)); }
相关文章推荐
- 2015-10-水渠边的记忆
- 238ProductofArrayExceptSelf
- 类似QQ删除ListView(二)
- 设计模式-桥接模式
- Picasso OOM浅谈。
- redis
- Ecshop实现微信第三方授权扫码登录
- #FFFFFF 和RGB的相互转化
- LeetCode 27. Remove Elemen
- Qt 程序打包发布
- 仿照linux下的uboot来DIY自己的arm11(6410)的bootloader
- 配置高可用的Hadoop平台
- 如何让linux时间与internet时间同步(centos)
- 也谈谈同源策略和跨域问题
- [正则表达式]PCRE反向分组引用
- centos 发送邮件
- Android设置状态栏透明代码!!!!
- 和Linux大魔王一起愉快的玩耍(二)make命令和mekefile
- hibernate中的addEntity setResultTransformer的比较
- 二进制位翻转: