Stanley Iriele
unread,Feb 9, 2012, 5:53:50 PM2/9/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts, DeeDar...@gmail.com
Hello, I am writing a little test class to understand the math
packages a little more. I created a slice literal of float64 and when
i range over it i get :
main.go:14: cannot use value (type int) as type float64 in function
argument
here is the code. there's nothing complicated going on here but can
someone explain to me how the compiler is coming up with this or if I
am doing something wrong?
{Code}package main
import (
"math"
"fmt"
)
func main (){
fmt.Println("Yooo")
var values = []float64{0.0, 45.0, 60.0, 90.0, 120.0, 180.0,
270.0,330.0}
for value := range values {
sin, cos := math.Sincos(value)
fmt.Println("sin: ",sin, " cos: ", cos)
}
}{Code}