Quick actions

cmd+k|ctrl+k

Navigation

Languages

Golang Big Int

Snippet info

Language

Go

Visibility

public

Author

ubaidillah.hf

Created

2024-04-04T05:00:41.524544Z

Updated

2024-04-04T05:00:51.020654Z

package main

import (
    "fmt"
    // "strconv"
    "math/big"
)

func main() {
    largeNumber := "21888242000111122232188824200011112223"
    largeNumber2 := "00000000000000000000000000000000000007"
    // asInt64,_ := strconv.ParseInt(largeNumber, 10, 64)
    // asFloat,_ := strconv.ParseFloat(largeNumber, 64)
    // newBigInt := big.newInt(largeNumber)
    var bignum, _ = new(big.Int).SetString(largeNumber, 0)
    var bignum2, _ = new(big.Int).SetString(largeNumber2, 0)
    sum := new(big.Int).Add(bignum2, bignum)
    fmt.Printf("%v", sum)
}
INFO