Commit 605da0e2 authored by Katrina Owen's avatar Katrina Owen Committed by Andrew Gerrand

doc: Fix typo in approximation of square root

See https://en.wikipedia.org/wiki/Newton%27s_method#Square_root_of_a_number

R=golang-dev, minux.ma, adg
CC=golang-dev
https://golang.org/cl/9145044
parent 28c64e30
......@@ -295,9 +295,9 @@ package newmath
// Sqrt returns an approximation to the square root of x.
func Sqrt(x float64) float64 {
z := 0.0
z := 1.0
for i := 0; i < 1000; i++ {
z -= (z*z - x) / (2 * x)
z -= (z*z - x) / (2 * z)
}
return z
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment