home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / sci / math / 15129 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.5 KB  |  39 lines

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