package utility
import (
"math"
"strconv"
)
func FormatFloat(f float64, scale int) float64 {
result, _ := strconv.ParseFloat(strconv.FormatFloat(f, 'f', scale+1, 64), 64)
pow := math.Pow(10, float64(scale))
return math.Round(result*pow) / pow
}
网友评论