Standard library / math/big

big.Int.IsUint64()

Test whether the value fits in an unsigned 64-bit integer; negative values do not fit. Expected stdout: 'false true\n'.

Formal Syntax & Structure

go syntaxgo
func (x *Int) IsUint64() bool

Return Value

bool

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

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  fmt.Println(big.NewInt(-1).IsUint64(), big.NewInt(42).IsUint64())}
Go Reference