- 1、本文档共17页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
浮点数到整数的快速转换(A rapid conversion of a floating point to an integer)
A rapid conversion of a floating point to an integer
In computer graphics operations, often converts floating-point number to an integer, such as in the image of the rasterizer stage, will perform a large number of type transformation, so that will represent the coordinates of the floating point number into integer in screen coordinates.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
/ /
/ / mandatory type conversion
/ / the fractional part will be cropped out
/ /
Float_val int_val = (int);
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Hey hey, Im glad youre just like me! This operation was so TINY that I never thought about how it would work until one day someone told me not to use the standard C type conversion because it was too slow! I was so shocked that the unlucky adventurer met the dragon.
The biggest advantage of the standard C type conversion is that its platform-independent, whether its running on an X86, or running on a PowerPC, you dont have to worry about anything, and the compiler will fix everything for you. This, too, is its greatest weakness - heavily dependent on the implementation of the compiler. The actual test shows that the code generated by the compiler is not very fast.
An alternative approach is to manipulate the data bit directly. If you are familiar with the IEEE representation of floating-point Numbers (if you dont know anything, check out the information in the appendix), its obvious. It extracts the exponent and the tail, then performs the shi
您可能关注的文档
- 鸿化公司物料在线监测系统及客户端程序改进(Honghua company material online monitoring system and client program improvement).doc
- 鸿合白板理论试题含答案(The theory test of honghe white board contains answers).doc
- 红色警戒尤里的复仇代码名对照(Red alert against yuri's revenge code name).doc
- 鸿业道路心得(Honghong road experience).doc
- 胡立朋 研发项目管理讲师—成功的研发项目管理(Hu lipeng research and development project management lecturer - successful r&d project management).doc
- 胡侦探1-16攻略(The hu detective 1-16).doc
- 黄瓜常见病的防治方法(The prevention and cure of cucumber common disease).doc
- 黄瓜的日常管理与常见病防治(The daily management of cucumber and the prevention and cure of common diseases).doc
- 黄河文明起源说(The origin of the Yellow River civilization).doc
- 黄金海岸论文(Gold coast paper).doc
- ASX_Series_操作说明书手册.pdf
- Battery-Backup-Kit-Installation-操作说明书手册.pdf
- DCB-05-V2-操作说明书手册.pdf
- DEIMOS-Installation-操作说明书手册.pdf
- Axess-Pro-Series-2120-Roller-Shutter-Pendant-操作说明书手册.pdf
- Controll-A-Door-P-Diamond-操作说明书手册.pdf
- Controll-A-Door-PD-Power-Drive-操作说明书手册.pdf
- Controll-A-Door-Secure-SDO-6-操作说明书手册.pdf
- AMX_Series_操作说明书手册.pdf
- ELI-250-Installation-操作说明书手册.pdf
最近下载
- 中华人民共和国机械行业标准燃煤热风炉技术条件.PDF
- 武汉市光谷为明实验学校新初一分班语文试卷含答案.pdf VIP
- 浙江大学紫金港校区校园平面图.PDF VIP
- 中级车号员(长)试题及答案.pdf VIP
- 铁路车号员(长):中级车号员(长)测试题.docx VIP
- 铁路车号员(长)中级车号员(长)试卷(铁路车号员(长)).doc VIP
- 铁路车号员(长)车号员一体化考试试卷(铁路车号员(长)).doc VIP
- 铁路车号员(长)铁路车号员(长)综合练习试卷(铁路车号员(长)).doc VIP
- 铁路车号员(长)铁路车号员(长)综合练习试卷.doc VIP
- 初中数学高质量作业设计策略与实践.pptx
文档评论(0)