Trait Factorial

Source
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 f32

Source§

type Output = f32

Source§

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

Source§

impl Factorial for f64

Source§

type Output = f64

Source§

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

Source§

impl Factorial for i8

Source§

type Output = f64

Source§

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

Source§

impl Factorial for i16

Source§

type Output = f64

Source§

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

Source§

impl Factorial for i32

Source§

type Output = f64

Source§

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

Source§

impl Factorial for i64

Source§

type Output = f64

Source§

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

Source§

impl Factorial for i128

Source§

type Output = f64

Source§

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

Source§

impl Factorial for isize

Source§

type Output = f64

Source§

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

Source§

impl Factorial for u8

Source§

type Output = u128

Source§

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

Source§

impl Factorial for u16

Source§

type Output = u128

Source§

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

Source§

impl Factorial for u32

Source§

type Output = u128

Source§

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

Source§

impl Factorial for u64

Source§

type Output = u128

Source§

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

Source§

impl Factorial for u128

Source§

type Output = u128

Source§

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

Source§

impl Factorial for usize

Source§

type Output = u128

Source§

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

Implementors§