Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
boring("boring!")
@vasusen
vasusen / golang_tour_exercises.go
Last active September 27, 2015 06:27
My solutions for the golang tour exercises - https://tour.golang.org
/* Exercise: Loops and Functions
As a simple way to play with functions and loops, implement the square root function using Newton's method.
In this case, Newton's method is to approximate Sqrt(x) by picking a starting point z and then repeating:
z_dash = z - ((z*z - x) / 2 * z)
To begin with, just repeat that calculation 10 times and see how close you get to the answer for various values (1, 2, 3, ...).

Keybase proof

I hereby claim:

  • I am vasusen on github.
  • I am vasusen (https://keybase.io/vasusen) on keybase.
  • I have a public key whose fingerprint is B645 F95D BAFE 50E5 18FB 0DBB D2CD F41B 7080 52FB

To claim this, I am signing this object: