Category talk:Wren-big: Difference between revisions

→‎Source code: Added BigInt.factorial method.
(→‎Source code: Added iroot and icbrt methods to BigInt class.)
(→‎Source code: Added BigInt.factorial method.)
Line 676:
if (!(b is BigInt)) b = BigInt.new(b)
return a / gcd(a, b) * b
}
 
// Returns the factorial of 'n'.
static factorial(n) {
if (!(n is Num && n >= 0)) Fiber.abort("Argument must be a non-negative integer")
if (n < 2) return BigInt.one
var fact = BigInt.one
for (i in 2..n) fact = fact * i
return fact
}
 
9,476

edits