From: Andrei A. Dergatchev <A.Dergatchev@tn.utwente.nl>
Subject: Re: sqrt performance
Date: Wed, 03 Mar 1999 22:40:46 +0100 [thread overview]
Message-ID: <36DDAC5E.269B242E@tn.utwente.nl> (raw)
In-Reply-To: <199903032053.OAA0000010875@localhost>
Hi,
[snip]
> All the values are monotonic, so you can speed things up a good bit by using
> the previous result as the starting point in a Newtonian iteration. It gives
> a factor of 3 speed up w/ g77 or NDP, but is slightly slower than the DU
> library routine. This was with 2 steps hard coded w/o conditional logic.
> I only need 13 bits of accuracy as the result is an index into an array.
Well, 3x speed up is already quite a lot, do you want to calculate sqrt at
one clock :-) ? Ok, just kidding. I believe requiring only 13 bits (out of 64
of input ?) we have plenty of room to optimise. Can you provide some
code using this optimisation to start with ?
> One of the things that is slowly sinking in is that my loop is too short,
> typically under 100 iterations. From what I'm seeing, I should be able to
> get faster results by chaining a number of loops together.
Yeah, for longer loops it might be possible to keep larger tables in cach.
> BTW can anyone provide good references on sqrt() methods? I looked in
> Knuth and quite a few other math references but found little other than very
> basic stuff (i.e. Newton's method) Knuth has one algorithm posed as an
> exercise (M40 == Mathematical, term project difficulty :-(
During somewhere in between Sep 1 1997 and Dec 1 1998 Dann Corbit
discussed optimum sqrt routines several times in comp.lang.c and
sci.math.num-analysis
This entiry thread was *very* useful for my background in applied math :-)
http://x11.dejanews.com/[ST_rn=ps]/dnquery.xp?&search=thread&svcclass=dnserver&ST=PS&CONTEXT=920496754.1956577512&HIT_CONTEXT=920496754.1956577512&HIT_NUM=0&recnum=%3c1998051405135800.BAA02391@ladder03.news.aol.com%3e%231/1
> I'm currently looking into using a table driven Taylor's series expansion.
You may want to search dejanews for ~a(Dann Corbit), ~g(comp.lang.c)
and "sqrt" :-) I'll steal just a few from what I was given.
http://x11.dejanews.com/[ST_rn=ps]/getdoc.xp?AN=324191203&CONTEXT=920497028.1963655168&hitnum=43
ftp://ftp.cs.umd.edu/pub/papers/papers/2990/2990.ps.Z
http://www.astro.virginia.edu/~eww6n/math/SquareRoot.html
> Hint's and suggestions *very* welcome. I need to do this over the range
> from 0 to 100,000,000 w/ the roots off by less than 1 (I actually need
> integer roots for the indexing). There ought to be a way to get this going
> a lot faster.
Do you need only roots of integers ?? Once more:
http://www.dejanews.com/[ST_rn=ps]/dnquery.xp?ST=PS&QRY=sqrt&defaultOp=AND&DBS=1&format=terse&showsort=date&maxhits=100&LNG=ALL&subjects=&groups=&authors=user923005%40aol.com&fromdate=&todate=
"I have different algorithms for each. For integer, go look at comp.lang.c for
a posting by Dann Corbit."
>
>
> Reginald Beardsley
>
> ------------------------------------------------------------------------
> Exploration Software Consultants Inc.
>
> Voice: 972-379-0557 email: rhb@acm.org
> Fax: 972-379-0558
> ------------------------------------------------------------------------
Good luck,
Andrei
next prev parent reply other threads:[~1999-03-03 21:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-03 20:53 sqrt performance esci
1999-03-03 21:40 ` Andrei A. Dergatchev [this message]
1999-03-04 5:15 ` Michal Jaegermann
1999-03-04 18:30 ` Joachim Wesner
1999-03-04 18:48 ` sqrt performance, further comment Joachim Wesner
1999-03-04 19:41 ` Michal Jaegermann
1999-03-04 19:51 ` Joachim Wesner
1999-03-05 17:55 ` Joachim Wesner
-- strict thread matches above, loose matches on Subject: below --
1999-03-03 13:21 sqrt performance esci
1999-03-03 18:51 ` Andrei A. Dergatchev
1999-03-03 2:26 esci
1999-03-03 9:27 ` Andrei A. Dergatchev
1999-03-03 11:59 ` Kazushige Goto
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox