sqrt in kernel?
hi,
is there a sqrt function in the kernel? any other math functions?
i tried finding/grepping around, and found some various arch-specific stuff for fpu emulation... is there a general sqrt function? is there a single file to look through with the various math functions?
thanks,
Signature · 3 lines
Robert M. Love [email protected] [email protected]
Quoted 3 lines · Robert M. Love
hi,
is there a sqrt function in the kernel?
no. read the FAQ.
Quoted 2 lines
i tried finding/grepping around, and found some various arch-specific stuff for fpu emulation... is there a general sqrt function? is there a
In general questions like this are better asked on the kernelnewbies list. Read the FAQ.
john
Quoted 3 lines · Robert M. Love
hi,
is there a sqrt function in the kernel? any other math functions?
No. (Assuming FP math sqrt function is your interest.)
If you do scaled integers (fractions, with 2^n denominator), you can do newton iteration for sqrt nicely.
Quoted 3 lines
i tried finding/grepping around, and found some various arch-specific stuff for fpu emulation... is there a general sqrt function? is there a single file to look through with the various math functions?
Yes. Userspace. ( <math.h> )
As a rule: NO FP MATH IS ALLOWED IN THE KERNEL!
Now the question: Why do you think you need FP math ?
If your case is non-fast-path, you may do complete state save before, and restore after your FP code.
In some cases even the fast-paths carry FP/MMX code, but those are cases where the save/restore overhead becomes negligible for all of the other processing that is going on.
Quoted 5 lines
thanks,
Signature · 3 lines
Robert M. Love [email protected] [email protected]
/Matti Aarnio
Quoted 4 lines · Matti Aarnio
In some cases even the fast-paths carry FP/MMX code, but those are cases where the save/restore overhead becomes negligible for all of the other processing that is going on.
even in that case you must make sure you dont raise any FP exceptions, which could change the non-CPU based FPU context of the process.
Ingo