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
type FullOutput
type FullOutput
Output type for full_mul
Required Methods
fn mul_div_floor(self, num: RHS, denom: RHS) -> Self::Output
fn mul_div_floor(self, num: RHS, denom: RHS) -> Self::Output
Calculates floor(val * num / divisor), i.e. the largest integer less than or equal to the
result of the division.
fn mul_div_round(self, num: RHS, denom: RHS) -> Self::Output
fn mul_div_round(self, num: RHS, denom: RHS) -> Self::Output
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).
fn mul_div_ceil(self, num: RHS, denom: RHS) -> Self::Output
fn mul_div_ceil(self, num: RHS, denom: RHS) -> Self::Output
Calculates ceil(val * num / divisor), i.e. the the smallest integer greater than or equal to
the result of the division.