tech:notes_-_algorithme
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:notes_-_algorithme [2025/03/24 15:06] – créée - modification externe 127.0.0.1 | tech:notes_-_algorithme [2026/05/30 21:23] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes - Algorithme | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | ## Go lang - newton - racine carré | ||
| + | |||
| + | ~~~go | ||
| + | package main | ||
| + | |||
| + | // Source : https:// | ||
| + | |||
| + | import ( | ||
| + | " | ||
| + | ) | ||
| + | |||
| + | func Sqrt(x float64) float64 { | ||
| + | z := 1.0 | ||
| + | for range 10 { | ||
| + | z -= (z*z - x) / (2 * z) | ||
| + | } | ||
| + | return z | ||
| + | } | ||
| + | |||
| + | func main() { | ||
| + | fmt.Println(Sqrt(2)) | ||
| + | } | ||
| + | ~~~ | ||
