What is the most elegant way to return float64 after rounding 2 decimal places in the go language float 64?

what is the most elegant way to return float64 after rounding 2 decimal places in the go language float64?

May.07,2022

math.Round(a*100)/100

elegant or not elegant I don't know, the code should be correct


approximate value

// var n float64
n2, err := strconv.ParseFloat(fmt.Sprintf("%.2f", n), 64)
Menu