Esempio n. 1
0
 def _toIEEEFloat(value: float) -> bytes:
     bitval = Float16Compressor.compress(value)
     return bytes([(bitval & 0xFF00) >> 8, bitval & 0xFF])
Esempio n. 2
0
 def _toIEEEFloat(value: float) -> bytes:
     bitval = Float16Compressor.compress(value)
     return bytes([(bitval & 0xFF00) >> 8, bitval & 0xFF])
Esempio n. 3
0
 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
Esempio n. 4
0
 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