Skip to content

Instantly share code, notes, and snippets.

@michiel
Created May 31, 2013 04:11
Show Gist options
  • Save michiel/5682903 to your computer and use it in GitHub Desktop.
Save michiel/5682903 to your computer and use it in GitHub Desktop.
Newton's sqrt approximation method in Go
func sqrt(x float64) (y float64) {
y = 1
for i := 0; i < 10; i++ {
y = y - ((y*y - x) / (2*y))
}
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment