From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 28638 invoked from network); 24 Jan 1999 19:09:39 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 24 Jan 1999 19:09:39 -0000 Received: from paralleldata.com (smtp.paralleldata.com [38.153.145.2]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id NAA32419 for ; Sun, 24 Jan 1999 13:42:02 -0500 Received: by paralleldata.com from localhost (router,SLMail V2.5); Sun, 24 Jan 1999 12:44:15 -0600 Received: by paralleldata.com from paralleldata.com (207.158.106.99::mail daemon; unverified,SLMail V2.5); Sun, 24 Jan 1999 12:44:12 -0600 Sender: "Wsb" Message-ID: <36AB77FD.51815D0A@paralleldata.com> Date: Sun, 24 Jan 1999 19:43:57 +0000 From: "Wes Bauske" Organization: Parallel Data Systems X-Mailer: Mozilla 4.04 [en] (X11; U; Linux 2.0.33 i686) MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: Why Alpha? (aka: is it worth it?) References: <199901241619.IAA13824@netcom19.netcom.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Munagala V. S. Ramanath wrote: > > > This is somewhat what I do though in my own code. I implement > > a sqrt() as a table lookup plus twiddle so I don't have to > > rely on anyone's sqrt() function call. What I do is not good > > to the ULP (unit of least precision, ie., last bit), > > but good enough for my algorithm. It is also faster than any > > silicon implementation I know of. Doing that sort of thing > > requires a good understanding of how your algorithm works. > > Anyway, my code is about twice as fast on a 533LX vs a PII400. > > That's great and exactly the kind of experience I was hoping for. > How much faster on the 533LX is your code compared to the native > silicon sqrt() on the PII400 ? > Never ran just that code. > Could you post the code or is it proprietary ? > > (Knuth also has a table lookup based implementation for a variety of > the transcendental functions in Metafont and may be a useful > starting point for people trying this approach.) > It's embbeded in the application so it would be difficult to just show that. The basic idea is that if you know the range of sqrt() input values your code will generate, build a table of values sampled in that space. Then all you need is some sort of twiddle. Those depend on how good you need the answer to be. One simple form is an interpolation between values. You could look at the math libs to see how they hone in on a value also. If Knuth has it in Metafont, it should be reasonable. He probably did it for the same reason I did. Be careful with recursive/iterative codes because they can be sensitive to errors. Wes