Messages in this thread |  | | Date | Mon, 21 May 2001 00:33:08 +0300 | From | Matti Aarnio <> | Subject | Re: sqrt in kernel? |
| |
On Sun, May 20, 2001 at 04:33:20PM -0400, Robert M. Love wrote: > 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.
> 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.
> thanks, > -- > Robert M. Love > rml@ufl.edu > rml@tech9.net
/Matti Aarnio - 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/
|  |