This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: fixed point math?
- From: Ranjit Mathew <rmathew at hotmail dot com>
- To: java at gcc dot gnu dot org
- Date: Fri, 27 Jun 2003 11:35:35 +0530
- Subject: Re: fixed point math?
- References: <m17k78cra9.fsf@nowhere.com>
> Does anybody know if there's a quick, easy way to compile a program
> that uses lots of float's so that the floats are represented as
> fixed-point values? An added bonus would be continuing to generate
> floating point ops for double's, but that's not a requirement.
>
> The only idea I've come up with is rewriting libfloat and using
> -msoft-float. Is there an easier or cleaner way?
Some dumb questions related to this:
Does -msoft-float imply using the SoftFloat library:
http://www.jhauser.us/arithmetic/SoftFloat.html
If not, you might want to take a dekko at this library.
However, I'm a bit confused by your requirements - you
obviously are not targetting an embedded platform without
an FPU, as you actually would like the doubles to be
using floating-point operations, so why do you need
this?
Is it for speed? AFAIK, x86 processors since the Pentium
have had very good and fast floating-point support - this
is what made John Carmack switch from using fixed-point
for DOOM to using floating-point for Quake and subsequent
games from iD Software.
I guess you realise that floating-point and fixed-point
numbers have very different ranges and representability
(for large numbers), so you should be prepared for
these in your arithmetic.
Sorry if I seem to have completely missed the point.
Ranjit.
--
Ranjit Mathew Email: rmathew AT hotmail DOT com
Bangalore, INDIA. Web: http://ranjitmathew.tripod.com/