mirror of
https://github.com/golang/go
synced 2024-11-21 20:54:45 -07:00
doc: fix typo in Effective Go
Fixes #2120. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/4810061
This commit is contained in:
parent
9d7e39340d
commit
70f6133b84
@ -2730,7 +2730,7 @@ suppresses the usual check for a <code>return</code> statement.
|
|||||||
<pre>
|
<pre>
|
||||||
// A toy implementation of cube root using Newton's method.
|
// A toy implementation of cube root using Newton's method.
|
||||||
func CubeRoot(x float64) float64 {
|
func CubeRoot(x float64) float64 {
|
||||||
z := x/3 // Arbitrary intitial value
|
z := x/3 // Arbitrary initial value
|
||||||
for i := 0; i < 1e6; i++ {
|
for i := 0; i < 1e6; i++ {
|
||||||
prevz := z
|
prevz := z
|
||||||
z -= (z*z*z-x) / (3*z*z)
|
z -= (z*z*z-x) / (3*z*z)
|
||||||
|
Loading…
Reference in New Issue
Block a user