package main
import (
"fmt"
"strconv"
)
func main() {
value := 123.456789
// Format with 2 decimal places
formattedValue := strconv.FormatFloat(value, 'f', 2, 64)
fmt.Println(formattedValue)
// Format with 4 decimal places
formattedValue = strconv.FormatFloat(value, 'f', 4, 64)
fmt.Println(formattedValue)
}
/*
run:
123.46
123.4568
*/