Standard library / math/big

big.NewInt()

Creates a mutable arbitrary-precision signed integer initialized from int64. Expected stdout: '-42\n'.

Formal Syntax & Structure

go syntaxgo
func NewInt(x int64) *Int

Parameters & Attributes

NameTypeDescription
xint64First input operand (or sole input if unary).

Return Value

*Int

Creates a mutable arbitrary-precision signed integer initialized from int64.

Working Example

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