package main
import "fmt"
func main() {
printType(4.0)
}
func printType(i interface{}) {
switch i := i.(type) {
case float32:
fmt.Println("This is a float type", i)
}
}
For some reason this code does not detect 4.0
value as float32
but it detects it as float64
- why is that? I run it on win x64 machine.