How to convert from IEEE Python float to Microsoft Basic float
问题 I got Python float value and I need to convert it in to Microsoft Basic Float (MBF) format. Luckily, Got some code from internet that does the reverse. def fmsbin2ieee(self,bytes): """Convert an array of 4 bytes containing Microsoft Binary floating point number to IEEE floating point format (which is used by Python)""" as_int = struct.unpack("i", bytes) if not as_int: return 0.0 man = long(struct.unpack('H', bytes[2:])[0]) exp = (man & 0xff00) - 0x0200 if (exp & 0x8000 != man & 0x8000):