阅读:1369回复:1
请教:如何在linux内核态调用正弦函数等数学公式?
我在做图象设备驱动时要用到正弦函数、余弦函数等,但好象可以编译通过,不能加载driver,请问各位该如何在这种情况下调用这些数学公式呢?如sin(),cos()...
|
|
沙发#
发布于:2004-05-08 18:24
网站上这样讲:
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 |
|