Skip to content

Commit

Permalink
added mymath/sqrt.go
Browse files Browse the repository at this point in the history
  • Loading branch information
neydroid committed Dec 27, 2014
1 parent 48cc2f6 commit 1436ef6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions es/code/src/mymath/sqrt.go
@@ -0,0 +1,12 @@
// Código de ejmplo para el capítulo 1.2 de "Construye Aplicaciones Web con Golang"
// Propósito: Muestra como crear un paquete simple llamado `mymath`
// Este paquete debe ser importado desde otro archivo Go para poder ejecutarse.
package mymath

func Sqrt(x float64) float64 {
z := 0.0
for i := 0; i < 1000; i++ {
z -= (z*z - x) / (2 * x)
}
return z
}

0 comments on commit 1436ef6

Please sign in to comment.