Article View: comp.arch
Article #11067Re: integer distance or sqrt
From: Torben AEgidius Mogensen
Date: Tue, 17 Nov 1992 17:40
Date: Tue, 17 Nov 1992 17:40
29 lines
1908 bytes
1908 bytes
dmagagno@mcs.drexel.edu (David Magagnosc) writes: >This reminds me of something I came up with not long after the >Midatlantic ACM Region Programming Contest last year. One of the >problems involved computing square roots by the long division-like >method (which they claimed we all learned in elementary school). >I translated it to binary, applied the techniques used for division, >and came up with a sort of non-restoring square root. >Now, the convergence is linear (2 bits of input for 1 bit of output >per iteration), but it uses only elementary operations like shifts >and adds, so its run time should be comparable to a single division. >Newton's method, on the other hand, typically uses division on >every iteration. >So, the real question is, has someone done something like this before? Yes, and it has ben discussed on the net earlier (I think in comp.theory or sci.math). >How does it really compare for smallish (under 32 or maybe even 64 >bit) square roots? Very well, depending of course of whether you have fast hardware division. If division is implemented using shifts, the square root is usually one-and-a-half times as slow as division. Torben Mogensen (torbenm@diku.dk)
Technical Details
Message-ID:
<1992Nov17.174049.19179@odin.diku.dk>Path:
arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!swrinde!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!dkuug!diku!torbenmReferences:
<55F0TB1w165w@tsoft.sf-bay.org> <CLIFFC.92Nov15184340@miranda.rice.edu> <MOSS.92Nov16094710@CRAFTY.cs.cmu.edu> <1992Nov17.143914.19700@mcs.drexel.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!swrinde!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!dkuug!diku!torbenm From: torbenm@diku.dk (Torben AEgidius Mogensen) Newsgroups: comp.arch Subject: Re: integer distance or sqrt Message-ID: <1992Nov17.174049.19179@odin.diku.dk> Date: 17 Nov 92 17:40:49 GMT References: <55F0TB1w165w@tsoft.sf-bay.org> <CLIFFC.92Nov15184340@miranda.rice.edu> <MOSS.92Nov16094710@CRAFTY.cs.cmu.edu> <1992Nov17.143914.19700@mcs.drexel.edu> Sender: torbenm@freke.diku.dk Organization: Department of Computer Science, U of Copenhagen Lines: 29