package main import ( "fmt" "math/big" ) func main() { // Create two big.Int values a := big.NewInt(123456789) b := big.NewInt(987654321) // Add the values together c := big.NewInt(0) c.Add(a, b) // Print the sum fmt.Println("Sum: ", c) }
package main import ( "fmt" "math/big" ) func main() { // Create two big.Int values a := big.NewInt(999999999999) b := big.NewInt(999999999999) // Add the values together c := big.NewInt(0) c.Add(a, b) // Print the sum fmt.Println("Sum: ", c) }In this example, we again create two big.Int values using the NewInt function. However, this time we're using values that are closer to the maximum size that can be stored in a 64-bit int data type. This demonstrates the power of the big package, which allows us to perform operations on numbers of any size (subject to available memory, of course). Overall, the big package is part of the Go standard library and provides a convenient way to work with big integers for mathematical operations in Go.