Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!sei!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.arch Subject: Re: John von Neumann, sqrt instr Message-ID: <3894@bd.sei.cmu.edu> Date: 21 Aug 89 12:48:22 GMT References: <21353@cup.portal.com> <25643@obiwan.mips.COM> <1513@l.cc.purdue.edu> <2376@wyse.wyse.com> <3312@blake.acs.washington.edu> <12640@pur-ee.UUCP> Reply-To: firth@sei.cmu.edu (Robert Firth) Distribution: na Organization: Software Engineering Institute, Pittsburgh, PA Lines: 11 In article <12640@pur-ee.UUCP> hankd@pur-ee.UUCP (Hank Dietz) writes: >.. I still haven't been able to find a software technique to make square root >comparably fast. Anybody got a screamer of a software technique for >computing square root? A fairly good way os to use bit-level hacking to get a first approximation, and then unroll a few iterations of Newton's method. When I did sqrt for the PDP-11, the first approximation was two shifts and an add, and gave 5 bits of accuracy. Two iterations then yielded 23 bits for a reasonable single-precision result. With everything done in registers, the cost was certainly less than 20 multiplies.