PercentDiff

Trait PercentDiff 

Source
pub trait PercentDiff<Rhs = Self> {
    type Output;

    // Required method
    fn percent_diff(self, rhs: Rhs) -> Self::Output;
}
Expand description

Compute the percentage difference between two values. The percentage difference is defined as:

\text{PercentDifference}(x, y) = 2\cdot\frac{|x - y|}{|x| + |y|}

Required Associated Types§

Required Methods§

Source

fn percent_diff(self, rhs: Rhs) -> Self::Output

Implementors§

Source§

impl<T> PercentDiff for T
where T: Copy + Signed + Zero + FromPrimitive + NumOps,