Python Forum

Full Version: Finding square roots using long division.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(Feb-24-2021, 12:09 PM)Serafim Wrote: [ -> ]Sorry, I am off to my next project. Try implementing it yourself. It is not that big an effort. Use my hint in previous message and the round() function. That would do the trick.

By the way, I found the code that you have copied "your" implementation from. Seems like you have taken someone elses code and want us to explain why it doesn't work the way you want it to work. I think I explained why. My implementation is based on the fact that squareroot(100*x) = 10 * squareroot(x).

I feel very confused about the part, and in fact have tried to understand it many times on SO. In fact, confuse it with 'guard digits' (given at: https://en.m.wikipedia.org/wiki/Guard_digit, with link provided at bottom of answer at:
https://stackoverflow.com/a/28679423/3693431 ). Am really unclear.

Yes, but it wasn't verbatim copying. Spent efforts on modification by removing 'waste' iterations by introducing 'break' in two places, as well as modifying the redundant logic in the 'if' clause. Among smaller changes was also passing length as an argument.
Pages: 1 2