Skip to content

Instantly share code, notes, and snippets.

@smirnoffs
Created November 29, 2017 19:29
Show Gist options
  • Save smirnoffs/6afc2dc31988c4935b139a6d0fea81a9 to your computer and use it in GitHub Desktop.
Save smirnoffs/6afc2dc31988c4935b139a6d0fea81a9 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := 1.0
for i:=0; i<int(x); i++{
z = z - (math.Pow(z, 2) - x) / (2 * z)
}
return z
}
func main() {
fmt.Println(Sqrt(1))
}
@iamjenechka
Copy link

iamjenechka commented Feb 22, 2022

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment