??? 01/09/08 11:04 Read: times |
#149167 - Integer square root algorithm performance |
I've been assessing the performance of the iterative square root algorithm where:
xn+1 = (xn + INPUT / xn) / 2 The other key part of the algorithm is the choice of the initial x0 value, and I looked at searching for the most significant bit set in the INPUT, p and using an initial value which is 2 raised to half of p. e.g. INPUT = 2048, p = 11, half p = 5, x0 = 32 INPUT = 5000, p = 12, half p = 6, x0 = 64 I looked at how many iterations it took before x and INPUT / x differed by only one bit for a range of 32 bit inputs (i.e. values up to 4294967295). The answer was usually 3, and never more than 4! If anyone is interested I'll upload the code once it's tested. I think it will be interesting to compare the speed with the floating point library versions. |
Topic | Author | Date |
Integer square root algorithm performance | 01/01/70 00:00 | |
How many cycles per iteration ? | 01/01/70 00:00 | |
The edge of chaos | 01/01/70 00:00 | |
Yes, but he can simulate the performance... | 01/01/70 00:00 | |
Convergence | 01/01/70 00:00 | |
Why not ? | 01/01/70 00:00 | |
Sample testing | 01/01/70 00:00 | |
some links | 01/01/70 00:00 |