RoundToEven returns the nearest integer, rounding ties to even.
package main import ( "fmt" "math" ) func main() { u := math.RoundToEven(11.5) fmt.Printf("%.1f\n", u) d := math.RoundToEven(12.5) fmt.Printf("%.1f\n", d) }