Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |