pub trait FixedPointNumberExtension: FixedPointNumber {
Show 36 methods // Required methods fn checked_mul_with_rounding( &self, other: &Self, r: SignedRounding ) -> Option<Self>; fn saturating_mul_with_rounding( self, other: Self, r: SignedRounding ) -> Self; fn checked_div_with_rounding( &self, other: &Self, r: SignedRounding ) -> Option<Self>; fn saturating_div_with_rounding( &self, other: &Self, r: SignedRounding ) -> Self; fn checked_div_int_with_rounding<N: FixedPointOperand>( self, int: N, r: SignedRounding ) -> Option<N>; // Provided methods fn checked_mul_int_with_rounding<N: FixedPointOperand>( self, int: N, r: SignedRounding ) -> Option<N> { ... } fn saturating_mul_int_with_rounding<N: FixedPointOperand>( self, int: N, r: SignedRounding ) -> N { ... } fn checked_mul_int_floor<N: FixedPointOperand>(self, int: N) -> Option<N> { ... } fn checked_mul_int_ceil<N: FixedPointOperand>(self, int: N) -> Option<N> { ... } fn checked_mul_floor(&self, other: &Self) -> Option<Self> { ... } fn checked_mul_ceil(&self, other: &Self) -> Option<Self> { ... } fn saturating_mul_floor(self, other: Self) -> Self { ... } fn saturating_mul_ceil(self, other: Self) -> Self { ... } fn saturating_mul_int_floor<N: FixedPointOperand>(self, int: N) -> N { ... } fn saturating_mul_int_ceil<N: FixedPointOperand>(self, int: N) -> N { ... } fn checked_from_rational_with_rounding<N: FixedPointOperand, D: FixedPointOperand>( n: N, d: D, pref: SignedRounding ) -> Option<Self> { ... } fn checked_from_rational_ceil<N: FixedPointOperand, D: FixedPointOperand>( n: N, d: D ) -> Option<Self> { ... } fn checked_from_rational_floor<N: FixedPointOperand, D: FixedPointOperand>( n: N, d: D ) -> Option<Self> { ... } fn saturating_from_rational_with_rounding<N: FixedPointOperand, D: FixedPointOperand>( n: N, d: D, r: SignedRounding ) -> Self { ... } fn saturating_from_rational_floor<N: FixedPointOperand, D: FixedPointOperand>( n: N, d: D ) -> Self { ... } fn saturating_from_rational_ceil<N: FixedPointOperand, D: FixedPointOperand>( n: N, d: D ) -> Self { ... } fn checked_div_floor(&self, other: &Self) -> Option<Self> { ... } fn checked_div_ceil(&self, other: &Self) -> Option<Self> { ... } fn saturating_div_floor(&self, other: &Self) -> Self { ... } fn saturating_div_ceil(&self, other: &Self) -> Self { ... } fn checked_div_int_floor<N: FixedPointOperand>(self, int: N) -> Option<N> { ... } fn checked_div_int_ceil<N: FixedPointOperand>(self, int: N) -> Option<N> { ... } fn saturating_div_int_with_rounding<N: FixedPointOperand>( self, int: N, r: SignedRounding ) -> N { ... } fn saturating_div_int_floor<N: FixedPointOperand>(self, int: N) -> N { ... } fn saturating_div_int_ceil<N: FixedPointOperand>(self, int: N) -> N { ... } fn reciprocal_with_rounding(self, r: SignedRounding) -> Option<Self> { ... } fn reciprocal_floor(self) -> Option<Self> { ... } fn reciprocal_ceil(self) -> Option<Self> { ... } fn saturating_pow_with_rounding(self, pow: usize, r: SignedRounding) -> Self { ... } fn saturating_pow_floor(self, pow: usize) -> Self { ... } fn saturating_pow_ceil(self, pow: usize) -> Self { ... }
}

Required Methods§

source

fn checked_mul_with_rounding( &self, other: &Self, r: SignedRounding ) -> Option<Self>

Checked multiplication by another val of Type Self, with Rounding::SignedRounding rounding preference. Returns None if out of bounds.

source

fn saturating_mul_with_rounding(self, other: Self, r: SignedRounding) -> Self

