Reputation: 8147
From the AR Drone Developer's guide:
The number −0.8 is stored in memory as a 32- bit word whose value is BF 4CCCCD (16) , according to the IEEE-754 format. This 32-bit word can be considered as holding the 32-bit integer value −1085485875 (10).
Is there an "easy way" (built-in functions/existing modules) to do this in python ?
Upvotes: 0
Views: 1194
Reputation: 8190
maybe not the best method, but it works.
import struct
s = struct.pack("f", -0.8)
i = struct.unpack("i", s)
print i
Upvotes: 6