Better explained, it shifts all the bits two *places* at a time, not two bits. Em 5/12/2011 13:36, Isaac Marino Bavaresco escreveu: > There is also an algorithm that uses only right-shifts and subtractions, > I think it is much faster because the maximum number of rounds grows > linearly with the number of bits in the value. > > Interestingly, if I remember it right, it always shifts two bits at a > time (divides by four). > > > Isaac > > Em 5/12/2011 13:17, Tamas Rudnai escreveu: >> I think there was a table optimization for this as well, so that you had= a >> table with a number of roots and its squares, you pick up the highest on= e >> so you start the subtraction from there. So for example you want to know >> the square of 70000, which would be 264, therefore 264 loops in the >> original algorithm. But then you pick the number 65536 which has the roo= t >> of 256, so you start with your calculus from there saving 256 steps. The >> finest resolution your table is the more steps you can save in average, >> however, there is a lag for the table lookup too. >> >> Tamas >> >> >> >> >> On 5 December 2011 14:56, dipten wrote: >> >>> This is because >>> *1+3+5+7+... +n th odd integer =3D n square.* >>> This can be proved by simple arithmetic series sum formula. >>> Deep. >>> >>> >>> On Mon, Dec 5, 2011 at 7:48 PM, Electron wrot= e: >>> >>>> Hello, >>>> >>>> analogously to [division] computing the quotient by counting how many >>>> times you >>>> can subtract the divisor, you can compute the square root of a number >>>> counting >>>> how many times you can subtract sequential odd numbers (1,3,5,7,9,=85)= .. >>>> >>>> [ try it -- it works!]. e.g. 25 -1-3-5-7-9 =3D 0 >>>> >>>> OK, but can someone explain me *why* it works? :-) >>>> >>>> Thanks, >>>> Mario >>>> >>>> -- >>>> http://www.piclist.com PIC/SX FAQ & list archive >>>> View/change your membership options at >>>> http://mailman.mit.edu/mailman/listinfo/piclist >>>> >>> >>> -- >>> >>> "The purpose of life is not to be happy. It is to be useful, to be >>> honourable, to be compassionate, to have it make some difference that y= ou >>> have lived and lived well." --- *Ralph Waldo Emerson* >>> -- >>> http://www.piclist.com PIC/SX FAQ & list archive >>> View/change your membership options at >>> http://mailman.mit.edu/mailman/listinfo/piclist >>> >> --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .