home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.math
- Path: sparky!uunet!paladin.american.edu!europa.asd.contel.com!darwin.sura.net!Sirius.dfn.de!Urmel.Informatik.RWTH-Aachen.DE!messua!dak
- From: dak@messua.informatik.rwth-aachen.de (David Kastrup)
- Subject: Re: Square root of a number
- Message-ID: <dak.722023338@messua>
- Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
- Nntp-Posting-Host: messua
- Organization: Rechnerbetrieb Informatik / RWTH Aachen
- References: <1992Nov15.194049.1@woods.ulowell.edu>
- Date: 17 Nov 92 18:02:18 GMT
- Lines: 26
-
- buxamusaa@woods.ulowell.edu writes:
-
-
- >Please could someone help me with an assignment that I have to do.
- >It is a very general question, though the answer could be quite lengthy.
- >"Discuss methods for finding the square root of a number."
-
- >What I am looking for are all possible methods/alogrithms for this.
-
- >Please respond to either directly to me (preferably) or via the net.
-
- One nice possibility is the bitwise algorithm similar to binary
- division.
-
- Suppose that your result will be in some register called result, your
- modulus (root^2 + modulus = argument, root = floor(sqrt(argument)) )
- is in a register called modulus, and your argument is in a register called
- spill.
-
- One iteration consists of shifting two (MSB) bits from spill into
- modulus (LSB) (of course this is a left shift), and then trying to subtract
- 4 times result+1 from modulus. If you can, you do it and shift a one into
- results LSB position, if you can't, you don't, and shift a 0.
-
- Repeat until spill is used up. result with then have half as many bits
- as the argument had.
-