pub trait FullMath<RHS = Self> {
    type Output;
    type FullOutput;

    fn mul_div_floor(self, num: RHS, denom: RHS) -> Self::Output;
    fn mul_div_round(self, num: RHS, denom: RHS) -> Self::Output;
    fn mul_div_ceil(self, num: RHS, denom: RHS) -> Self::Output;
    fn mul_shift_right(self, num: RHS, shift: u32) -> Self::Output;
    fn mul_shift_left(self, num: RHS, shift: u32) -> Self::Output;
    fn full_mul(self, num: RHS) -> Self::FullOutput;
}

Required Associated Types

Output type for the methods of this trait.

Output type for full_mul

Required Methods

Calculates floor(val * num / divisor), i.e. the largest integer less than or equal to the result of the division.

Calculates round(val * num / divisor), i.e. the closest integer to the result of the division. If both surrounding integers are the same distance (x.5), the one with the bigger absolute value is returned (round away from 0.0).

Calculates ceil(val * num / divisor), i.e. the the smallest integer greater than or equal to the result of the division.

Implementations on Foreign Types

Implementors