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

casting float to int


casting float to int

Postby mm40 » May 17, 2007 @ 11:23pm

User avatar
mm40
pm Member
 
Posts: 135
Joined: Feb 21, 2003 @ 9:11pm


Postby Dan East » May 17, 2007 @ 11:44pm

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby mm40 » May 18, 2007 @ 3:57am

Yeah thats what I was thinking. I am using floating point math extensively in my game. Fixed point would of course be faster, but I always wait to see if its worth converting after testing.
User avatar
mm40
pm Member
 
Posts: 135
Joined: Feb 21, 2003 @ 9:11pm


Postby Dan East » May 18, 2007 @ 12:25pm

If your game does math real-time and needs to maintain a minimum FPS then fixed point will make a tremendous difference. I can't remember the exact numbers off the top of my head (maybe someone else can pipe in with them), but it was hundreds of cycles required to do a single floating point multiply. In fixed point you've got an integer multiply and a shift - just a couple instructions. So we're talking a factor of hundreds here, not just a few percent difference.

Dan East
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby Digby » May 18, 2007 @ 6:01pm

Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


Postby mm40 » May 18, 2007 @ 6:31pm

User avatar
mm40
pm Member
 
Posts: 135
Joined: Feb 21, 2003 @ 9:11pm


Postby Dan East » May 21, 2007 @ 1:50am

Floating point is emulated - the code that performs the actual floating point math is embedded in your app. The libraries produced by Intel and ARM that Digby referred to are simply better optimized - probably hand-coded ASM.

Pocket Quake's performance increased substantially just by rebuilding it with one of those kits, since it still has a decent amout of floating point math. I wasn't the one who did that build, so I can't offer more specifics.

Dan East
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby mm40 » May 21, 2007 @ 3:36pm

User avatar
mm40
pm Member
 
Posts: 135
Joined: Feb 21, 2003 @ 9:11pm


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

cron