mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
big: Switch choose over to internal implementations.
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user