big: Switch choose over to internal implementations.

This commit is contained in:
Jeroen van Rijn
2021-08-11 20:59:53 +02:00
parent 9321616c80
commit 6298226238
3 changed files with 16 additions and 24 deletions
+7 -17
View File
@@ -65,26 +65,16 @@ demo :: proc() {
a, b, c, d, e, f := &Int{}, &Int{}, &Int{}, &Int{}, &Int{}, &Int{};
defer destroy(a, b, c, d, e, f);
N := 10_000;
n := 50_000;
k := 3;
FACTORIAL_10_000_FIRST_100 :: "46AB3AE48966202D0FDE097BFA88FADC512AE8AFC0EA1D1D376A4109F10105E9E21F1E907151E85F926B8D82737B9030D572";
for _ in 0..10
{
SCOPED_TIMING(.factorial);
factorial(a, N);
}
as, _ := itoa(a, 16);
defer delete(as);
fmt.printf("factorial(%v): %v (first 50 hex digits)\n", N, as[:50]);
if as[:100] == FACTORIAL_10_000_FIRST_100 {
fmt.println("\nCorrect!");
} else {
fmt.printf("\nWrong. Expected: %v\n", FACTORIAL_10_000_FIRST_100);
SCOPED_TIMING(.choose);
choose(a, n, k);
}
fmt.printf("%v choose %v ", n, k);
print("= ", a);
}
main :: proc() {