Cannot convert int to float . I tried in the following way:
float(integer_value) But this method does not work. What is the problem?
Cannot convert int to float . I tried in the following way:
float(integer_value) But this method does not work. What is the problem?
Use float64 or float32 .
package main import "fmt" func main() { i := 5 f := float64(i) fmt.Printf("f = %f\n", f) } float32 one decimal place precision.
Source: https://ru.stackoverflow.com/questions/886191/
All Articles
floatnot in go. There are onlyfloat32andfloat64. - Ainar-G