summaryrefslogtreecommitdiff
path: root/bench/bigfactorial.myr
diff options
context:
space:
mode:
Diffstat (limited to 'bench/bigfactorial.myr')
-rw-r--r--bench/bigfactorial.myr29
1 files changed, 0 insertions, 29 deletions
diff --git a/bench/bigfactorial.myr b/bench/bigfactorial.myr
deleted file mode 100644
index a893867..0000000
--- a/bench/bigfactorial.myr
+++ /dev/null
@@ -1,29 +0,0 @@
-use std
-use testr
-
-const main = {
- testr.bench([
- [.name="bigfactorial-1", .fn={ctx; bigfact(1)}],
- [.name="bigfactorial-100", .fn={ctx; bigfact(100)}],
- [.name="bigfactorial-1000", .fn={ctx; bigfact(1000)}],
- [.name="bigfactorial-10000", .fn={ctx; bigfact(10000)}],
- [.name="bigfactorial-20000", .fn={ctx; bigfact(20000)}],
- ][:])
-}
-
-const bigfact = {n
- var i
- var x, y
-
- if n == 0
- x = std.mkbigint(1)
- else
- x = std.mkbigint(n)
- for i = n-1; i > 0; i--
- y = std.mkbigint(i)
- std.bigmul(x, y)
- std.bigfree(y)
- ;;
- ;;
- -> x
-}