以下是 struct 定义:

// A Word represents a single digit of a multi-precision unsigned integer.
type Word uintptr

type nat []Word

type Int struct {
    neg bool // sign
    abs nat  // absolute value of the integer
}

type Rat struct {
    // To make zero values for Rat work w/o initialization,
    // a zero value of b (len(b) == 0) acts like b == 1.
    // a.neg determines the sign of the Rat, b.neg is ignored.
    a, b Int
}

没有明确的限制.限制将是您的内存或理论上的最大数组大小(2^31或2^63,具体取决于您的平台).


如果您有实际的顾虑,您可能会对在http://golang.org/src/pkg/math/big/nat_test.go中进行的测试感兴趣,例如,10^http://golang.org/src/pkg/math/big/nat_test.go000是基准测试.

你可以很容易地运行这种程序:

package main

import (
    "fmt"
    "math/big"
)

func main() {
    verybig := big.NewInt(1)
    ten := big.NewInt(10)
    for i:=0; i<100000; i++ {
       verybig.Mul(verybig, ten)
    }
    fmt.Println(verybig)
}
100000

问题不在于最大大小,而在于使用的内存和此类计算所需的时间.