float32

Function float32 

Source
pub fn float32(bits: &Bits) -> f32
Expand description

Converts up to the first 32 bits of a bit string to a 32 bit float

ยงExample

let bits = Bits::new([0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE]);
let float = bits_as::float32(&bits);

assert_eq!(float, f32::from_bits(0x76543210));

let bits = Bits::new([0x10, 0x32, 0x54]);
let float = bits_as::float32(&bits);

assert_eq!(float, f32::from_bits(0x00543210));