golang convert integer to float number

There is no float type. Looks like you want float64. You could also use float32 if you only need a single-precision floating point value.

package main

import "fmt"

func main() {
    i := 5
    f := float64(i)
    fmt.Printf("f is %f
", f)
}
原文地址:https://www.cnblogs.com/oxspirt/p/7059515.html