Merge branch 'master' of https://github.com/jameswpm/build-web-application-with-golang
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
// 章节 1.2
|
||||
// $GOPATH/src/mathapp/main.go
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"mymath"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Printf("Hello, world. Sqrt(2) = %v\n", mymath.Sqrt(2))
|
||||
}
|
||||
// 章节 1.2
|
||||
// $GOPATH/src/mathapp/main.go
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"mymath"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Printf("Hello, world. Sqrt(2) = %v\n", mymath.Sqrt(2))
|
||||
}
|
||||
13
zh/src/1.2/main.go~eead24cf064976b648de5826eab51880c803b0fa
Normal file
13
zh/src/1.2/main.go~eead24cf064976b648de5826eab51880c803b0fa
Normal file
@@ -0,0 +1,13 @@
|
||||
// 章节 1.2
|
||||
// $GOPATH/src/mathapp/main.go
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"mymath"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Printf("Hello, world. Sqrt(2) = %v\n", mymath.Sqrt(2))
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
// 章节 1.2
|
||||
// $GOPATH/src/mymath/sqrt.go
|
||||
package mymath
|
||||
|
||||
func Sqrt(x float64) float64 {
|
||||
z := 0.0
|
||||
for i := 0; i < 1000; i++ {
|
||||
z -= (z*z - x) / (2 * x)
|
||||
}
|
||||
return z
|
||||
}
|
||||
// 章节 1.2
|
||||
// $GOPATH/src/mymath/sqrt.go
|
||||
package mymath
|
||||
|
||||
func Sqrt(x float64) float64 {
|
||||
z := 0.0
|
||||
for i := 0; i < 1000; i++ {
|
||||
z -= (z*z - x) / (2 * x)
|
||||
}
|
||||
return z
|
||||
}
|
||||
11
zh/src/1.2/sqrt.go~eead24cf064976b648de5826eab51880c803b0fa
Normal file
11
zh/src/1.2/sqrt.go~eead24cf064976b648de5826eab51880c803b0fa
Normal file
@@ -0,0 +1,11 @@
|
||||
// 章节 1.2
|
||||
// $GOPATH/src/mymath/sqrt.go
|
||||
package mymath
|
||||
|
||||
func Sqrt(x float64) float64 {
|
||||
z := 0.0
|
||||
for i := 0; i < 1000; i++ {
|
||||
z -= (z*z - x) / (2 * x)
|
||||
}
|
||||
return z
|
||||
}
|
||||
Reference in New Issue
Block a user