×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Binary Square Root
2

Binary Square Root

Binary Square Root

(OP)
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)?

RE: Binary Square Root

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

RE: Binary Square Root

sorry, delete 2nd line

<nbucska@pcperipherals DOT com> subj: eng-tips

RE: Binary Square Root

(OP)
Thanks for the reply. I knew about that one but thought someone may have come up with a quicker method.

RE: Binary Square Root

perhaps trial & and error would be faster if you only need
integer solution.

<nbucska@pcperipherals DOT com> subj: eng-tips

RE: Binary Square Root

(OP)
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.  

RE: Binary Square Root


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

RE: Binary Square Root

(OP)
Thanks Melone. That is helpful as well.

RE: Binary Square Root

have you tried compiling a small program that does a sqrt() and looking at what the assembler comes up with?

RE: Binary Square Root

(OP)
I am programming in assembly. I have not decided on which method to use. Still digesting options.

RE: Binary Square Root

u want it in assembler, I Google-searched
"successive approximation root assembler" and found

http://www.finesse.demon.co.uk/steven/sqrt.html

which even had the code for several different ASM routines, varying in method and runtime.

Howard

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources