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

\
 
 \ /
  Last update: 2005-03-22 12:53    [W:0.047 / U:0.012 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site