pub trait Factorial {
    type Output;

    // Required method
    fn factorial(&self) -> Self::Output;
}
Expand description

Allows the usage of factorials i.e. x! usually defined as:

  • x! = x*(x-1)!
  • 0! = 1

for x ∈ ℕ.

The definition of the factorial function can be expanded to the domain of all real numbers using the gamma function:

x! = 𝜞(x+1)

Required Associated Types§

Required Methods§

source

fn factorial(&self) -> Self::Output

Implementations on Foreign Types§

source§

impl Factorial for i32

§

type Output = f64

source§

fn factorial(&self) -> Self::Output

source§

impl Factorial for u64

§

type Output = u128

source§

fn factorial(&self) -> Self::Output

source§

impl Factorial for isize

§

type Output = f64

source§

fn factorial(&self) -> Self::Output

source§

impl Factorial for f64

§

type Output = f64

source§

fn factorial(&self) -> Self::Output

source§

impl Factorial for u8

§

type Output = u128

source§

fn factorial(&self) -> Self::Output

source§

impl Factorial for u128

§

type Output = u128

source§

fn factorial(&self) -> Self::Output

source§

impl Factorial for i16

§

type Output = f64

source§

fn factorial(&self) -> Self::Output

source§

impl Factorial for u16

§

type Output = u128

source§

fn factorial(&self) -> Self::Output

source§

impl Factorial for i128

§

type Output = f64

source§

fn factorial(&self) -> Self::Output

source§

impl Factorial for usize

§

type Output = u128

source§

fn factorial(&self) -> Self::Output

source§

impl Factorial for f32

§

type Output = f32

source§

fn factorial(&self) -> Self::Output

source§

impl Factorial for i64

§

type Output = f64

source§

fn factorial(&self) -> Self::Output

source§

impl Factorial for u32

§

type Output = u128

source§

fn factorial(&self) -> Self::Output

source§

impl Factorial for i8

§

type Output = f64

source§

fn factorial(&self) -> Self::Output

Implementors§