[svlug] Fixed point math library for C -- recommendations?

Bill Kendrick nbs at sonic.net
Wed Nov 21 13:25:41 PST 2007


On Wed, Nov 21, 2007 at 01:20:37PM -0800, Greg Lindahl wrote:
> 
> To use fixed-point, you have to know where to fix the point. Do you
> know that? A library or compiler can't guess for you, which is why you
> probably won't find an easy way to do the conversion.

I'm thinking something more simple, I guess.  For example, 1.0 becomes
1024, 0.5 becomes 512, etc..  Everything gets >> 10 before being used.
I've done this a few times in mobile (to get subpixel movement, rotation, etc.)
but I've always had to roll my own.

-- 
-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/




More information about the svlug mailing list