Standard library / math/big

big.ToZero

Rounds toward zero. Expected stdout: '-4\n'.

Formal Syntax & Structure

go syntaxgo
const ToZero RoundingMode = 2

Working Example

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