lkml.org 
[lkml]   [2004]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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/

\
 
 \ /
  Last update: 2005-03-22 14:03    [W:0.091 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site