Standard library / math/big

big.Float.SetPrec()

Sets binary precision in bits and rounds existing value if needed; returns receiver. Expected stdout: '100\n'.

Formal Syntax & Structure

go syntaxgo
func (z *Float) SetPrec(prec uint) *Float

Parameters & Attributes

NameTypeDescription
precuintPrecision in bits.

Return Value

*Float

Sets binary precision in bits and rounds existing value if needed; returns receiver.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  v := new(big.Float).SetPrec(100)  fmt.Println(v.Prec())}
Go Reference