Re: arithmetic functions for linux driver

From: Peter Williams
Date: Wed Mar 17 2004 - 18:24:43 EST


VINOD GOPAL wrote:
Hi,
I am new to linux world and this mailing list.

I need to use the arithmetic functions like sin, cos,
exp, log, etc in linux device driver.

On search read , not to use libm from kernel driver
as it will harm the fpu registers.
Do you have any insight how to support these
functions in linux driver or any code that is
available which I can make use of?

I'd recommend using fixed denominator rational numbers to represent real numbers and polynomial approximations for the transcendental functions. We do this in our EBS scheduler patches and it seems to be successful. The main downside to this approach is the limited range (and precision) of values that can be represented so you need to have a clear idea of the likely values at various stages of your calculations.

The "Handbook of Mathematical Functions" by Abramowitz and Stegun, Dover Publications, New York ISBN 486-61272-4 (LCN 65-12253) is a good source of methods for approximating functions.

If you'd like more detailed assistance don't hesitate to ask.

Peter
--
Dr Peter Williams, Chief Scientist peterw@xxxxxxxxxx
Aurema Pty Limited Tel:+61 2 9698 2322
PO Box 305, Strawberry Hills NSW 2012, Australia Fax:+61 2 9699 9174
79 Myrtle Street, Chippendale NSW 2008, Australia http://www.aurema.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/