4 ms·
While attempting to verify this, I was surprised to learn that bc has no built-in factorial function, even in the mathlib.
by LeoPanthera 7y ago
While attempting to verify this, I was surprised to learn that bc has no built-in factorial function, even in the mathlib.
- therein 7y agoWhile looking into this, TIL bc is very scriptable: $ bc define fact_rec (n) { if (n < 0) { print "oops"; halt; } if (n < 2) return 1; return n*fact_rec(n-1); } fact_rec(5) 120