1

When using this code

import bitstring
f = 1.0e+00
b = bitstring.pack('>d', f)
b.bin

I get 64 bits

001111111111000000000000000000000000000000000000000000000000000

But I need to get Float (IEEE754 Single precision 32-bit)

What is the >d used for?

  • The linked answer is correct, but your specific problem is that you should use `'>f'` instead of `'>d'` in your `pack`. See the [help](https://pythonhosted.org/bitstring/packing.html#compact-format). – Scott Griffiths Jun 30 '18 at 08:23

0 Answers0