>>> import struct
>>> pd = lambda x: format(struct.unpack('!Q', struct.pack('!d', x))[0], '064b')
>>> pd(180.00000000000003)
# sign (1 bit) | exponent (11 bit) | fraction (52 bit)
#\/ \/
'0100000001100110100000000000000000000000000000000000000000000001'
>>> pd(180)
'0100000001100110100000000000000000000000000000000000000000000000'
>>> pd(-180)
'1100000001100110100000000000000000000000000000000000000000000000'
Last active
April 9, 2018 06:39
-
-
Save KostyaEsmukov/e3a00632c9f38986abc24e7e14eb59b0 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment