Skip to main content

reduction

Function reduction 

Source
pub fn reduction(control: u64, treatment: u64) -> Option<f64>
Expand description

1 - treatment / control: the share of the control’s quantity the treatment did not spend. Negative when the treatment spent more; None when the control spent nothing, because a ratio against zero is not a number anyone should be shown.

use majordomus_cli::economics::stats::reduction;
assert_eq!(reduction(100, 100), Some(0.0));
assert_eq!(reduction(100, 0), Some(1.0));
assert_eq!(reduction(100, 120), Some(-0.2));
assert_eq!(reduction(0, 0), None);