I want to perform IEEE 754 conversion from 32-bit binary to float in python.
i have tried this
import struct
f = int('11000001101011000111101011100001', 2)
print struct.unpack('f', struct.pack('i', f))[0]
but this doesn't work for numbers with negative sign bit.
Expected output should be like this:
bintofloat(11000001101011000111101011100001)
>>> -21.56