Standard library / math/big

big.Int.IsInt64()

Test representability as a signed 64-bit integer before conversion. Expected stdout: 'true false\n'.

Formal Syntax & Structure

go syntaxgo
func (x *Int) IsInt64() 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(-42).IsInt64(), new(big.Int).Lsh(big.NewInt(1), 63).IsInt64())}
Go Reference