David T. Ashley wrote:
> ...
> The algorithm that comes to mind is just to do a binary search by squaring
> potential solutions and comparing them to the quantity whose square root is
> to be extracted.
>
> For example, if the sum of the squares is 16 bits or less, and since the
> processor has a 8 x 8 = 16 MUL instruction, it should be possible to iterate
> to the solution in no more than 16 square/compare cycles.
>
Actually you can do this in 8 multiplies. This is how I usually
implement
square root - I have probably reinvented it some 15+ years ago for
myself.
You just start with $80, square and compare to the number you want
the root of, and do successive approximation down to bit 0 (i.e.
second time
with $40+result so far, then $20 etc.).
Dimiter
------------------------------------------------------
Dimiter Popoff Transgalactic Instruments
http://www.tgi-sci.com
------------------------------------------------------
http://www.flickr.com/photos/didi_tg...7600228621276/
Original message:
http://groups.google.com/group/comp....6?dmode=source