[NBLUG/talk] Fixed point math library for C -- recommendations?

Scott Doty scott at ponzo.net
Wed Nov 28 10:12:08 PST 2007


On Wed, Nov 21, 2007 at 10:40:30AM -0800, Bill Kendrick wrote:
> 
> A number of areas in Tux Paint [1] rely heavily on floating-point math.
> This is great in terms of the quality of the effects, but makes parts of
> Tux Paint nearly unusable on platforms that lack dedicated FPUs.
> (The Sharp Zaurus PDA and Nokia N770 and 800 internet tablets, for example.)
> 
> Is there a library, or perhaps source-mangling tool, that can convert
> floating math in C program to fixed point?  I'd like to keep the float stuff
> in the main codebase, if at all possible...  both to keep the code
> human-readable, and to continue to take advantage of the real floating point
> math on systems with FPUs.  (Arguably, most systems running Tux Paint, since
> most users are on Windows, Mac OS X and Linux, systems, respectively [2].)
> 
> I'd obviously prefer something common (e.g., in Ubuntu and Debian), so that
> other developers can continue working on Tux Paint with the least fuss... :)

If I understand you correctly, you might be able to effect this by using the
fixed-point routines in libgcc.a, called via the "implicit library call"
hooks of gcc:

   http://www.psc.edu/general/software/packages/gcc/manual/gcc_201.html

On the other hand, I'm not sure what you're asking for, so I could be way
off-base...

HTH! :)

 -Scott



More information about the talk mailing list