Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top