This site is no longer active and is available for archival purposes only. Registration and login is disabled.

What's faster float or double on ARM?


What's faster float or double on ARM?

Postby kornalius » Feb 19, 2004 @ 4:23pm

I'd like to know what type is faster: float or double on the ARM? My compiler uses double at this point but I'd like to speed it up a bit more by using float. Will I see a good gain?

I would also like to know if float type is enough for a compiler/interpreter use or I absolutely have to use double type variables?

Btw, my compiler uses no variable types at all. The internal of course do but the user doesn't know about it.

Regards,
Kornalius
User avatar
kornalius
pm Member
 
Posts: 1704
Joined: Dec 9, 2003 @ 6:04pm
Location: Montreal, Québec, Canada


Postby Presto » Feb 19, 2004 @ 5:14pm

I don't think you'll see any gain. Without a floating point processor, any use of float or double is going to be a bit slow. Personally, I prefer using doubles rather than floats, simply because a lot of the functions are designed for doubles (sqrt for example), and the time it would take to typecast the double results to a float would probably negate any potential gain of using the float.

That's just my take on it. I know there are a lot of people here into using fixed-point math. I try to avoid floats/doubles whenever possible, but when I do need that precision, I'm using doubles.

-John
User avatar
Presto
pm Insider
 
Posts: 763
Joined: Jan 20, 2003 @ 5:51am
Location: Kalesian Archipelago


Postby angedelamort » Feb 19, 2004 @ 5:31pm

float are 4 bytes and double 8 bytes. So the float should be faster and takes less memory. But less precision (but it's enouph).
I have made a floating point emulation class for Brew and if the ppc do the same thing, it should be faster with just float.

And for your information... I don't think casting float to double takes that much times when you call sqrt. You should avoid sqrt instead...
User avatar
angedelamort
pm Member
 
Posts: 304
Joined: Mar 7, 2002 @ 11:16pm
Location: Montreal, Quebec


Postby mlepage » Feb 19, 2004 @ 9:42pm

Make a typedef so you can test between the two. That's good practice anyways because the answer may change from compiler to compiler, or on different devices with various hardware or libraries.

I personally found in one project that float was a bit faster than double. But your project could be different! There are various tradeoffs, and your project may favour some more than others (such as my project).
www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Postby kornalius » Feb 19, 2004 @ 11:14pm

User avatar
kornalius
pm Member
 
Posts: 1704
Joined: Dec 9, 2003 @ 6:04pm
Location: Montreal, Québec, Canada


Postby refractor » Feb 23, 2004 @ 12:14pm

On ARMs it really depends what internal format the floating point emulator (FPE) is using. I know that some use double as their internal format, so crunching a lot of floats incurs a lot of translations to/from double on the way in/out of the FPE. That generally means that floats may be processed slower than doubles.

Really, I concur with mlepage; it depends on what you're doing. Benchmark benchmark benchmark..
User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum