package utils import ( "math" "strconv" "github.com/spf13/cast" ) func FormatFloat(f float64, dig int) float64 { result := cast.ToFloat64(strconv.FormatFloat(f, 'f', dig+1, 64)) pow := math.Pow(1, float64(dig)) return math.Round(result*pow) / pow }