Golang 溢出 int64

标签 go biginteger int64

我尝试使用此代码,但出现错误:常量 100000000000000000000000 溢出 int64

我该如何解决?

// Initialise big numbers with small numbers
count, one := big.NewInt(100000000000000000000000), big.NewInt(1)

最佳答案

例如:

count,one := new(big.Int), big.NewInt(1)
count.SetString("100000000000000000000000",10)

链接: http://play.golang.org/p/eEXooVOs9Z

关于Golang 溢出 int64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30833314/

相关文章:

unit-testing - 测试我的代码不等待的 Goroutine

c++ - 大整数乘法

java - 在 RDBMS 中存储 java.math.BigInteger

c - _int64 位域

go - 我可以假设 unix 时间戳将随着 go 增加吗?

gob:类型未注册接口(interface):map[string]interface {}

go - 在 sync.Map 中是否有必要使用 Load 后跟 LoadOrStore 来获取复杂值

java - 具有十六进制输入的 BigInteger NumberFormatException

.net - 将两个 Int32 组合成一个 Int64

javascript - 从 node.js 缓冲区中读取精度损失的 int64