예제 #1
0
func TestBinomial(t *testing.T) {
	var b big.Int
	for _, tc := range tcs {
		if a := binomial.Binomial(&b, tc.n, tc.k).String(); a != tc.s {
			t.Error("Binomial(%d, %d) expected %s, got %s", tc.n, tc.k, tc.s, a)
		}
	}
}
예제 #2
0
func BenchmarkBinomial2e6(b *testing.B) {
	var c big.Int
	for i := 0; i < b.N; i++ {
		binomial.Binomial(&c, 2e6, uint(2e6)/3)
	}
}
예제 #3
0
func BenchmarkBinomial1e5(b *testing.B) {
	var c big.Int
	for i := 0; i < b.N; i++ {
		binomial.Binomial(&c, 1e5, uint(1e5)/3)
	}
}