Go convert float to a string code example
Example 1: Go convert float to a string
s := fmt.Sprintf("%f", 123.456) // s == "123.456000"
Example 2: Go convert float to a string
// ...
v := 3.1415926535
s32 := strconv.FormatFloat(v, 'E', -1, 32)
fmt.Printf("%T, %v\n", s32, s32)
s64 := strconv.FormatFloat(v, 'E', -1, 64)
fmt.Printf("%T, %v\n", s64, s64)
// ...