pub fn quantize<T>(value: f64, range: Range<f64>, q_max: T) -> Twhere T: Into<f64> + TryFrom<u64> + Copy,
Linearly quantize a value.