Messages in this thread | | | Date | Sun, 30 May 2004 22:59:00 -0500 | From | Matt Mackall <> | Subject | Re: How to use floating point in a module? |
| |
On Sun, May 30, 2004 at 08:52:23PM -0500, ndiamond@despammed.com wrote:
> A driver, implemented as a module, must do some floating-point > computations including trig functions. Fortunately the architecture > is x86. A few hundred kilograms of searching (almost a ton of > searching :-) seems to reveal the following possibilities.
[bizarre method deleted]
How about:
mask off interrupts locally save floating point state do floating point work restore floating point state restore interrupt mask
You will need to take care that you keep gcc from using library functions, see the gcc manual.
Another approach is to do it all in fixed point, which is a simple matter of doing some shifts after your multiplies. This only works if you've got a fairly small dynamic range, but if you only need to calculate a sine or two, it's not too painful and you can have about 8-10 decimal digits of accuracy. Or you can go quick and dirty with a piecewise polynomial approximation for 2-5 digits of accuracy.
-- Mathematics is the supreme nostalgia of our time. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |