MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / numeric_min_max_f64

Function numeric_min_max_f64

nodedb-columnar/src/writer/stats.rs:128–146  ·  view source on GitHub ↗

Compute min/max for f64 values, skipping nulls.

(values: &[f64], valid: &[bool])

Source from the content-addressed store, hash-verified

126
127/// Compute min/max for f64 values, skipping nulls.
128pub(super) fn numeric_min_max_f64(values: &[f64], valid: &[bool]) -> (f64, f64) {
129 let mut min = f64::INFINITY;
130 let mut max = f64::NEG_INFINITY;
131 for (v, &is_valid) in values.iter().zip(valid.iter()) {
132 if is_valid {
133 if *v < min {
134 min = *v;
135 }
136 if *v > max {
137 max = *v;
138 }
139 }
140 }
141 if min == f64::INFINITY {
142 (0.0, 0.0)
143 } else {
144 (min, max)
145 }
146}

Callers 1

encode_single_blockFunction · 0.85

Calls 1

iterMethod · 0.45

Tested by

no test coverage detected