PyFi is a library that helps converting fixed-point to floating-point and vice-versa. Here is an example:
PYTHON FIXED POINT CONVERTER
Configuration:
-Type of conversion: Floating to fixed point
-Signedness: Signed
-Total bits: 32
-Fractional bits: 31
WARNING: 1.0 can not be represented, 0.99999999977 will be used instead ( index: 0 )
Converted values:
-Dec (Input): 0.99999999977,-0.50000000000
-Hex (Output): 0x7fffffff,0xc0000000
-Bin (Output): 0b01111111111111111111111111111111,0b11000000000000000000000000000000