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

Function f64_roundtrip

nodedb-codec/src/pcodec.rs:156–164  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

154
155 #[test]
156 fn f64_roundtrip() {
157 let values: Vec<f64> = (0..1000).map(|i| std::f64::consts::PI * i as f64).collect();
158 let encoded = encode_f64(&values).unwrap();
159 let decoded = decode_f64(&encoded).unwrap();
160 assert_eq!(decoded.len(), values.len());
161 for (a, b) in values.iter().zip(decoded.iter()) {
162 assert_eq!(a.to_bits(), b.to_bits(), "mismatch");
163 }
164 }
165
166 #[test]
167 fn f64_compression_ratio() {

Callers

nothing calls this directly

Calls 4

collectMethod · 0.80
encode_f64Function · 0.70
decode_f64Function · 0.70
iterMethod · 0.45

Tested by

no test coverage detected