Esempio n. 1
0
func TestBinomialS(t *testing.T) {
	p := sieve.New(uint64(tcs[len(tcs)-1].n))
	var b big.Int
	for _, tc := range tcs {
		if a := binomial.BinomialS(&b, p, tc.n, tc.k).String(); a != tc.s {
			t.Error("Binomial(%d, %d) expected %s, got %s", tc.n, tc.k, tc.s, a)
		}
	}
}
Esempio n. 2
0
func BenchmarkBinomialS1e2(b *testing.B) {
	var c big.Int
	for i := 0; i < b.N; i++ {
		binomial.BinomialS(&c, p, 1e2, uint(1e2)/3)
	}
}
Esempio n. 3
0
func BenchmarkBinomialS2e6(b *testing.B) {
	var c big.Int
	for i := 0; i < b.N; i++ {
		binomial.BinomialS(&c, p, 2e6, uint(2e6)/3)
	}
}