From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <199903032053.OAA0000010875@localhost> Date: Wed, 3 Mar 1999 14:53:39 -0600 (CST) From: esci Subject: Re: sqrt performance [snip] >Looking at the structure of your code I think it *should* be possible >to get some acceleration exploiting regulatiry of sqrt argument: >some_value*constant_for_this_cycle+delta^2*(i++)^2 >for i=1,N > >I'm thinking about division of one argument over other. >Can you expect any relation of general nature like >some_value*constant_for_this_cycle<or vice versa or anything in this style ? 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. 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. 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 :-( I'm currently looking into using a table driven Taylor's series expansion. 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. Reginald Beardsley ------------------------------------------------------------------------               Exploration Software Consultants Inc. Voice: 972-379-0557 email: rhb@acm.org Fax: 972-379-0558 ------------------------------------------------------------------------