Multiples by another val of type Self, with Rounding::SignedRounding rounding preference. Saturates if out of bounds.

source

fn checked_div_with_rounding( &self, other: &Self, r: SignedRounding ) -> Option<Self>

Checked division by another val of Type Self, with Rounding::SignedRounding rounding preference. Returns None if out of bounds.

source

fn saturating_div_with_rounding(&self, other: &Self, r: SignedRounding) -> Self

Divides by another val of type Self, with Rounding::SignedRounding rounding preference. Saturates if out of bounds.

source

fn checked_div_int_with_rounding<N: FixedPointOperand>( self, int: N, r: SignedRounding ) -> Option<N>

Checked division by FixedPointOperand, with Rounding::SignedRounding rounding preference. Returns None if out of bounds.

Note: This assumes that the FP accuracy has been adjusted to match the accuracy of the FP extended type in question (FixedU128 in this case). For example:

   FixedU128::saturating_from_rational(2)
       .checked_div_with_rounding(2, SignedRounding::...)

would be equivalent to

     (2 * FixedU128::accuracy) * (FixedU128::accuracy / 2)

instead of

     2 * 1/2.

Whereas

    FixedU128::saturating_from_rational(2)
        .checked_div_with_rounding(2 * FixedU128::accuracy)

would be equivalent to

    2 * FixedU128::accuracy *
       (FixedU128::accuracy / 2 * FixedU128::accuracy)

Which would be 1 * FixedU128::accuracy

Provided Methods§

source

fn checked_mul_int_with_rounding<N: FixedPointOperand>( self, int: N, r: SignedRounding ) -> Option<N>

Checked multiplication by FixedPointOperand, with Rounding:SignedRounding rounding preference. Returns None if out of bounds.

source

fn saturating_mul_int_with_rounding<N: FixedPointOperand>( self, int: N, r: SignedRounding ) -> N

Multiples by FixedPointOperand, with Rounding::SignedRounding rounding preference. Saturates if out of bounds.

source

fn checked_mul_int_floor<N: FixedPointOperand>(self, int: N) -> Option<N>

Checked multiplication by FixedPointOperand; precision rounded to floor. Returns None if out of bounds.

source

fn checked_mul_int_ceil<N: FixedPointOperand>(self, int: N) -> Option<N>

Checked multiplication by FixedPointOperand; precision rounded to ceil. Returns None if out of bounds.

source

fn checked_mul_floor(&self, other: &Self) -> Option<Self>

Checked multiplication by another val of Type Self; rounds precision to floor. Returns None if out of bounds.

source

fn checked_mul_ceil(&self, other: &Self) -> Option<Self>

Checked multiplication by another val of Type Self; rounds precision to ceil. Returns None if out of bounds.

source

fn saturating_mul_floor(self, other: Self) -> Self

Multiples by another val of type Self; rounds precision to floor. Saturates if out of bounds.

source

fn saturating_mul_ceil(self, other: Self) -> Self

Multiples by another val of type Self; rounds precision to ceil. Saturates if out of bounds.

source

fn saturating_mul_int_floor<N: FixedPointOperand>(self, int: N) -> N

Multiplies by FixedPointOperand with Rounding::SignedRounding rounding preference. Saturates if result out of bounds.

source

fn saturating_mul_int_ceil<N: FixedPointOperand>(self, int: N) -> N

Multiplies by FixedPointOperand; precision rounded to ceil Saturates if result out of bounds.

source

fn checked_from_rational_with_rounding<N: FixedPointOperand, D: FixedPointOperand>( n: N, d: D, pref: SignedRounding ) -> Option<Self>

Creates Self from rational of FixedPointOperands, with Rounding::SignedRounding rounding preference Returns None if out of bounds

source

fn checked_from_rational_ceil<N: FixedPointOperand, D: FixedPointOperand>( n: N, d: D ) -> Option<Self>

Creates Self from rational of FixedPointOperands; rounds precision to ceil. Returns None if out of bounds.

source

fn checked_from_rational_floor<N: FixedPointOperand, D: FixedPointOperand>( n: N, d: D ) -> Option<Self>

Creates Self from rational of FixedPointOperands; rounds precision to floor. Returns None if out of bounds.

