Standard library / math/big
big.Int.Uint64()
Convert to uint64 only if representable; check IsUint64 first because out-of-range results are undefined. Expected stdout: '42\n'.
Formal Syntax & Structure
go syntaxgo
func (x *Int) Uint64() uint64Return Value
uint64
Returns the result described above; see the example for the observed behavior.
Working Example
Example Snippetgo
package main
import ( "fmt" "math/big")
func main() { x := big.NewInt(42) if x.IsUint64() { fmt.Println(x.Uint64()) }}