Non-restoring binary square root and convergence
From: Clint Olsen (clint_at_0lsen.net)
Date: 02/22/05
- Next message: W. Mueckenheim: "Re: abundance of irrationals!)"
- Previous message: Nora Baron: "Re: From sign conventions to Galois Theory"
- Next in thread: Oscar Lanzi III: "Re: Non-restoring binary square root and convergence"
- Reply: Oscar Lanzi III: "Re: Non-restoring binary square root and convergence"
- Reply: C. Bond: "Re: Non-restoring binary square root and convergence"
- Reply: Peter Nilsson: "Re: Non-restoring binary square root and convergence"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 22 Feb 2005 15:45:07 -0600
Hi:
I was interested in this algorithm because it generates the solution, one
bit at a time, and I could potentially use this for generating
pseudo-random bit patterns for some software I'm writing.
For giggles I was playing around with the binary square-rooting algorithm.
I read a paper or two which talked about it, and implemented my best guess
at it. Unfortunately the documentation on some of these algorithms leaves
a bit to be desired. Some handle the determination of the next root bit by
signed arithmetic, and others rely on some flimsy notion of 'overflow'.
For correctness, I tried a few examples where there is an exact square
root. Heck, if it can't find that, what's the point? :)
I noticed that while my implementation of the algorithm does generate the
correct bits, I don't get a clear sense of convergence when an exact
solution is found. In other words, I don't get a clear-cut case when the
remainder goes to zero on the correct iteration.
For example, when I'm trying to find the square root of 36, I get an
iteration where the derived root is 3, and the remainder is zero. On the
next iteration, I get a derived root of 6 (which is correct), but I'm left
with a remainder of -13. The algorithm will continue to correctly
calculate zeroes for any bits thereafter and the remainder continutes to
increase (negatively) in magnitude. Interestingly, on odd inputs the
correct result and the remainder is 0 in the same iteration.
I was curious if this method is designed to operate for a fixed number of
iterations and then terminate or is there an iteration when you *know*
you've converged on a result? The algorithms I've read all either conform
to the former or the exit strategy is undocumented.
Thanks,
-Clint
- Next message: W. Mueckenheim: "Re: abundance of irrationals!)"
- Previous message: Nora Baron: "Re: From sign conventions to Galois Theory"
- Next in thread: Oscar Lanzi III: "Re: Non-restoring binary square root and convergence"
- Reply: Oscar Lanzi III: "Re: Non-restoring binary square root and convergence"
- Reply: C. Bond: "Re: Non-restoring binary square root and convergence"
- Reply: Peter Nilsson: "Re: Non-restoring binary square root and convergence"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|