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

Function f64_ordering

nodedb/src/engine/kv/sorted_index/key.rs:188–210  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

186
187 #[test]
188 fn f64_ordering() {
189 let values = [
190 f64::NEG_INFINITY,
191 -100.0,
192 -0.001,
193 0.0,
194 0.001,
195 100.0,
196 f64::INFINITY,
197 ];
198 let encoded: Vec<_> = values
199 .iter()
200 .map(|v| SortKeyEncoder::encode_f64(*v))
201 .collect();
202 for i in 0..encoded.len() - 1 {
203 assert!(
204 encoded[i] < encoded[i + 1],
205 "encode_f64({}) should be < encode_f64({})",
206 values[i],
207 values[i + 1]
208 );
209 }
210 }
211
212 #[test]
213 fn composite_key_desc_score_asc_time() {

Callers

nothing calls this directly

Calls 4

collectMethod · 0.80
encode_f64Function · 0.50
iterMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected