def _toIEEEFloat(value: float) -> bytes: bitval = Float16Compressor.compress(value) return bytes([(bitval & 0xFF00) >> 8, bitval & 0xFF])
def _IEEEFloatToFloat(value: bytes) -> float: number = int(((value[0] & 0xFF) << 8) | (value[1] & 0xFF)) temp = Float16Compressor.decompress(number) bytestr = struct.pack('I', temp) f = struct.unpack('f', bytestr)[0] return f