MCPcopy Create free account
hub / github.com/apache/datafusion / clamp

Method clamp

datafusion/functions-aggregate-common/src/tdigest.rs:181–190  ·  view source on GitHub ↗
(v: f64, lo: f64, hi: f64)

Source from the content-addressed store, hash-verified

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 {

Callers 9

num_distinct_valsFunction · 0.80
ndv_after_selectivityFunction · 0.80
byte_rangeMethod · 0.80
get_true_start_endFunction · 0.80
test_next_downFunction · 0.80
output_rows_skew_scoreFunction · 0.80
shift_with_default_valueFunction · 0.80

Calls

no outgoing calls

Tested by 1

test_next_downFunction · 0.64