Standard library / math/big

big.ToNearestEven

Rounds to nearest representable value; ties choose even significand. Expected stdout: '4\n'.

Formal Syntax & Structure

go syntaxgo
const ToNearestEven RoundingMode = 0

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  fmt.Println(new(big.Float).SetPrec(2).SetMode(big.ToNearestEven).SetInt64(5))}
Go Reference