analytics

Sunday, February 8, 2015

Easy seed value for square root algorithms

For even number of digits of the number to find the square root of:
3672
average the number you get when you slide the decimal point halfway across and the power of 10 you moved the decimal point by:
(36.72 + 100)/2 = 68.36, this will always be a bit larger than the actual square root, in this case  60.59

For odd number of digits first multiply by 10...
36725 x 10 = 367250
Then proceed as before
(367.250 + 1000)/2 = 683.625 and then divide by sqr(10) = 216, the actual is 191
It works even better in binary...
36725=
1000111101110101
10001111
 2^7= 1000000
(128 + 241)/2 = 181 when the actual is 191...

So this is a good way to find the initial seed value to continue with a precise method that needs a good guess like the Babylonian method to work it's best...

No comments:

Post a Comment