Skip to content

Instantly share code, notes, and snippets.

@karlbeecken
Created August 17, 2019 14:11
Show Gist options
  • Save karlbeecken/341b9b4cfbb4b008be24a0712bd3c215 to your computer and use it in GitHub Desktop.
Save karlbeecken/341b9b4cfbb4b008be24a0712bd3c215 to your computer and use it in GitHub Desktop.
function heron_sqrt(num) {
let a = num / 3
let b = num / a
let i = 0
while (i < 20) {
a = (a + b) / 2
b = num / a
i++
}
return a
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment