Standard library / math/big
big.ToNearestAway
Rounds to nearest representable value; ties away from zero. Expected stdout: '6\n'.
Formal Syntax & Structure
go syntaxgo
const ToNearestAway RoundingMode = 1Working Example
Example Snippetgo
package main
import ( "fmt" "math/big")
func main() { fmt.Println(new(big.Float).SetPrec(2).SetMode(big.ToNearestAway).SetInt64(5))}