Skip to main content

factorial

Function factorial 

Source
pub fn factorial<N: PrimInt + Unsigned>(n: N) -> N
Expand description

Factorial $n!$

Pure rust implementation of scipy.special.factorial(n, exact=True).

§Maximum n

Anything larger than the maximum n for the given unsigned integer type will overflow.

typen <= _
u85
u168
u3212
u6420
u12834

§Examples

assert_eq!([0_u32, 1, 2, 4, 8].map(xsf::factorial), [1, 1, 2, 24, 40_320]);

§See also