iPhone 上的双精度与浮动

发布于 2024-08-09 02:10:54 字数 111 浏览 3 评论 0原文

我刚刚听说 iPhone 本身无法进行双倍操作,从而使它们比常规浮动慢得多。

这是真的吗?证据?

我对这个问题很感兴趣,因为我的程序需要高精度计算,而且我将不得不在速度上妥协。

I have just heard that the iphone cannot do double natively thereby making them much slower that regular float.

Is this true? Evidence?

I am very interested in the issue because my program needs high precision calculations, and I will have to compromise on speed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

善良天后 2024-08-16 02:10:55

iPhone 可以在硬件中执行单精度和双精度算术。在 1176(原始 iPhone 和 iPhone3G)上,它们的运行速度大致相同,尽管您可以在缓存中容纳更多单精度数据。在 Cortex-A8(iPhone3GS、iPhone4 和 iPad)上,单精度算术是在 NEON 单元而不是 VFP 上完成的,并且速度要快得多。

如果您正在进行密集的浮点计算,请确保在 armv6 的编译设置中关闭拇指模式。

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.

Make sure to turn off thumb mode in your compile settings for armv6 if you are doing intensive floating-point computation.

不醒的梦 2024-08-16 02:10:55

此幻灯片深入了解为什么没有好的浮点以及为什么存在(向量浮点单元)。显然,检查“拇指模式”很重要,它会影响浮点支持是否打开。这并不总是一种改进。它展示了如何在汇编代码中找到正确的指令。

它还取决于您想要运行代码的手机版本。最近的一个似乎在进行浮点数学方面“更有能力”。

编辑:这里有一篇关于 ARM 上使用 VFP 和 NEON SSE 的浮点优化的有趣读物。

This slide show gives insight in why there isn't good floating point and why there is (the vector floating point unit). Apparently, it is important you check the "thumb mode" which influences whether or not floating point support is on. This is not always an improvement. It shows how to find the right instructions in the assembly code.

It also depends on what version of the phone you want to run your code. The most recent one seems "more capable" in doing floating point math.

EDIT: here's an interesting read on floating point optimizations on the ARM with VFP and NEON SSE.

海螺姑娘 2024-08-16 02:10:55

ARM1176JZF-S手册上说它支持双精度浮点数。你应该保持良好的状态。这是链接 到 PDF 文档。后来的 iPhone 都是 Cortex 芯片,当然性能也不应该下降。

The ARM1176JZF-S manual says that it supports double precision floating point numbers. You should be in good shape. Here's a link to the PDF documentation. Later iPhones are Cortex chips, and certainly shouldn't be less capable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文