math library

John D. Mitchell (johnm@non.net)
29 Mar 1997 04:38:57 -0000

>>>>> "Edward" == Edward Di Geronimo <edwdig@bergen.org> writes:
[...]
> I'm confused about the math support. Can we use stuff less than 80 bits?
> I was looking into raycasting, and it needs lookup tables. With 80 bit
> numbers I'd end up with over 100k of fixed memory. That's not gonna
> multitask well. I don't need nearly that much precision, 32 bit is
> fine. Basically, what I need is the results of the trig functions put
> into lookup tables. Can I do this in less than 80 bit numbers?

For that type of calculations, you do *not* want floating point numbers.
You should use one or more of the Fixed-Point data types (WWFixed, DWFixed,
etc.) and the various functions of the graphics library.

Depending on how much pain you're interested in (and/or how good/fast you
really need everything to be) you can look to implementing the math
functions that you need in a way which is tailored to your uses. Embedded
Systems magazine has had a number of articles/series on this type of thing
written by P.J. Plauger, Jack Crenshaw, and others. Good discrete
mathematics books are good resources but they often get into weird shit
rather than really useful things. :-)

Hope this helps,
John