Standard library / math/big

big.Float.SetInt()

Convert an arbitrary-precision integer, subject to destination precision. Zero precision adopts at least 64 bits and the integer bit length. This method writes to the receiver (use a separate destination to preserve inputs when needed). Expected stdout: '9007199254740993 Exact\n'.

Formal Syntax & Structure

go syntaxgo
func (z *Float) SetInt(x *Int) *Float

Parameters & Attributes

NameTypeDescription
x*IntNumeric operand supplied to this method.

Return Value

*Float

Returns the result described above; see the example for the observed behavior.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  z := new(big.Float).SetInt(big.NewInt(9007199254740993))  fmt.Println(z.Text('f', 0), z.Acc())}
Go Reference