source

fn saturating_from_rational_with_rounding<N: FixedPointOperand, D: FixedPointOperand>( n: N, d: D, r: SignedRounding ) -> Self

Creates Self from rational of FixedPointOperands, with Rounding::SignedRounding rounding preference. Panics if denominator 0 is. Saturates if result out of bounds.

source

fn saturating_from_rational_floor<N: FixedPointOperand, D: FixedPointOperand>( n: N, d: D ) -> Self

Creates Self from rational of FixedPointOperands; rounds precision to floor. Panics if denominator 0 is. Saturates if result out of bounds.

source

fn saturating_from_rational_ceil<N: FixedPointOperand, D: FixedPointOperand>( n: N, d: D ) -> Self

Creates Self from rational of FixedPointOperands; rounds precision to ceil. Panics if denominator 0 is. Saturates if result out of bounds.

source

fn checked_div_floor(&self, other: &Self) -> Option<Self>

Checked division by another val of Type Self; rounds precision to floor. Returns None if out of bounds.

source

fn checked_div_ceil(&self, other: &Self) -> Option<Self>

Checked division by another val of Type Self; rounds precision to ceil. Returns None if out of bounds.

source

fn saturating_div_floor(&self, other: &Self) -> Self

Divides by another val of type Self; rounds precision to floor. Saturates if out of bounds.

source

fn saturating_div_ceil(&self, other: &Self) -> Self

Divides by another val of type Self; rounds precision to ceil. Saturates if out of bounds.

source

fn checked_div_int_floor<N: FixedPointOperand>(self, int: N) -> Option<N>

Checked division by FixedPointOperand; rounds precision to floor. Returns None if out of bounds.

Note: This assumes that the FP accuracy has been adjusted to match the accuracy of the FP extended type in question (FixedU128 in this case).

source

fn checked_div_int_ceil<N: FixedPointOperand>(self, int: N) -> Option<N>

Checked division by FixedPointOperand; rounds precision to ceil. Returns None if out of bounds.

Note: This assumes that the FP accuracy has been adjusted to match the accuracy of the FP extended type in question (FixedU128 in this case).

source

fn saturating_div_int_with_rounding<N: FixedPointOperand>( self, int: N, r: SignedRounding ) -> N

Divides by FixedPointOperand, with Rounding:SignedRounding rounding preference. Panics if denominator 0 is. Saturates if result out of bounds.

Note: This assumes that the FP accuracy has been adjusted to match the accuracy of the FP extended type in question (FixedU128 in this case).

source

fn saturating_div_int_floor<N: FixedPointOperand>(self, int: N) -> N

Divides by FixedPointOperand; rounds precision to floor. Panics if denominator 0 is. Saturates if result out of bounds.

Note: This assumes that the FP accuracy has been adjusted to match the accuracy of the FP extended type in question (FixedU128 in this case).

source

fn saturating_div_int_ceil<N: FixedPointOperand>(self, int: N) -> N

Divides by FixedPointOperand; rounds precision to ceil. Panics if denominator 0 is. Saturates if result out of bounds.

Note: This assumes that the FP accuracy has been adjusted to match the accuracy of the FP extended type in question (FixedU128 in this case).

source

fn reciprocal_with_rounding(self, r: SignedRounding) -> Option<Self>

Returns the reciprocal – 1 / self, with Rounding:SignedRounding rounding preference. Returns None if self is 0

source

fn reciprocal_floor(self) -> Option<Self>

Returns reciprocal; rounds precision to floor. Returns None if self is 0

source

fn reciprocal_ceil(self) -> Option<Self>

Returns reciprocal; rounds precision to ceil. Returns None if self is 0

source

fn saturating_pow_with_rounding(self, pow: usize, r: SignedRounding) -> Self

Checked self raised to pow. Saturate if result out of bounds.

source

fn saturating_pow_floor(self, pow: usize) -> Self

Checked self raised to pow; rounds precision to floor. Saturates if result out of bounds.

source

fn saturating_pow_ceil(self, pow: usize) -> Self

Checked self raised to pow; rounds precision to ceil. Saturates if result out of bounds.

Object Safety§

This trait is not object safe.

Implementors§