mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matti Aarnio <matti.aarnio@zmailer.org>
To: "Robert M. Love" <rml@tech9.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: sqrt in kernel?
Date: Mon, 21 May 2001 00:33:08 +0300	[thread overview]
Message-ID: <20010521003308.R5947@mea-ext.zmailer.org> (raw)
In-Reply-To: <990390802.1002.0.camel@phantasy>
In-Reply-To: <990390802.1002.0.camel@phantasy>; from rml@tech9.net on Sun, May 20, 2001 at 04:33:20PM -0400

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

  reply	other threads:[~2001-05-20 21:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-20 20:33 Robert M. Love
2001-05-20 21:33 ` Matti Aarnio [this message]
2001-05-20 23:31   ` Ingo Molnar
2001-05-20 21:33 ` John Levon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010521003308.R5947@mea-ext.zmailer.org \
    --to=matti.aarnio@zmailer.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rml@tech9.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®