aboutsummaryrefslogtreecommitdiff
path: root/core/math/big/common.odin
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2021-08-02 17:47:07 +0200
committerJeroen van Rijn <Kelimion@users.noreply.github.com>2021-08-11 20:59:52 +0200
commit491e4ecc740a361bd726f8caf92f8eed078ed333 (patch)
tree216f38088769fa48759ebe0561c777192f1b95d3 /core/math/big/common.odin
parentcd0ce7b76e800ac308d6df02ddad4da221fbb90a (diff)
big: Add binary split factorial.
Diffstat (limited to 'core/math/big/common.odin')
-rw-r--r--core/math/big/common.odin12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/math/big/common.odin b/core/math/big/common.odin
index 5bdc0139f..bcda658b0 100644
--- a/core/math/big/common.odin
+++ b/core/math/big/common.odin
@@ -26,7 +26,6 @@ when _LOW_MEMORY {
_DEFAULT_DIGIT_COUNT :: 32;
}
-
_MUL_KARATSUBA_CUTOFF :: #config(MUL_KARATSUBA_CUTOFF, _DEFAULT_MUL_KARATSUBA_CUTOFF);
_SQR_KARATSUBA_CUTOFF :: #config(SQR_KARATSUBA_CUTOFF, _DEFAULT_SQR_KARATSUBA_CUTOFF);
_MUL_TOOM_CUTOFF :: #config(MUL_TOOM_CUTOFF, _DEFAULT_MUL_TOOM_CUTOFF);
@@ -43,6 +42,17 @@ _DEFAULT_SQR_TOOM_CUTOFF :: 400;
_MAX_ITERATIONS_ROOT_N :: 500;
+/*
+ Largest `N` for which we'll compute `N!`
+*/
+_FACTORIAL_MAX_N :: 100_000;
+
+/*
+ Cutoff to switch to int_factorial_binary_split, and its max recursion level.
+*/
+_FACTORIAL_BINARY_SPLIT_CUTOFF :: 6100;
+_FACTORIAL_BINARY_SPLIT_MAX_RECURSIONS :: 100;
+
Sign :: enum u8 {
Zero_or_Positive = 0,
Negative = 1,