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
package main | |
import "code.google.com/p/go-tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
slicePic := make([][]uint8, dy) | |
for y := range slicePic { | |
slicePic[y] = make([]uint8, dx) | |
for x := range slicePic[y] { | |
slicePic[y][x] = uint8(x ^ y) |
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
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
// square root function using Newton's method | |
func Sqrt(x float64) float64 { | |
z := 1.0 |
NewerOlder