pub trait NumberInstance: Copy + Default + From<Boolean> + Into<Number> + Add<Self, Output = Self> + AddAssign<Self> + Sub<Self, Output = Self> + SubAssign<Self> + Mul<Self, Output = Self> + MulAssign<Self> + Div<Self, Output = Self> + DivAssign<Self> + Product<Self> + Sum<Self> + Debug + Display {
    type Abs: NumberInstance;
    type Exp: NumberInstance;
    type Log: NumberInstance;
    type Round: NumberInstance;
    type Class: NumberClass
    where
        <Self::Class as NumberClass>::Instance == Self
; fn class(&self) -> Self::Class; fn into_type(
        self,
        dtype: Self::Class
    ) -> <Self::Class as NumberClass>::Instance; fn abs(self) -> Self::Abs; fn exp(self) -> Self::Exp; fn ln(self) -> Self::Log; fn log<N>(self, base: N) -> Self::Log
    where
        N: NumberInstance,
        Float: From<N>
; fn pow(self, exp: Number) -> Self; fn round(self) -> Self::Round; fn and(self, other: Self) -> Self
    where
        Boolean: CastFrom<Self>
, { ... } fn not(self) -> Self
    where
        Boolean: CastFrom<Self>
, { ... } fn or(self, other: Self) -> Self
    where
        Boolean: CastFrom<Self>
, { ... } fn xor(self, other: Self) -> Self
    where
        Boolean: CastFrom<Self>
, { ... } }
Expand description

Defines common operations on numeric types supported by Number.

Required Associated Types

Required Methods

Get an impl of NumberClass describing this number.

Cast this number into the specified NumberClass.

Calculate the absolute value of this number.

Raise e to the power of this number.

Compute the natural logarithm of this number.

Compute the logarithm of this number with respect to the given base.

Raise this number to the given exponent.

Panics: if the given exponent is a complex number.

Return this number rounded to the nearest integer.

Provided Methods

Return true if self and other are nonzero.

Return true if this number is zero.

Return true if self or other is nonzero.

Return true if exactly one of self and other is zero.

Implementors