Skip to content

Instantly share code, notes, and snippets.

@sahid
Created February 17, 2013 18:34
Show Gist options
  • Select an option

  • Save sahid/4972687 to your computer and use it in GitHub Desktop.

Select an option

Save sahid/4972687 to your computer and use it in GitHub Desktop.
Square Root in Python by Heron/Newton
def sqrt(A):
x = A # the floor
while x**2 - A > 0.0001: # Approch the value by a precision
x = (x + A/x) / 2
return x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment