Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Binary Square Root 2

Status
Not open for further replies.

buzzp

Electrical
Nov 21, 2001
2,032
I am looking for a detailed explanation of finding the square root of a binary number (16 bit). I have seen it done using decimal numbers (Newtonian method) and some other methods. I would like to implement this in assembly language using rotate commands and an 8bit software multiply. Can anyone help (I know this is from high school - at least the decimal long hand square root is)?
 
Replies continue below

Recommended for you

The simplest iterative process I know:

input number
sq = guess

loop:
guess = (number/guess+guess)/2
loop until changes
sqr=guess


<nbucska@pcperipherals DOT com> subj: eng-tips
 
sorry, delete 2nd line

<nbucska@pcperipherals DOT com> subj: eng-tips
 
Thanks for the reply. I knew about that one but thought someone may have come up with a quicker method.
 
perhaps trial & and error would be faster if you only need
integer solution.


<nbucska@pcperipherals DOT com> subj: eng-tips
 
To make it funner, I will be finding the sqroot of a 32 bit number now instead of 16. Guess its time to write some code and do some experiments. Thanks again.

 

you might try quaternion operators popularized by Jack B. Kuipers. often used in games to speed up the graphics whether 8, 32, or 64 bit
 
Thanks Melone. That is helpful as well.
 
have you tried compiling a small program that does a sqrt() and looking at what the assembler comes up with?
 
I am programming in assembly. I have not decided on which method to use. Still digesting options.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor