From 605da0e2a23fbaadca9bd056a3cf04ecac507add Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Wed, 29 May 2013 13:49:51 +1000 Subject: [PATCH] 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 --- doc/code.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/code.html b/doc/code.html index f64dd6a2ad..2bf50601e4 100644 --- a/doc/code.html +++ b/doc/code.html @@ -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 }