2 ms·
It's not the best algorithm for computing factorials though. A better strategy is to pair small and large factors together in order to avoid bignum computations
by soegaard 2y ago
It's not the best algorithm for computing factorials though.
A better strategy is to pair small and large factors together
in order to avoid bignum computations (or to reduce the size og bignum computations).
https://people.eecs.berkeley.edu/~fateman/papers/factorial.pdf https://people.eecs.berkeley.edu/~fateman/papers/factorial.p...
Also: It's more fun to use the name `fact` in benchmarks...
- MaxBarraclough 2y agoThe rabbit-hole goes much deeper than that. https://en.wikipedia.org/wiki/Factorial#Computation https://en.wikipedia.org/wiki/Factorial#Computation