Python Forum
Finding square roots using long division.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Finding square roots using long division.
#11
(Yesterday, 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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Division problem Eric7Giants 1 470 Nov-16-2019, 05:50 AM
Last Post: ndc85430
  Count how many carpets you need to fill room floor without multiplication/division Ech0ke 1 757 Apr-20-2019, 07:50 PM
Last Post: ichabod801
  Zero Division Error moga2003 4 1,027 Mar-07-2019, 02:15 AM
Last Post: moga2003
  Magic square! frequency 1 958 Dec-17-2018, 06:35 PM
Last Post: micseydel
  Square reverse sum(overloaded) shihomiyano 6 1,519 Aug-18-2018, 06:27 AM
Last Post: micseydel
  Perfect Square program forumer444 4 5,704 Sep-01-2017, 09:32 PM
Last Post: forumer444
  Magic Square Puzzle Harnick 1 2,736 Aug-09-2017, 04:51 PM
Last Post: nilamo
  Square Root on calculator MP1234593 1 4,341 Jun-06-2017, 06:58 PM
Last Post: nilamo
  List of square roots python py7 6 3,367 Apr-08-2017, 11:26 PM
Last Post: ichabod801
  Square root of a number mbestivert 1 2,191 Nov-24-2016, 04:35 PM
Last Post: casevh

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020