Created
August 17, 2019 14:11
-
-
Save karlbeecken/341b9b4cfbb4b008be24a0712bd3c215 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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