concision_utils/traits/
difference.rs

1/// Compute the percentage difference between two values.
2/// The percentage difference is defined as:
3///
4/// ```text
5/// percent_diff = |x, y| 100 * |x - y| / ((|x| + |y|) / 2)
6/// ```
7pub trait PercentDiff<Rhs = Self> {
8    type Output;
9
10    fn percent_diff(self, rhs: Rhs) -> Self::Output;
11}