(v: f64, lo: f64, hi: f64)
| 179 | } |
| 180 | |
| 181 | fn clamp(v: f64, lo: f64, hi: f64) -> f64 { |
| 182 | if lo.is_nan() || hi.is_nan() { |
| 183 | return v; |
| 184 | } |
| 185 | |
| 186 | // Handle the case where floating point precision causes min > max. |
| 187 | let (min, max) = if lo > hi { (hi, lo) } else { (lo, hi) }; |
| 188 | |
| 189 | v.clamp(min, max) |
| 190 | } |
| 191 | |
| 192 | // public for testing in other modules |
| 193 | pub fn merge_unsorted_f64(&self, unsorted_values: Vec<f64>) -> TDigest { |
no outgoing calls