双重vs在iPhone上浮动 [英] Double vs float on the iPhone
问题描述
我刚刚听说,iphone不能做双重本能,因此使它们比常规浮动慢得多。
I have just heard that the iphone cannot do double natively thereby making them much slower that regular float.
这是真的吗?证据?
我对这个问题很感兴趣,因为我的程序需要高精度计算,我必须妥协速度。
I am very interested in the issue because my program needs high precision calculations, and I will have to compromise on speed.
推荐答案
iPhone可以在硬件中进行单精度和双精度算术。在1176(原始iPhone和iPhone3G)上,它们以大致相同的速度运行,尽管您可以在缓存中安装更多的单精度数据。在Cortex-A8(iPhone3GS,iPhone4和iPad)上,单精度算术是在NEON单元而不是VFP上完成的,速度明显更快。
The iPhone can do both single and double precision arithmetic in hardware. On the 1176 (original iPhone and iPhone3G), they operate at approximately the same speed, though you can fit more single-precision data in the caches. On the Cortex-A8 (iPhone3GS, iPhone4 and iPad), single-precision arithmetic is done on the NEON unit instead of VFP, and is substantially faster.
如果您正在进行密集的浮点计算,请关闭armv6的编译设置中的缩略图模式。
Make sure to turn off thumb mode in your compile settings for armv6 if you are doing intensive floating-point computation.
这篇关于双重vs在iPhone上浮动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!