MCPcopy Create free account
hub / github.com/cosdata/cosdata / to_float_flag

Function to_float_flag

org/src/main.rs:293–308  ·  view source on GitHub ↗
(x: f32, bits_per_value: usize, step: f32)

Source from the content-addressed store, hash-verified

291}
292
293fn to_float_flag(x: f32, bits_per_value: usize, step: f32) -> Vec<bool> {
294 let mut num = ((x + 1.0) / step).floor() as usize;
295 println!(
296 "bits_per_value : {} | step {} | x {} | num {}",
297 bits_per_value, step, x, num
298 );
299
300 let mut result = vec![];
301 for i in (0..bits_per_value).rev() {
302 let least_significant_bit = num & 1 == 1;
303 result.push(least_significant_bit);
304 num >>= 1;
305 }
306 result.reverse();
307 result
308}
309
310pub fn quantize_to_u32_bits(fins: &[f32], resolution: u8) -> Vec<Vec<u32>> {
311 let bits_per_value = resolution as usize;

Callers 1

quantize_to_u32_bitsFunction · 0.70

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected